Merge lp:~yrke/tapaal/removedUnusedFieldsFromXML into lp:tapaal

Proposed by Kenneth Yrke Jørgensen
Status: Merged
Approved by: Jiri Srba
Approved revision: 1032
Merged at revision: 991
Proposed branch: lp:~yrke/tapaal/removedUnusedFieldsFromXML
Merge into: lp:tapaal
Prerequisite: lp:~yrke/tapaal/placetransitionobjecthandler-refactor
Diff against target: 205 lines (+15/-57)
8 files modified
src/dk/aau/cs/io/PNMLWriter.java (+0/-4)
src/dk/aau/cs/io/PNMLoader.java (+1/-2)
src/dk/aau/cs/io/TapnLegacyXmlLoader.java (+1/-6)
src/dk/aau/cs/io/TapnXmlLoader.java (+1/-3)
src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java (+1/-3)
src/dk/aau/cs/verification/TAPNComposer.java (+5/-7)
src/pipe/gui/graphicElements/Place.java (+3/-27)
src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java (+3/-5)
To merge this branch: bzr merge lp:~yrke/tapaal/removedUnusedFieldsFromXML
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Kenneth Yrke Jørgensen Needs Resubmitting
Review via email: mp+356866@code.launchpad.net

Commit message

Removed unused fields from XML/TAPN file format

Description of the change

Must test loading and saving of nets

To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) wrote :

Has conflicts with trunk that need to be resolved.

review: Needs Fixing
1032. By Kenneth Yrke Jørgensen

Merged with trunk

Revision history for this message
Kenneth Yrke Jørgensen (yrke) wrote :

Fixed merge conflicts with trunk

Revision history for this message
Kenneth Yrke Jørgensen (yrke) :
review: Needs Resubmitting
Revision history for this message
Jiri Srba (srba) wrote :

