Пример #1
0
 def add_token(self, place_id, token_pointer, token_value, send_time):
     RunInstance.add_token(self, place_id, token_pointer, token_value, send_time)
     for pf in self.place_functions:
         if pf[0].id == place_id:
             self.add_row("A",
                          self.last_event_time,
                          place_id,
                          self.last_event_process,
                          token_value[pf[1]])
Пример #2
0
    def add_token(self, place_id, token_pointer, token_value, send_time):
        self._change_place_counter(place_id, +1)

        if place_id in self.place_functions:
            place, f_index = self.place_functions[place_id]
            self.add_row(
                'A', self.last_event_time, None, self.last_event_process,
                place_id,
                (place_value_name(place, f_index), token_value[f_index]))
        RunInstance.add_token(self, place_id, token_pointer, token_value,
                              send_time)
Пример #3
0
    def add_token(self, place_id, token_pointer, token_value, send_time):
        self._change_place_counter(place_id, +1)

        if place_id in self.place_functions:
            place, f_index = self.place_functions[place_id]
            self.add_row('A',
                         self.last_event_time,
                         None,
                         self.last_event_process,
                         place_id,
                         (place_value_name(place, f_index),
                          token_value[f_index]))
        RunInstance.add_token(
            self, place_id, token_pointer, token_value, send_time)
Пример #4
0
        def reports_callback(line):
            root = xml.fromstring(line)
            net_id = utils.xml_int(root, "net-id")
            runinstance = RunInstance(self.project, self.process_count, self.threads_count)
            for process_id, e in enumerate(root.findall("process")):
                runinstance.event_spawn(process_id, None, 0, net_id)
                for pe in e.findall("place"):
                    place_id = utils.xml_int(pe, "id")
                    for te in pe.findall("token"):
                        name = te.get("value")
                        source = te.get("source")
                        if source is not None:
                            name = "{{{0}}} {1}".format(source, name)
                        runinstance.add_token(place_id, 0, name)
                    runinstance.clear_removed_and_new_tokens()

                for tre in e.findall("enabled"):
                    runinstance.add_enabled_transition(utils.xml_int(tre, "id"))

            for e in root.findall("activation"):
                process_id = utils.xml_int(e, "process-id")
                thread_id = utils.xml_int(e, "thread-id")
                transition_id = utils.xml_int(e, "transition-id")
                runinstance.transition_fired(process_id,
                                             thread_id,
                                             0,
                                             transition_id, [])

            for e in root.findall("packet"):
                origin_id = utils.xml_int(e, "origin-id")
                target_id = utils.xml_int(e, "target-id")
                size = utils.xml_int(e, "size")
                edge_id = utils.xml_int(e, "edge-id")
                runinstance.event_send(origin_id, 0, 0, target_id, size, edge_id)

            runinstance.reset_last_event_info()

            self.runinstance = runinstance
            print("UKLADAM")########################################################################
            self.history_instances.append(runinstance)

            if self.running and utils.xml_bool(root, "quit"):
                self.running = False
                self.emit_event("error", "Program finished\n")
            if callback:
                callback()
            self.emit_event("changed", True)
Пример #5
0
        def reports_callback(line):
            root = xml.fromstring(line)
            net_id = utils.xml_int(root, "net-id")
            runinstance = RunInstance(self.project, self.process_count)
            for process_id, e in enumerate(root.findall("process")):
                runinstance.event_spawn(process_id, 0, net_id)
                for pe in e.findall("place"):
                    place_id = utils.xml_int(pe, "id")
                    for te in pe.findall("token"):
                        name = te.get("value")
                        source = te.get("source")
                        if source is not None:
                            name = "{{{0}}} {1}".format(source, name)
                        runinstance.add_token(place_id, 0, name)
                    runinstance.clear_removed_and_new_tokens()

                for tre in e.findall("enabled"):
                    runinstance.add_enabled_transition(utils.xml_int(tre, "id"))

            for e in root.findall("activation"):
                process_id = utils.xml_int(e, "process-id")
                transition_id = utils.xml_int(e, "transition-id")
                runinstance.transition_fired(process_id,
                                             0,
                                             transition_id, [])
                if utils.xml_bool(e, "blocked", False):
                    runinstance.transition_blocked(process_id)

            for e in root.findall("packet"):
                origin_id = utils.xml_int(e, "origin-id")
                target_id = utils.xml_int(e, "target-id")
                size = utils.xml_int(e, "size")
                edge_id = utils.xml_int(e, "edge-id")
                runinstance.event_send(origin_id, 0, target_id, size, edge_id)

            runinstance.reset_last_event_info()

            self.runinstance = runinstance
            self.history_instances.append(runinstance)

            if self.state != "finished" and utils.xml_bool(root, "quit"):
                self.state = "finished"
                self.emit_event("error", "Program finished\n")
            if callback:
                callback()
            self.emit_event("changed", True)
Пример #6
0
    def add_token(self, place_id, token_pointer, token_value, send_time):
        RunInstance.add_token(self, place_id, token_pointer, token_value, send_time)
        net_instance = self.last_event_instance
        self.change_tokens_data(net_instance.process_id,
                                place_id, self.last_time, 1)

        previous_action = self.last_event_info.get_name()
        time = self.last_event_info.get_time()
        process = self.last_event_info.get_process()
        thread = self.last_event_info.get_thread()
        transition = self.last_event_info.get_transition()
        transition_value = self.last_event_info.get_transition_value()

        val = token_value[0] if token_value is not None else ""
        self.add_entry(
            "add_token", previous_action, time, process, thread, process, thread,
            transition, transition_value, send_time, place_id, val)