~tapaal-contributor/tapaal/unselect-objects-after-undo-1894108

« back to all changes in this revision

Viewing changes to src/dk/aau/cs/model/tapn/TimedPlace.java

- Did some refactorings in the model.
- Added double click shortcut to shared places/transitions list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
        
14
14
        private String name;
15
15
        private TimeInvariant invariant;
16
 
        private List<TimedOutputArc> preset;
17
 
        private List<TimedInputArc> postset;
18
 
        private List<TransportArc> presetTransportArcs;
19
 
        private List<TransportArc> postsetTransportArcs;
20
 
 
 
16
        private List<TimedOutputArc> preset = new ArrayList<TimedOutputArc>();
 
17
        private List<TimedInputArc> postset = new ArrayList<TimedInputArc>();
 
18
        private List<TransportArc> presetTransportArcs = new ArrayList<TransportArc>();
 
19
        private List<TransportArc> postsetTransportArcs = new ArrayList<TransportArc>();
 
20
        private List<TimedInhibitorArc> inhibitorArcs = new ArrayList<TimedInhibitorArc>();
 
21
        
21
22
        private TimedMarking currentMarking;
22
23
 
23
 
        private List<TimedPlaceListener> listeners;
 
24
        private List<TimedPlaceListener> listeners = new ArrayList<TimedPlaceListener>();
24
25
        
25
26
        public TimedPlace(String name) {
26
27
                this(name, TimeInvariant.LESS_THAN_INFINITY);
29
30
        public TimedPlace(String name, TimeInvariant invariant) {
30
31
                setName(name);
31
32
                setInvariant(invariant);
32
 
                preset = new ArrayList<TimedOutputArc>();
33
 
                postset = new ArrayList<TimedInputArc>();
34
 
                presetTransportArcs = new ArrayList<TransportArc>();
35
 
                postsetTransportArcs = new ArrayList<TransportArc>();
36
 
                listeners = new ArrayList<TimedPlaceListener>();
37
33
        }
38
34
 
39
35
        public void addTimedPlaceListener(TimedPlaceListener listener){
46
42
                listeners.remove(listener);
47
43
        }
48
44
        
49
 
        public void setCurrentMarking(TimedMarking currentMarking) {
50
 
                this.currentMarking = currentMarking;
 
45
        public void setCurrentMarking(TimedMarking newMarking) {
 
46
                Require.that(newMarking != null, "newMarking cannot be null");
 
47
                this.currentMarking = newMarking;
51
48
        }
52
49
 
53
50
        public String name() {
100
97
                Require.that(arc != null, "Cannot add null to postset");
101
98
                postsetTransportArcs.add(arc);
102
99
        }
 
100
        
 
101
        public void addInhibitorArc(TimedInhibitorArc arc){
 
102
                Require.that(arc != null, "arc cannot be null");
 
103
                inhibitorArcs.add(arc);
 
104
        }
 
105
        
 
106
        public void removeInhibitorArc(TimedInhibitorArc arc){
 
107
                Require.that(arc != null, "arc cannot be null");
 
108
                inhibitorArcs.remove(arc);
 
109
        }
103
110
 
104
111
        public boolean hasTokenSatisfyingInterval(TimeInterval interval) {
105
112
                List<TimedToken> tokens = currentMarking.getTokensFor(this);