23
23
private final TimedPlace place;
24
24
private final TimedArcPetriNet tapn;
25
25
private final TimedPlaceComponent placeComponent;
26
private final boolean multishare;
27
private Hashtable<TAPNQuery, TAPNQuery> newQueryToOldQueryMapping;
28
private final Hashtable<TAPNQuery, TAPNQuery> newQueryToOldQueryMapping;
28
29
private final List<TimedToken> oldTokens;
29
private TabContent currentTab;
31
public MakePlaceSharedCommand(TimedArcPetriNet tapn, SharedPlace sharedPlace, TimedPlace place, TimedPlaceComponent placeComponent, TabContent currentTab){
30
private final TabContent currentTab;
32
public MakePlaceSharedCommand(TimedArcPetriNet tapn, SharedPlace sharedPlace, TimedPlace place, TimedPlaceComponent placeComponent, TabContent currentTab, boolean multishare){
32
33
Require.that(tapn != null, "tapn cannot be null");
33
34
Require.that(sharedPlace != null, "sharedPlace cannot be null");
34
35
Require.that(place != null, "timedPlace cannot be null");
35
36
Require.that(placeComponent != null, "placeComponent cannot be null");
36
37
Require.that(currentTab != null, "currentTab cannot be null");
39
40
this.sharedPlace = sharedPlace;
40
41
this.place = place;
41
42
this.placeComponent = placeComponent;
43
this.multishare = multishare;
42
44
oldTokens = place.tokens();
43
45
this.currentTab = currentTab;
44
46
newQueryToOldQueryMapping = new Hashtable<TAPNQuery, TAPNQuery>();
48
public MakePlaceSharedCommand(TimedArcPetriNet tapn, SharedPlace sharedPlace, TimedPlace place, TimedPlaceComponent placeComponent, TabContent currentTab){
49
this(tapn, sharedPlace, place, placeComponent, currentTab, false);
48
53
public void redo() {
49
54
updateArcs(place, sharedPlace);
51
56
tapn.remove(place);
52
tapn.add(sharedPlace);
57
tapn.add(sharedPlace, multishare);
53
58
placeComponent.setUnderlyingPlace(sharedPlace);
55
60
updateQueries(place, sharedPlace);
59
64
public void undo() {
60
65
updateArcs(sharedPlace, place);
61
66
tapn.remove(sharedPlace);
67
tapn.add(place, multishare);
63
68
place.addTokens(oldTokens);
64
69
placeComponent.setUnderlyingPlace(place);