Couldn't see any issues with loading/saving nets.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/dk/aau/cs/io/PNMLWriter.java'
2--- src/dk/aau/cs/io/PNMLWriter.java 2018-05-13 19:54:55 +0000
3+++ src/dk/aau/cs/io/PNMLWriter.java 2019-03-13 07:18:09 +0000
4@@ -179,10 +179,6 @@
5 placeElement.appendChild(name);
6 Element initialMarkingGraphics = document.createElement("graphics");
7 initialMarking.appendChild(initialMarkingGraphics);
8- Element initialMarkingOffset = document.createElement("offset");
9- initialMarkingGraphics.appendChild(initialMarkingOffset);
10- initialMarkingOffset.setAttribute("x", (inputPlace.getMarkingOffsetXObject() != null ? String.valueOf(Math.round(inputPlace.getMarkingOffsetXObject())) : ""));
11- initialMarkingOffset.setAttribute("y", (inputPlace.getMarkingOffsetYObject() != null ? String.valueOf(Math.round(inputPlace.getMarkingOffsetYObject())) : ""));
12 Element initialMarkingText = document.createElement("text");
13 initialMarking.appendChild(initialMarkingText);
14 initialMarkingText.setTextContent(((Integer) inputPlace.getNumberOfTokens() != null ? String.valueOf((Integer) inputPlace.getNumberOfTokens()) : "0"));
15
16=== modified file 'src/dk/aau/cs/io/PNMLoader.java'
17--- src/dk/aau/cs/io/PNMLoader.java 2019-03-10 19:47:44 +0000
18+++ src/dk/aau/cs/io/PNMLoader.java 2019-03-13 07:18:09 +0000
19@@ -197,8 +197,7 @@
20
21 if(isNetDrawable()){
22 //We parse the id as both the name and id as in tapaal name = id, and name/id has to be unique
23- TimedPlaceComponent placeComponent = new TimedPlaceComponent(position.getX(), position.getY(), id, name.point.getX(), name.point.getY(),
24- marking.point.x, marking.point.y);
25+ TimedPlaceComponent placeComponent = new TimedPlaceComponent(position.getX(), position.getY(), id, name.point.getX(), name.point.getY());
26 placeComponent.setUnderlyingPlace(place);
27 template.guiModel().addPetriNetObject(placeComponent);
28 }
29
30=== modified file 'src/dk/aau/cs/io/TapnLegacyXmlLoader.java'
31--- src/dk/aau/cs/io/TapnLegacyXmlLoader.java 2018-10-18 15:38:54 +0000
32+++ src/dk/aau/cs/io/TapnLegacyXmlLoader.java 2019-03-13 07:18:09 +0000
33@@ -568,9 +568,6 @@
34 double nameOffsetXInput = getNameOffsetAttribute(element, "x");
35 double nameOffsetYInput = getNameOffsetAttribute(element, "y");
36 int initialMarkingInput = getContentOfFirstSpecificChildNodesValueChildNodeAsInt(element, "initialMarking");
37- double markingOffsetXInput = getMarkingOffsetAttribute(element, "x");
38- double markingOffsetYInput = getMarkingOffsetAttribute(element, "y");
39- int capacityInput = getContentOfFirstSpecificChildNodesValueChildNodeAsInt(element, "capacity");
40 String invariant = getChildNodesContentOfValueChildNodeAsString(element, "invariant");
41
42 positionXInput = Grid.getModifiedX(positionXInput);
43@@ -602,9 +599,7 @@
44 //
45 // } else {
46 place = new TimedPlaceComponent(positionXInput, positionYInput,
47- idInput, nameOffsetXInput, nameOffsetYInput,
48- markingOffsetXInput,
49- markingOffsetYInput);
50+ idInput, nameOffsetXInput, nameOffsetYInput);
51
52 LocalTimedPlace p = new LocalTimedPlace(nameInput, TimeInvariant.parse(invariant, constants));
53 tapn.add(p);
54
55=== modified file 'src/dk/aau/cs/io/TapnXmlLoader.java'
56--- src/dk/aau/cs/io/TapnXmlLoader.java 2018-10-18 15:38:54 +0000
57+++ src/dk/aau/cs/io/TapnXmlLoader.java 2019-03-13 07:18:09 +0000
58@@ -408,8 +408,6 @@
59 double nameOffsetXInput = Double.parseDouble(place.getAttribute("nameOffsetX"));
60 double nameOffsetYInput = Double.parseDouble(place.getAttribute("nameOffsetY"));
61 int initialMarkingInput = Integer.parseInt(place.getAttribute("initialMarking"));
62- double markingOffsetXInput = Double.parseDouble(place.getAttribute("markingOffsetX"));
63- double markingOffsetYInput = Double.parseDouble(place.getAttribute("markingOffsetY"));
64 String invariant = place.getAttribute("invariant");
65 boolean displayName = place.getAttribute("displayName").equals("false") ? false : true;
66
67@@ -446,7 +444,7 @@
68 }
69 }
70 nameGenerator.updateIndicesForAllModels(nameInput);
71- TimedPlaceComponent placeComponent = new TimedPlaceComponent(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput, markingOffsetXInput, markingOffsetYInput);
72+ TimedPlaceComponent placeComponent = new TimedPlaceComponent(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput);
73 placeComponent.setUnderlyingPlace(p);
74
75 if (!displayName){
76
77=== modified file 'src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java'
78--- src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java 2018-08-05 22:13:16 +0000
79+++ src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java 2019-03-13 07:18:09 +0000
80@@ -384,9 +384,7 @@
81 placeElement.setAttribute("nameOffsetX", (inputPlace.getNameOffsetXObject() != null ? String.valueOf(inputPlace.getNameOffsetXObject()) : ""));
82 placeElement.setAttribute("nameOffsetY", (inputPlace.getNameOffsetYObject() != null ? String.valueOf(inputPlace.getNameOffsetYObject()) : ""));
83 placeElement.setAttribute("initialMarking", ((Integer) inputPlace.getNumberOfTokens() != null ? String.valueOf((Integer) inputPlace.getNumberOfTokens()) : "0"));
84- placeElement.setAttribute("markingOffsetX", (inputPlace.getMarkingOffsetXObject() != null ? String.valueOf(inputPlace.getMarkingOffsetXObject()) : ""));
85- placeElement.setAttribute("markingOffsetY", (inputPlace.getMarkingOffsetYObject() != null ? String.valueOf(inputPlace.getMarkingOffsetYObject()) : ""));
86- placeElement.setAttribute("invariant", inputPlace.underlyingPlace().invariant().toString());
87+ placeElement.setAttribute("invariant", inputPlace.underlyingPlace().invariant().toString());
88
89 return placeElement;
90 }
91
92=== modified file 'src/dk/aau/cs/verification/TAPNComposer.java'
93--- src/dk/aau/cs/verification/TAPNComposer.java 2018-10-18 15:02:41 +0000
94+++ src/dk/aau/cs/verification/TAPNComposer.java 2019-03-13 07:18:09 +0000
95@@ -186,9 +186,7 @@
96 oldPlace.getPositionY(),
97 oldPlace.getId(),
98 oldPlace.getNameOffsetX(),
99- oldPlace.getNameOffsetY(),
100- oldPlace.getMarkingOffsetXObject().doubleValue(),
101- oldPlace.getMarkingOffsetYObject().doubleValue()
102+ oldPlace.getNameOffsetY()
103 );
104 newPlace.setUnderlyingPlace(constructedPlace);
105 newPlace.setName(uniquePlaceName);
106@@ -235,10 +233,10 @@
107 oldPlace.getPositionY() + offset.value2() * greatestHeight,
108 oldPlace.getId(),
109 oldPlace.getNameOffsetX(),
110- oldPlace.getNameOffsetY(),
111- oldPlace.getMarkingOffsetXObject().doubleValue(),
112- oldPlace.getMarkingOffsetYObject().doubleValue()
113- );
114+ oldPlace.getNameOffsetY()
115+ );
116+ newPlace.setGuiModel(guiModel);
117+
118 newPlace.setUnderlyingPlace(place);
119 newPlace.setName(uniquePlaceName);
120 guiModel.addPetriNetObject(newPlace);
121
122=== modified file 'src/pipe/gui/graphicElements/Place.java'
123--- src/pipe/gui/graphicElements/Place.java 2018-10-21 18:14:13 +0000
124+++ src/pipe/gui/graphicElements/Place.java 2019-03-13 07:18:09 +0000
125@@ -19,11 +19,9 @@
126
127 private static final long serialVersionUID = -5155964364065651381L;
128
129- // Initial Marking X-axis Offset
130- protected Double markingOffsetX = 0d;
131
132- // Initial Marking Y-axis Offset
133- protected Double markingOffsetY = 0d;
134+ // Value of the capacity restriction; 0 means no capacity restriction
135+ protected Integer capacity = 0;
136
137 protected static final int DIAMETER = Pipe.PLACE_TRANSITION_HEIGHT;
138
139@@ -44,12 +42,8 @@
140 protected static Shape proximityPlace = (new BasicStroke(Pipe.PLACE_TRANSITION_PROXIMITY_RADIUS)).createStrokedShape(placeEllipse);
141
142 public Place(double positionXInput, double positionYInput, String idInput,
143- Double nameOffsetXInput, Double nameOffsetYInput,
144- double markingOffsetXInput,
145- double markingOffsetYInput) {
146+ Double nameOffsetXInput, Double nameOffsetYInput) {
147 super(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput);
148- markingOffsetX = new Double(markingOffsetXInput);
149- markingOffsetY = new Double(markingOffsetYInput);
150 componentWidth = DIAMETER;
151 componentHeight = DIAMETER;
152 setCentre((int) positionX, (int) positionY);
153@@ -92,24 +86,6 @@
154 }
155
156 /**
157- * Get X-axis offset for initial marking
158- *
159- * @return Double value for X-axis offset of initial marking
160- */
161- public Double getMarkingOffsetXObject() {
162- return markingOffsetX;
163- }
164-
165- /**
166- * Get Y-axis offset for initial marking
167- *
168- * @return Double value for X-axis offset of initial marking
169- */
170- public Double getMarkingOffsetYObject() {
171- return markingOffsetY;
172- }
173-
174- /**
175 * Returns the diameter of this Place at the current zoom
176 */
177 private int getDiameter() {
178
179=== modified file 'src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java'
180--- src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java 2018-10-18 15:08:44 +0000
181+++ src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java 2019-03-13 07:18:09 +0000
182@@ -66,12 +66,10 @@
183
184 public TimedPlaceComponent(double positionXInput, double positionYInput,
185 String idInput, Double nameOffsetXInput,
186- Double nameOffsetYInput,
187- double markingOffsetXInput, double markingOffsetYInput) {
188+ Double nameOffsetYInput) {
189
190 super(positionXInput, positionYInput, idInput,
191- nameOffsetXInput, nameOffsetYInput,
192- markingOffsetXInput, markingOffsetYInput);
193+ nameOffsetXInput, nameOffsetYInput);
194 listener = timedPlaceListener();
195 attributesVisible = true;
196 ageOfTokensWindow = new Window(new Frame());
197@@ -432,7 +430,7 @@
198 }
199
200 public TimedPlaceComponent copy(TimedArcPetriNet tapn) {
201- TimedPlaceComponent placeComponent = new TimedPlaceComponent(getPositionXObject(), getPositionYObject(), id, nameOffsetX, nameOffsetY, markingOffsetX, markingOffsetY);
202+ TimedPlaceComponent placeComponent = new TimedPlaceComponent(getPositionXObject(), getPositionYObject(), id, nameOffsetX, nameOffsetY);
203 placeComponent.setUnderlyingPlace(tapn.getPlaceByName(place.name()));
204
205 return placeComponent;

Subscribers

People subscribed via source and target branches