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
=== modified file 'src/dk/aau/cs/io/PNMLWriter.java'
--- src/dk/aau/cs/io/PNMLWriter.java 2018-05-13 19:54:55 +0000
+++ src/dk/aau/cs/io/PNMLWriter.java 2019-03-13 07:18:09 +0000
@@ -179,10 +179,6 @@
179 placeElement.appendChild(name);179 placeElement.appendChild(name);
180 Element initialMarkingGraphics = document.createElement("graphics");180 Element initialMarkingGraphics = document.createElement("graphics");
181 initialMarking.appendChild(initialMarkingGraphics);181 initialMarking.appendChild(initialMarkingGraphics);
182 Element initialMarkingOffset = document.createElement("offset");
183 initialMarkingGraphics.appendChild(initialMarkingOffset);
184 initialMarkingOffset.setAttribute("x", (inputPlace.getMarkingOffsetXObject() != null ? String.valueOf(Math.round(inputPlace.getMarkingOffsetXObject())) : ""));
185 initialMarkingOffset.setAttribute("y", (inputPlace.getMarkingOffsetYObject() != null ? String.valueOf(Math.round(inputPlace.getMarkingOffsetYObject())) : ""));
186 Element initialMarkingText = document.createElement("text");182 Element initialMarkingText = document.createElement("text");
187 initialMarking.appendChild(initialMarkingText);183 initialMarking.appendChild(initialMarkingText);
188 initialMarkingText.setTextContent(((Integer) inputPlace.getNumberOfTokens() != null ? String.valueOf((Integer) inputPlace.getNumberOfTokens()) : "0"));184 initialMarkingText.setTextContent(((Integer) inputPlace.getNumberOfTokens() != null ? String.valueOf((Integer) inputPlace.getNumberOfTokens()) : "0"));
189185
=== modified file 'src/dk/aau/cs/io/PNMLoader.java'
--- src/dk/aau/cs/io/PNMLoader.java 2019-03-10 19:47:44 +0000
+++ src/dk/aau/cs/io/PNMLoader.java 2019-03-13 07:18:09 +0000
@@ -197,8 +197,7 @@
197 197
198 if(isNetDrawable()){198 if(isNetDrawable()){
199 //We parse the id as both the name and id as in tapaal name = id, and name/id has to be unique 199 //We parse the id as both the name and id as in tapaal name = id, and name/id has to be unique
200 TimedPlaceComponent placeComponent = new TimedPlaceComponent(position.getX(), position.getY(), id, name.point.getX(), name.point.getY(),200 TimedPlaceComponent placeComponent = new TimedPlaceComponent(position.getX(), position.getY(), id, name.point.getX(), name.point.getY());
201 marking.point.x, marking.point.y);
202 placeComponent.setUnderlyingPlace(place);201 placeComponent.setUnderlyingPlace(place);
203 template.guiModel().addPetriNetObject(placeComponent);202 template.guiModel().addPetriNetObject(placeComponent);
204 }203 }
205204
=== modified file 'src/dk/aau/cs/io/TapnLegacyXmlLoader.java'
--- src/dk/aau/cs/io/TapnLegacyXmlLoader.java 2018-10-18 15:38:54 +0000
+++ src/dk/aau/cs/io/TapnLegacyXmlLoader.java 2019-03-13 07:18:09 +0000
@@ -568,9 +568,6 @@
568 double nameOffsetXInput = getNameOffsetAttribute(element, "x");568 double nameOffsetXInput = getNameOffsetAttribute(element, "x");
569 double nameOffsetYInput = getNameOffsetAttribute(element, "y");569 double nameOffsetYInput = getNameOffsetAttribute(element, "y");
570 int initialMarkingInput = getContentOfFirstSpecificChildNodesValueChildNodeAsInt(element, "initialMarking");570 int initialMarkingInput = getContentOfFirstSpecificChildNodesValueChildNodeAsInt(element, "initialMarking");
571 double markingOffsetXInput = getMarkingOffsetAttribute(element, "x");
572 double markingOffsetYInput = getMarkingOffsetAttribute(element, "y");
573 int capacityInput = getContentOfFirstSpecificChildNodesValueChildNodeAsInt(element, "capacity");
574 String invariant = getChildNodesContentOfValueChildNodeAsString(element, "invariant");571 String invariant = getChildNodesContentOfValueChildNodeAsString(element, "invariant");
575572
576 positionXInput = Grid.getModifiedX(positionXInput);573 positionXInput = Grid.getModifiedX(positionXInput);
@@ -602,9 +599,7 @@
602//599//
603// } else {600// } else {
604 place = new TimedPlaceComponent(positionXInput, positionYInput,601 place = new TimedPlaceComponent(positionXInput, positionYInput,
605 idInput, nameOffsetXInput, nameOffsetYInput,602 idInput, nameOffsetXInput, nameOffsetYInput);
606 markingOffsetXInput,
607 markingOffsetYInput);
608603
609 LocalTimedPlace p = new LocalTimedPlace(nameInput, TimeInvariant.parse(invariant, constants));604 LocalTimedPlace p = new LocalTimedPlace(nameInput, TimeInvariant.parse(invariant, constants));
610 tapn.add(p);605 tapn.add(p);
611606
=== modified file 'src/dk/aau/cs/io/TapnXmlLoader.java'
--- src/dk/aau/cs/io/TapnXmlLoader.java 2018-10-18 15:38:54 +0000
+++ src/dk/aau/cs/io/TapnXmlLoader.java 2019-03-13 07:18:09 +0000
@@ -408,8 +408,6 @@
408 double nameOffsetXInput = Double.parseDouble(place.getAttribute("nameOffsetX"));408 double nameOffsetXInput = Double.parseDouble(place.getAttribute("nameOffsetX"));
409 double nameOffsetYInput = Double.parseDouble(place.getAttribute("nameOffsetY"));409 double nameOffsetYInput = Double.parseDouble(place.getAttribute("nameOffsetY"));
410 int initialMarkingInput = Integer.parseInt(place.getAttribute("initialMarking"));410 int initialMarkingInput = Integer.parseInt(place.getAttribute("initialMarking"));
411 double markingOffsetXInput = Double.parseDouble(place.getAttribute("markingOffsetX"));
412 double markingOffsetYInput = Double.parseDouble(place.getAttribute("markingOffsetY"));
413 String invariant = place.getAttribute("invariant");411 String invariant = place.getAttribute("invariant");
414 boolean displayName = place.getAttribute("displayName").equals("false") ? false : true;412 boolean displayName = place.getAttribute("displayName").equals("false") ? false : true;
415 413
@@ -446,7 +444,7 @@
446 }444 }
447 }445 }
448 nameGenerator.updateIndicesForAllModels(nameInput);446 nameGenerator.updateIndicesForAllModels(nameInput);
449 TimedPlaceComponent placeComponent = new TimedPlaceComponent(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput, markingOffsetXInput, markingOffsetYInput);447 TimedPlaceComponent placeComponent = new TimedPlaceComponent(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput);
450 placeComponent.setUnderlyingPlace(p);448 placeComponent.setUnderlyingPlace(p);
451 449
452 if (!displayName){450 if (!displayName){
453451
=== modified file 'src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java'
--- src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java 2018-08-05 22:13:16 +0000
+++ src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java 2019-03-13 07:18:09 +0000
@@ -384,9 +384,7 @@
384 placeElement.setAttribute("nameOffsetX", (inputPlace.getNameOffsetXObject() != null ? String.valueOf(inputPlace.getNameOffsetXObject()) : ""));384 placeElement.setAttribute("nameOffsetX", (inputPlace.getNameOffsetXObject() != null ? String.valueOf(inputPlace.getNameOffsetXObject()) : ""));
385 placeElement.setAttribute("nameOffsetY", (inputPlace.getNameOffsetYObject() != null ? String.valueOf(inputPlace.getNameOffsetYObject()) : ""));385 placeElement.setAttribute("nameOffsetY", (inputPlace.getNameOffsetYObject() != null ? String.valueOf(inputPlace.getNameOffsetYObject()) : ""));
386 placeElement.setAttribute("initialMarking", ((Integer) inputPlace.getNumberOfTokens() != null ? String.valueOf((Integer) inputPlace.getNumberOfTokens()) : "0"));386 placeElement.setAttribute("initialMarking", ((Integer) inputPlace.getNumberOfTokens() != null ? String.valueOf((Integer) inputPlace.getNumberOfTokens()) : "0"));
387 placeElement.setAttribute("markingOffsetX", (inputPlace.getMarkingOffsetXObject() != null ? String.valueOf(inputPlace.getMarkingOffsetXObject()) : ""));387 placeElement.setAttribute("invariant", inputPlace.underlyingPlace().invariant().toString());
388 placeElement.setAttribute("markingOffsetY", (inputPlace.getMarkingOffsetYObject() != null ? String.valueOf(inputPlace.getMarkingOffsetYObject()) : ""));
389 placeElement.setAttribute("invariant", inputPlace.underlyingPlace().invariant().toString());
390388
391 return placeElement;389 return placeElement;
392 }390 }
393391
=== modified file 'src/dk/aau/cs/verification/TAPNComposer.java'
--- src/dk/aau/cs/verification/TAPNComposer.java 2018-10-18 15:02:41 +0000
+++ src/dk/aau/cs/verification/TAPNComposer.java 2019-03-13 07:18:09 +0000
@@ -186,9 +186,7 @@
186 oldPlace.getPositionY(),186 oldPlace.getPositionY(),
187 oldPlace.getId(),187 oldPlace.getId(),
188 oldPlace.getNameOffsetX(),188 oldPlace.getNameOffsetX(),
189 oldPlace.getNameOffsetY(),189 oldPlace.getNameOffsetY()
190 oldPlace.getMarkingOffsetXObject().doubleValue(),
191 oldPlace.getMarkingOffsetYObject().doubleValue()
192 );190 );
193 newPlace.setUnderlyingPlace(constructedPlace);191 newPlace.setUnderlyingPlace(constructedPlace);
194 newPlace.setName(uniquePlaceName);192 newPlace.setName(uniquePlaceName);
@@ -235,10 +233,10 @@
235 oldPlace.getPositionY() + offset.value2() * greatestHeight,233 oldPlace.getPositionY() + offset.value2() * greatestHeight,
236 oldPlace.getId(),234 oldPlace.getId(),
237 oldPlace.getNameOffsetX(),235 oldPlace.getNameOffsetX(),
238 oldPlace.getNameOffsetY(),236 oldPlace.getNameOffsetY()
239 oldPlace.getMarkingOffsetXObject().doubleValue(),237 );
240 oldPlace.getMarkingOffsetYObject().doubleValue()238 newPlace.setGuiModel(guiModel);
241 );239
242 newPlace.setUnderlyingPlace(place);240 newPlace.setUnderlyingPlace(place);
243 newPlace.setName(uniquePlaceName);241 newPlace.setName(uniquePlaceName);
244 guiModel.addPetriNetObject(newPlace);242 guiModel.addPetriNetObject(newPlace);
245243
=== modified file 'src/pipe/gui/graphicElements/Place.java'
--- src/pipe/gui/graphicElements/Place.java 2018-10-21 18:14:13 +0000
+++ src/pipe/gui/graphicElements/Place.java 2019-03-13 07:18:09 +0000
@@ -19,11 +19,9 @@
1919
20 private static final long serialVersionUID = -5155964364065651381L;20 private static final long serialVersionUID = -5155964364065651381L;
2121
22 // Initial Marking X-axis Offset
23 protected Double markingOffsetX = 0d;
2422
25 // Initial Marking Y-axis Offset 23 // Value of the capacity restriction; 0 means no capacity restriction
26 protected Double markingOffsetY = 0d;24 protected Integer capacity = 0;
2725
28 protected static final int DIAMETER = Pipe.PLACE_TRANSITION_HEIGHT;26 protected static final int DIAMETER = Pipe.PLACE_TRANSITION_HEIGHT;
2927
@@ -44,12 +42,8 @@
44 protected static Shape proximityPlace = (new BasicStroke(Pipe.PLACE_TRANSITION_PROXIMITY_RADIUS)).createStrokedShape(placeEllipse);42 protected static Shape proximityPlace = (new BasicStroke(Pipe.PLACE_TRANSITION_PROXIMITY_RADIUS)).createStrokedShape(placeEllipse);
4543
46 public Place(double positionXInput, double positionYInput, String idInput,44 public Place(double positionXInput, double positionYInput, String idInput,
47 Double nameOffsetXInput, Double nameOffsetYInput,45 Double nameOffsetXInput, Double nameOffsetYInput) {
48 double markingOffsetXInput,
49 double markingOffsetYInput) {
50 super(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput);46 super(positionXInput, positionYInput, idInput, nameOffsetXInput, nameOffsetYInput);
51 markingOffsetX = new Double(markingOffsetXInput);
52 markingOffsetY = new Double(markingOffsetYInput);
53 componentWidth = DIAMETER;47 componentWidth = DIAMETER;
54 componentHeight = DIAMETER;48 componentHeight = DIAMETER;
55 setCentre((int) positionX, (int) positionY);49 setCentre((int) positionX, (int) positionY);
@@ -92,24 +86,6 @@
92 }86 }
9387
94 /**88 /**
95 * Get X-axis offset for initial marking
96 *
97 * @return Double value for X-axis offset of initial marking
98 */
99 public Double getMarkingOffsetXObject() {
100 return markingOffsetX;
101 }
102
103 /**
104 * Get Y-axis offset for initial marking
105 *
106 * @return Double value for X-axis offset of initial marking
107 */
108 public Double getMarkingOffsetYObject() {
109 return markingOffsetY;
110 }
111
112 /**
113 * Returns the diameter of this Place at the current zoom89 * Returns the diameter of this Place at the current zoom
114 */90 */
115 private int getDiameter() {91 private int getDiameter() {
11692
=== modified file 'src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java'
--- src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java 2018-10-18 15:08:44 +0000
+++ src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java 2019-03-13 07:18:09 +0000
@@ -66,12 +66,10 @@
6666
67 public TimedPlaceComponent(double positionXInput, double positionYInput,67 public TimedPlaceComponent(double positionXInput, double positionYInput,
68 String idInput, Double nameOffsetXInput,68 String idInput, Double nameOffsetXInput,
69 Double nameOffsetYInput,69 Double nameOffsetYInput) {
70 double markingOffsetXInput, double markingOffsetYInput) {
7170
72 super(positionXInput, positionYInput, idInput,71 super(positionXInput, positionYInput, idInput,
73 nameOffsetXInput, nameOffsetYInput,72 nameOffsetXInput, nameOffsetYInput);
74 markingOffsetXInput, markingOffsetYInput);
75 listener = timedPlaceListener();73 listener = timedPlaceListener();
76 attributesVisible = true;74 attributesVisible = true;
77 ageOfTokensWindow = new Window(new Frame());75 ageOfTokensWindow = new Window(new Frame());
@@ -432,7 +430,7 @@
432 }430 }
433431
434 public TimedPlaceComponent copy(TimedArcPetriNet tapn) {432 public TimedPlaceComponent copy(TimedArcPetriNet tapn) {
435 TimedPlaceComponent placeComponent = new TimedPlaceComponent(getPositionXObject(), getPositionYObject(), id, nameOffsetX, nameOffsetY, markingOffsetX, markingOffsetY);433 TimedPlaceComponent placeComponent = new TimedPlaceComponent(getPositionXObject(), getPositionYObject(), id, nameOffsetX, nameOffsetY);
436 placeComponent.setUnderlyingPlace(tapn.getPlaceByName(place.name()));434 placeComponent.setUnderlyingPlace(tapn.getPlaceByName(place.name()));
437435
438 return placeComponent;436 return placeComponent;

Subscribers

People subscribed via source and target branches