Showing
1 changed file
with
16 additions
and
0 deletions
... | @@ -283,6 +283,22 @@ def extend (module) : | ... | @@ -283,6 +283,22 @@ def extend (module) : |
283 | self.add_place(snk.Place(nextpids, [], tNextPid, | 283 | self.add_place(snk.Place(nextpids, [], tNextPid, |
284 | status=snk.buffer(nextpids))) | 284 | status=snk.buffer(nextpids))) |
285 | self.nextpids = nextpids | 285 | self.nextpids = nextpids |
286 | + def copy (self, name=None) : | ||
287 | + if name is None : | ||
288 | + name = self.name | ||
289 | + result = self.__class__(name) | ||
290 | + result._declare = self._declare[:] | ||
291 | + result.globals = self.globals.copy() | ||
292 | + for place in self.place() : | ||
293 | + if place.name != self.nextpids : | ||
294 | + result.add_place(place.copy()) | ||
295 | + for trans in self.transition() : | ||
296 | + result.add_transition(trans.copy()) | ||
297 | + for place, label in trans.input() : | ||
298 | + result.add_input(place.name, trans.name, label.copy()) | ||
299 | + for place, label in trans.output() : | ||
300 | + result.add_output(place.name, trans.name, label.copy()) | ||
301 | + return result | ||
286 | def add_place (self, place, **args) : | 302 | def add_place (self, place, **args) : |
287 | if place.name == self.nextpids : | 303 | if place.name == self.nextpids : |
288 | raise ConstraintError("reserved place name %r" | 304 | raise ConstraintError("reserved place name %r" | ... | ... |
-
Please register or login to post a comment