To prevent spam users, you can only post on this forum after registration, which is by invitation. If you want to post on the forum, please send me a mail (h DOT m DOT w DOT verbeek AT tue DOT nl) and I'll send you an invitation in return for an account.
Cloning/Copying a Petri Net
Dear Community,
I try to copy a Petri Net into another object before I manipulate the copy. However, since a normal assertion in Java
obj1 = obj2 is not a real copy but just a copy of the reference, both objects point to the same petri net.
I tried using deepCopying, but it didn't work since the Petrinet object does not implement Serializable.
I also tried clone, but a clone mehtod shouldn't be used and is not visible.
Do you have any idea what else to try? Otherwise I will try to copy it variable after variable by calling the constructor and filling the new object with the values of the old one.
Best regards,
Oliver
I try to copy a Petri Net into another object before I manipulate the copy. However, since a normal assertion in Java
obj1 = obj2 is not a real copy but just a copy of the reference, both objects point to the same petri net.
I tried using deepCopying, but it didn't work since the Petrinet object does not implement Serializable.
I also tried clone, but a clone mehtod shouldn't be used and is not visible.
Do you have any idea what else to try? Otherwise I will try to copy it variable after variable by calling the constructor and filling the new object with the values of the old one.
Best regards,
Oliver
Comments
-
I'm not aware of a Petrinet copy constructor or similar. There are conversion plug-ins between DataPetriNet and Petrinet in the DataPetriNet package. You could use those to do a 3-way conversion PN->DPN->PN and you get your cloned PN.
If you program the copy method for PN yourself, please share it. We should put it in the Petrinets package imho.
-
Dear Oliver,
You can use a line like follows:Petrinet clonedNet = PetrinetFactory.clonePetrinet(net, map);
WithMap<DirectedGraphElement, DirectedGraphElement> map
Where map is optional.
Kind regards,
Eric.
-
Dear Mr. Mannardt, Dear Eric,
thank you very much for your help, I appreciate it a lot!
Best regards,
Oliver
-
hverbeek said:Dear Oliver,
You can use a line like follows:Petrinet clonedNet = PetrinetFactory.clonePetrinet(net, map);
WithMap<DirectedGraphElement, DirectedGraphElement> map
Where map is optional.
Kind regards,
Eric.
for further readers: optional means overloaded method here, so you can use the method without the second parameter. Do not invoke it with null for the second parameter, as it will result in a NullPointerException
Kind regards,
Oliver
Howdy, Stranger!
Categories
- 1.6K All Categories
- 45 Announcements / News
- 225 Process Mining
- 6 - BPI Challenge 2020
- 9 - BPI Challenge 2019
- 24 - BPI Challenge 2018
- 27 - BPI Challenge 2017
- 8 - BPI Challenge 2016
- 68 Research
- 1K ProM 6
- 394 - Usage
- 288 - Development
- 9 RapidProM
- 1 - Usage
- 7 - Development
- 54 ProM5
- 19 - Usage
- 187 Event Logs
- 32 - ProMimport
- 75 - XESame