Merge lp:~tapaal-contributor/tapaal/cpn-caseSensitivity into lp:~tapaal-contributor/tapaal/cpn-gui-dev

Proposed by Kenneth Yrke Jørgensen
Status: Merged
Approved by: Jiri Srba
Approved revision: 1614
Merged at revision: 1615
Proposed branch: lp:~tapaal-contributor/tapaal/cpn-caseSensitivity
Merge into: lp:~tapaal-contributor/tapaal/cpn-gui-dev
Diff against target: 338 lines (+34/-33)
12 files modified
src/dk/aau/cs/io/LoadTACPN.java (+1/-0)
src/dk/aau/cs/model/tapn/ConstantStore.java (+4/-4)
src/dk/aau/cs/model/tapn/TimedArcPetriNet.java (+4/-4)
src/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java (+13/-13)
src/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java (+4/-4)
src/net/tapaal/gui/petrinet/editor/ConstantsDialogPanel.java (+1/-1)
src/net/tapaal/gui/petrinet/editor/SharedPlaceNamePanel.java (+1/-1)
src/net/tapaal/gui/petrinet/editor/SharedTransitionNamePanel.java (+1/-1)
src/net/tapaal/gui/petrinet/editor/TemplateExplorer.java (+1/-1)
src/net/tapaal/gui/petrinet/editor/VariablesDialogPanel.java (+2/-2)
src/pipe/gui/petrinet/editor/PlaceEditorPanel.java (+1/-1)
src/pipe/gui/petrinet/editor/TAPNTransitionEditor.java (+1/-1)
To merge this branch: bzr merge lp:~tapaal-contributor/tapaal/cpn-caseSensitivity
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Review via email: mp+415949@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) :
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/LoadTACPN.java'
--- src/dk/aau/cs/io/LoadTACPN.java 2022-01-09 18:33:52 +0000
+++ src/dk/aau/cs/io/LoadTACPN.java 2022-02-23 08:27:59 +0000
@@ -322,6 +322,7 @@
322 }322 }
323 }323 }
324324
325 /// This will select the wrong color if the is overlap in naming, eg for IntegerRangeExpr (1,2,3,4) & (1,2)
325 private dk.aau.cs.model.CPN.Color getColor(String colorname) throws FormatException {326 private dk.aau.cs.model.CPN.Color getColor(String colorname) throws FormatException {
326 for (ColorType ct : colortypes.values()) {327 for (ColorType ct : colortypes.values()) {
327 for (dk.aau.cs.model.CPN.Color c : ct) {328 for (dk.aau.cs.model.CPN.Color c : ct) {
328329
=== modified file 'src/dk/aau/cs/model/tapn/ConstantStore.java'
--- src/dk/aau/cs/model/tapn/ConstantStore.java 2022-01-09 18:09:13 +0000
+++ src/dk/aau/cs/model/tapn/ConstantStore.java 2022-02-23 08:27:59 +0000
@@ -74,7 +74,7 @@
7474
75 public boolean containsConstantByName(String name) {75 public boolean containsConstantByName(String name) {
76 for(Constant c : constants) {76 for(Constant c : constants) {
77 if(c.name().equalsIgnoreCase(name))77 if(c.name().equals(name))
78 return true;78 return true;
79 }79 }
80 return false;80 return false;
@@ -82,7 +82,7 @@
8282
83 public Constant getConstantByName(String name) {83 public Constant getConstantByName(String name) {
84 for(Constant c : constants) {84 for(Constant c : constants) {
85 if(c.name().equalsIgnoreCase(name))85 if(c.name().equals(name))
86 return c;86 return c;
87 }87 }
88 return null;88 return null;
@@ -218,11 +218,11 @@
218 }218 }
219219
220 private boolean isNameInf(String name) {220 private boolean isNameInf(String name) {
221 return name.equalsIgnoreCase("inf");221 return name.equals("inf");
222 }222 }
223223
224 public Command updateConstant(String oldName, Constant updatedConstant, TimedArcPetriNetNetwork model) {224 public Command updateConstant(String oldName, Constant updatedConstant, TimedArcPetriNetNetwork model) {
225 if (oldName.equalsIgnoreCase(updatedConstant.name()) || !containsConstantByName(updatedConstant.name())) {225 if (oldName.equals(updatedConstant.name()) || !containsConstantByName(updatedConstant.name())) {
226 if (containsConstantByName(oldName)) {226 if (containsConstantByName(oldName)) {
227 Constant old = getConstantByName(oldName);227 Constant old = getConstantByName(oldName);
228 updatedConstant.setLowerBound(old.lowerBound());228 updatedConstant.setLowerBound(old.lowerBound());
229229
=== modified file 'src/dk/aau/cs/model/tapn/TimedArcPetriNet.java'
--- src/dk/aau/cs/model/tapn/TimedArcPetriNet.java 2022-02-10 07:46:25 +0000
+++ src/dk/aau/cs/model/tapn/TimedArcPetriNet.java 2022-02-23 08:27:59 +0000
@@ -259,12 +259,12 @@
259 if(parentNetwork != null && parentNetwork.isNameUsedForShared(name)) return true;259 if(parentNetwork != null && parentNetwork.isNameUsedForShared(name)) return true;
260260
261 for (TimedPlace place : places){261 for (TimedPlace place : places){
262 if (place.name().equalsIgnoreCase(name)){262 if (place.name().equals(name)){
263 return true;263 return true;
264 }264 }
265 }265 }
266 for (TimedTransition transition : transitions){266 for (TimedTransition transition : transitions){
267 if (transition.name().equalsIgnoreCase(name)){267 if (transition.name().equals(name)){
268 return true;268 return true;
269 }269 }
270 }270 }
@@ -287,7 +287,7 @@
287287
288 public TimedPlace getPlaceByName(String placeName) {288 public TimedPlace getPlaceByName(String placeName) {
289 for (TimedPlace p : places) {289 for (TimedPlace p : places) {
290 if (p.name().equalsIgnoreCase(placeName)) {290 if (p.name().equals(placeName)) {
291 return p;291 return p;
292 }292 }
293 }293 }
@@ -296,7 +296,7 @@
296296
297 public TimedTransition getTransitionByName(String transitionName) {297 public TimedTransition getTransitionByName(String transitionName) {
298 for (TimedTransition t : transitions) {298 for (TimedTransition t : transitions) {
299 if (t.name().equalsIgnoreCase(transitionName)) {299 if (t.name().equals(transitionName)) {
300 return t;300 return t;
301 }301 }
302 }302 }
303303
=== modified file 'src/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java'
--- src/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java 2022-01-09 19:10:28 +0000
+++ src/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java 2022-02-23 08:27:59 +0000
@@ -95,13 +95,13 @@
9595
96 public boolean isNameUsedForShared(String name){96 public boolean isNameUsedForShared(String name){
97 for(SharedTransition transition : sharedTransitions){97 for(SharedTransition transition : sharedTransitions){
98 if(transition.name().equalsIgnoreCase(name)) {98 if(transition.name().equals(name)) {
99 return true;99 return true;
100 }100 }
101 }101 }
102 102
103 for(SharedPlace place : sharedPlaces){103 for(SharedPlace place : sharedPlaces){
104 if(place.name().equalsIgnoreCase(name)) {104 if(place.name().equals(name)) {
105 return true;105 return true;
106 }106 }
107 }107 }
@@ -119,7 +119,7 @@
119 public boolean isNameUsedForPlacesOnly(String name) {119 public boolean isNameUsedForPlacesOnly(String name) {
120 for(TimedArcPetriNet net : tapns){120 for(TimedArcPetriNet net : tapns){
121 for(TimedTransition transition : net.transitions()) {121 for(TimedTransition transition : net.transitions()) {
122 if(name.equalsIgnoreCase(transition.name()))122 if(name.equals(transition.name()))
123 return false;123 return false;
124 }124 }
125 }125 }
@@ -128,7 +128,7 @@
128 public boolean isNameUsedForTransitionsOnly(String name) {128 public boolean isNameUsedForTransitionsOnly(String name) {
129 for(TimedArcPetriNet net : tapns){129 for(TimedArcPetriNet net : tapns){
130 for(TimedPlace place : net.places()) {130 for(TimedPlace place : net.places()) {
131 if(name.equalsIgnoreCase(place.name()))131 if(name.equals(place.name()))
132 return false;132 return false;
133 }133 }
134 }134 }
@@ -366,14 +366,14 @@
366366
367 public SharedTransition getSharedTransitionByName(String name) {367 public SharedTransition getSharedTransitionByName(String name) {
368 for(SharedTransition t : sharedTransitions){368 for(SharedTransition t : sharedTransitions){
369 if(t.name().equalsIgnoreCase(name)) return t;369 if(t.name().equals(name)) return t;
370 }370 }
371 return null;371 return null;
372 }372 }
373373
374 public TimedPlace getSharedPlaceByName(String name) {374 public TimedPlace getSharedPlaceByName(String name) {
375 for(SharedPlace place : sharedPlaces){375 for(SharedPlace place : sharedPlaces){
376 if(place.name().equalsIgnoreCase(name)) return place;376 if(place.name().equals(name)) return place;
377 }377 }
378 return null;378 return null;
379 }379 }
@@ -660,7 +660,7 @@
660660
661 public Integer getColorTypeIndex(String name) {661 public Integer getColorTypeIndex(String name) {
662 for (int i = 0; i < colorTypes.size(); i++) {662 for (int i = 0; i < colorTypes.size(); i++) {
663 if (colorTypes.get(i).getName().equalsIgnoreCase(name)) {663 if (colorTypes.get(i).getName().equals(name)) {
664 return i;664 return i;
665 }665 }
666 }666 }
@@ -668,7 +668,7 @@
668 }668 }
669 public ColorType getColorTypeByName(String name) {669 public ColorType getColorTypeByName(String name) {
670 for (ColorType element : colorTypes) {670 for (ColorType element : colorTypes) {
671 if (element.getName().equalsIgnoreCase(name)) {671 if (element.getName().equals(name)) {
672 return element;672 return element;
673 }673 }
674 }674 }
@@ -677,7 +677,7 @@
677677
678 public Integer getVariableIndex(String name) {678 public Integer getVariableIndex(String name) {
679 for (int i = 0; i < variables.size(); i++) {679 for (int i = 0; i < variables.size(); i++) {
680 if (variables.get(i).getName().equalsIgnoreCase(name)) {680 if (variables.get(i).getName().equals(name)) {
681 return i;681 return i;
682 }682 }
683 }683 }
@@ -686,7 +686,7 @@
686686
687 public boolean isNameUsedForColorType(String name) {687 public boolean isNameUsedForColorType(String name) {
688 for (ColorType element : colorTypes) {688 for (ColorType element : colorTypes) {
689 if (element.getName().equalsIgnoreCase(name)) {689 if (element.getName().equals(name)) {
690 return true;690 return true;
691 }691 }
692 }692 }
@@ -694,7 +694,7 @@
694 }694 }
695 public boolean isNameUsedForVariable(String name) {695 public boolean isNameUsedForVariable(String name) {
696 for (Variable element : variables) {696 for (Variable element : variables) {
697 if (element.getName().equalsIgnoreCase(name)) {697 if (element.getName().equals(name)) {
698 return true;698 return true;
699 }699 }
700 }700 }
@@ -704,7 +704,7 @@
704 for (ColorType e : colorTypes) {704 for (ColorType e : colorTypes) {
705 if (e != ignored && !e.isIntegerRange() && !e.isProductColorType()){705 if (e != ignored && !e.isIntegerRange() && !e.isProductColorType()){
706 for (Color c : e.getColors()) {706 for (Color c : e.getColors()) {
707 if (c.getName().equalsIgnoreCase(name)) {707 if (c.getName().equals(name)) {
708 return true;708 return true;
709 }709 }
710 }710 }
@@ -718,7 +718,7 @@
718718
719 public Variable getVariableByName(String name){719 public Variable getVariableByName(String name){
720 for (Variable variable : variables) {720 for (Variable variable : variables) {
721 if (variable.getName().equalsIgnoreCase(name)) {721 if (variable.getName().equals(name)) {
722 return variable;722 return variable;
723 }723 }
724 }724 }
725725
=== modified file 'src/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java'
--- src/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java 2022-01-09 19:10:28 +0000
+++ src/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java 2022-02-23 08:27:59 +0000
@@ -445,11 +445,11 @@
445 "The color cannot be named \"" + enumerationName + "\", as the name is reserved",445 "The color cannot be named \"" + enumerationName + "\", as the name is reserved",
446 "Error", JOptionPane.ERROR_MESSAGE);446 "Error", JOptionPane.ERROR_MESSAGE);
447 } else {447 } else {
448 boolean nameIsInUse = network.isNameUsedForVariable(enumerationName) || network.isNameUsedForColor(enumerationName, null) || network.isNameUsedForColorType(enumerationName) || network.isNameUsedForConstant(enumerationName) || nameTextField.getText().equalsIgnoreCase(enumerationName);448 boolean nameIsInUse = network.isNameUsedForVariable(enumerationName) || network.isNameUsedForColor(enumerationName, null) || network.isNameUsedForColorType(enumerationName) || network.isNameUsedForConstant(enumerationName) || nameTextField.getText().equals(enumerationName);
449 for (int i = 0; i < cyclicModel.getSize(); i++) {449 for (int i = 0; i < cyclicModel.getSize(); i++) {
450 String n = cyclicModel.getElementAt(i).toString();450 String n = cyclicModel.getElementAt(i).toString();
451451
452 if (n.equalsIgnoreCase(enumerationName)) {452 if (n.equals(enumerationName)) {
453 nameIsInUse = true;453 nameIsInUse = true;
454 break;454 break;
455 }455 }
@@ -896,7 +896,7 @@
896 "Error", JOptionPane.ERROR_MESSAGE);896 "Error", JOptionPane.ERROR_MESSAGE);
897 return;897 return;
898 }898 }
899 if (!oldName.equals("") && !oldName.equalsIgnoreCase(name) && network.isNameUsedForColorType(name)) {899 if (!oldName.equals("") && !oldName.equals(name) && network.isNameUsedForColorType(name)) {
900 JOptionPane.showMessageDialog(900 JOptionPane.showMessageDialog(
901 TAPAALGUI.getApp(),901 TAPAALGUI.getApp(),
902 "There is already another color type with the same name.\n\n"902 "There is already another color type with the same name.\n\n"
@@ -981,7 +981,7 @@
981 ArrayList<String> overlaps = new ArrayList<>();981 ArrayList<String> overlaps = new ArrayList<>();
982 for (int i = 0; i < enumList.getModel().getSize(); i++) {982 for (int i = 0; i < enumList.getModel().getSize(); i++) {
983 String e = enumList.getModel().getElementAt(i).toString();983 String e = enumList.getModel().getElementAt(i).toString();
984 if (network.isNameUsedForVariable(e) || network.isNameUsedForColor(e, oldColorType) || network.isNameUsedForColorType(e) || network.isNameUsedForConstant(e) || name.equalsIgnoreCase(e)) {984 if (network.isNameUsedForVariable(e) || network.isNameUsedForColor(e, oldColorType) || network.isNameUsedForColorType(e) || network.isNameUsedForConstant(e) || name.equals(e)) {
985 overlaps.add(e);985 overlaps.add(e);
986 }986 }
987 }987 }
988988
=== modified file 'src/net/tapaal/gui/petrinet/editor/ConstantsDialogPanel.java'
--- src/net/tapaal/gui/petrinet/editor/ConstantsDialogPanel.java 2022-01-09 16:01:49 +0000
+++ src/net/tapaal/gui/petrinet/editor/ConstantsDialogPanel.java 2022-02-23 08:27:59 +0000
@@ -212,7 +212,7 @@
212 } else { 212 } else {
213 int val = (Integer) valueSpinner.getValue();213 int val = (Integer) valueSpinner.getValue();
214 if (!oldName.equals("")) {214 if (!oldName.equals("")) {
215 if (!oldName.equalsIgnoreCase(newName)215 if (!oldName.equals(newName)
216 && model.isNameUsedForConstant(newName)) {216 && model.isNameUsedForConstant(newName)) {
217 JOptionPane217 JOptionPane
218 .showMessageDialog(218 .showMessageDialog(
219219
=== modified file 'src/net/tapaal/gui/petrinet/editor/SharedPlaceNamePanel.java'
--- src/net/tapaal/gui/petrinet/editor/SharedPlaceNamePanel.java 2022-01-09 16:46:17 +0000
+++ src/net/tapaal/gui/petrinet/editor/SharedPlaceNamePanel.java 2022-02-23 08:27:59 +0000
@@ -137,7 +137,7 @@
137 private boolean updateExistingPlace(String name) {137 private boolean updateExistingPlace(String name) {
138 String oldName = placeToEdit.name();138 String oldName = placeToEdit.name();
139 139
140 if(placeToEdit.network().isNameUsed(name) && !oldName.equalsIgnoreCase(name)) {140 if(placeToEdit.network().isNameUsed(name) && !oldName.equals(name)) {
141 JOptionPane.showMessageDialog(SharedPlaceNamePanel.this, "The specified name is already used by a place or transition in one of the components.", "Error", JOptionPane.ERROR_MESSAGE);141 JOptionPane.showMessageDialog(SharedPlaceNamePanel.this, "The specified name is already used by a place or transition in one of the components.", "Error", JOptionPane.ERROR_MESSAGE);
142 nameField.requestFocusInWindow();142 nameField.requestFocusInWindow();
143 return false;143 return false;
144144
=== modified file 'src/net/tapaal/gui/petrinet/editor/SharedTransitionNamePanel.java'
--- src/net/tapaal/gui/petrinet/editor/SharedTransitionNamePanel.java 2022-01-09 16:46:17 +0000
+++ src/net/tapaal/gui/petrinet/editor/SharedTransitionNamePanel.java 2022-02-23 08:27:59 +0000
@@ -140,7 +140,7 @@
140 140
141 String oldName = transitionToEdit.name();141 String oldName = transitionToEdit.name();
142 142
143 if(transitionToEdit.network().isNameUsed(name) && !oldName.equalsIgnoreCase(name)) {143 if(transitionToEdit.network().isNameUsed(name) && !oldName.equals(name)) {
144 JOptionPane.showMessageDialog(SharedTransitionNamePanel.this, "The specified name is already used by a place or transition in one of the components.", "Error", JOptionPane.ERROR_MESSAGE);144 JOptionPane.showMessageDialog(SharedTransitionNamePanel.this, "The specified name is already used by a place or transition in one of the components.", "Error", JOptionPane.ERROR_MESSAGE);
145 nameField.requestFocusInWindow();145 nameField.requestFocusInWindow();
146 return false;146 return false;
147147
=== modified file 'src/net/tapaal/gui/petrinet/editor/TemplateExplorer.java'
--- src/net/tapaal/gui/petrinet/editor/TemplateExplorer.java 2022-02-11 09:08:00 +0000
+++ src/net/tapaal/gui/petrinet/editor/TemplateExplorer.java 2022-02-23 08:27:59 +0000
@@ -442,7 +442,7 @@
442 showRenameTemplateDialog(newName);442 showRenameTemplateDialog(newName);
443 return;443 return;
444 }444 }
445 else if (parent.network().hasTAPNCalled(newName) && !template.model().name().equalsIgnoreCase(newName)) {445 else if (parent.network().hasTAPNCalled(newName) && !template.model().name().equals(newName)) {
446 JOptionPane.showMessageDialog(446 JOptionPane.showMessageDialog(
447 parent.drawingSurface(),447 parent.drawingSurface(),
448 "A component named \"" + newName + "\" already exists. Try another name.",448 "A component named \"" + newName + "\" already exists. Try another name.",
449449
=== modified file 'src/net/tapaal/gui/petrinet/editor/VariablesDialogPanel.java'
--- src/net/tapaal/gui/petrinet/editor/VariablesDialogPanel.java 2022-01-09 16:46:17 +0000
+++ src/net/tapaal/gui/petrinet/editor/VariablesDialogPanel.java 2022-02-23 08:27:59 +0000
@@ -258,7 +258,7 @@
258 return;258 return;
259 }259 }
260 //If we are editing a variable it is allowed to have the same name260 //If we are editing a variable it is allowed to have the same name
261 if ((variable == null || !variable.getName().equalsIgnoreCase(newName)) && network.isNameUsedForVariable(newName) ) {261 if ((variable == null || !variable.getName().equals(newName)) && network.isNameUsedForVariable(newName) ) {
262 JOptionPane262 JOptionPane
263 .showMessageDialog(263 .showMessageDialog(
264 TAPAALGUI.getApp(),264 TAPAALGUI.getApp(),
@@ -268,7 +268,7 @@
268 nameTextField.requestFocusInWindow();268 nameTextField.requestFocusInWindow();
269 return;269 return;
270 }270 }
271 if (!oldName.equals("") && !oldName.equalsIgnoreCase(newName) && network.isNameUsedForVariable(newName)) {271 if (!oldName.equals("") && !oldName.equals(newName) && network.isNameUsedForVariable(newName)) {
272 JOptionPane272 JOptionPane
273 .showMessageDialog(273 .showMessageDialog(
274 TAPAALGUI.getApp(),274 TAPAALGUI.getApp(),
275275
=== modified file 'src/pipe/gui/petrinet/editor/PlaceEditorPanel.java'
--- src/pipe/gui/petrinet/editor/PlaceEditorPanel.java 2022-01-09 19:10:28 +0000
+++ src/pipe/gui/petrinet/editor/PlaceEditorPanel.java 2022-02-23 08:27:59 +0000
@@ -623,7 +623,7 @@
623623
624 String newName = nameTextField.getText();624 String newName = nameTextField.getText();
625 String oldName = place.underlyingPlace().name();625 String oldName = place.underlyingPlace().name();
626 if(context.activeModel().isNameUsed(newName) && !oldName.equalsIgnoreCase(newName)){626 if(context.activeModel().isNameUsed(newName) && !oldName.equals(newName)){
627 context.undoManager().undo(); 627 context.undoManager().undo();
628 JOptionPane.showMessageDialog(this, "The specified name is already used by another place or transition.", "Error", JOptionPane.ERROR_MESSAGE);628 JOptionPane.showMessageDialog(this, "The specified name is already used by another place or transition.", "Error", JOptionPane.ERROR_MESSAGE);
629 return false;629 return false;
630630
=== modified file 'src/pipe/gui/petrinet/editor/TAPNTransitionEditor.java'
--- src/pipe/gui/petrinet/editor/TAPNTransitionEditor.java 2022-01-07 16:58:59 +0000
+++ src/pipe/gui/petrinet/editor/TAPNTransitionEditor.java 2022-02-23 08:27:59 +0000
@@ -402,7 +402,7 @@
402 return false;402 return false;
403 }403 }
404 }else{ 404 }else{
405 if(transition.underlyingTransition().model().isNameUsed(newName) && (wasShared || !transition.underlyingTransition().name().equalsIgnoreCase(newName))){405 if(transition.underlyingTransition().model().isNameUsed(newName) && (wasShared || !transition.underlyingTransition().name().equals(newName))){
406 context.undoManager().undo(); 406 context.undoManager().undo();
407 JOptionPane.showMessageDialog(this,407 JOptionPane.showMessageDialog(this,
408 "The specified name is already used by another place or transition.",408 "The specified name is already used by another place or transition.",

Subscribers

People subscribed via source and target branches

to all changes: