From a3119ca22d78b2a3ec66ec6fcab7c41f3ebaf704 Mon Sep 17 00:00:00 2001 From: mtygesen Date: Sun, 5 Nov 2023 16:10:04 +0100 Subject: [PATCH 01/12] Added error popup if a color type with similar integer range already exists. --- .../aau/cs/model/tapn/TimedArcPetriNetNetwork.java | 10 ++++++++++ .../gui/petrinet/editor/ColorTypeDialogPanel.java | 9 +++++++++ .../undo/Colored/UpdateColorTypeCommand.java | 13 +++++++++---- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java b/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java index 98164e535..01d2016c3 100644 --- a/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java +++ b/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java @@ -684,6 +684,16 @@ public Integer getVariableIndex(String name) { return null; } + public boolean doesSimilarRangeExist(ColorType newColorType) { + for (ColorType ct : colorTypes) { + if (ct.getColors().toString().equals(newColorType.getColors().toString())) { + return true; + } + } + + return false; + } + public boolean isNameUsedForColorType(String name) { for (ColorType element : colorTypes) { if (element.getName().equals(name)) { diff --git a/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java b/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java index e82fc8b32..f2f534321 100644 --- a/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java +++ b/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java @@ -945,6 +945,7 @@ private void onOK() { "Error", JOptionPane.ERROR_MESSAGE); return; } + try { if (rangeOfIntegersPanelEnabled && (Integer.parseInt(lowerBoundTextField.getText()) > Integer.parseInt(upperBoundTextField.getText()))) { JOptionPane.showMessageDialog( @@ -1078,6 +1079,14 @@ private void onOK() { newColorType.addColor(String.valueOf(i)); } + if (network.doesSimilarRangeExist(newColorType)) { + JOptionPane.showMessageDialog( + TAPAALGUI.getApp(), + "Color type with similar range already exists!", + "Error", JOptionPane.ERROR_MESSAGE); + return; + } + if (oldColorType != null) { if (oldColorType.equals(newColorType)) { exit(); diff --git a/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java b/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java index 24da8a077..ea41e5379 100644 --- a/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java +++ b/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java @@ -40,12 +40,14 @@ public void undo() { } } for (TimedInputArc arc : tapn.inputArcs()) { - if (arc.getArcExpression() != null && arc.source().getColorType() == oldColorType) + if (arc.getArcExpression() != null) { arc.setExpression(arc.getArcExpression().getExprWithNewColorType(oldColorType)); + } } for (TimedOutputArc arc : tapn.outputArcs()) { - if (arc.getExpression() != null && arc.destination().getColorType() == oldColorType) + if (arc.getExpression() != null) { arc.setExpression(arc.getExpression().getExprWithNewColorType(oldColorType)); + } } } @@ -75,12 +77,14 @@ public void redo() { } } for (TimedInputArc arc : tapn.inputArcs()) { - if (arc.getArcExpression() != null && arc.source().getColorType() == newColorType) + if (arc.getArcExpression() != null) { arc.setExpression(arc.getArcExpression().getExprWithNewColorType(newColorType)); + } } for (TimedOutputArc arc : tapn.outputArcs()) { - if (arc.getExpression() != null && arc.destination().getColorType() == newColorType) + if (arc.getExpression() != null) { arc.setExpression(arc.getExpression().getExprWithNewColorType(newColorType)); + } } } @@ -88,6 +92,7 @@ public void redo() { for (Variable var : network.variables()) { if (var.getColorType().equals(oldColorType)) { + System.out.println(); var.setColorType(newColorType); } } From edebd97e4c1302a2fd0c59a317ef80071832a259 Mon Sep 17 00:00:00 2001 From: mtygesen Date: Mon, 6 Nov 2023 18:07:44 +0100 Subject: [PATCH 02/12] update color type of transition guard --- .../dk/aau/cs/model/CPN/Expressions/GuardExpression.java | 2 ++ .../java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java | 4 ++-- .../gui/petrinet/undo/Colored/UpdateColorTypeCommand.java | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/dk/aau/cs/model/CPN/Expressions/GuardExpression.java b/src/main/java/dk/aau/cs/model/CPN/Expressions/GuardExpression.java index 5cccc9111..69b6dce14 100644 --- a/src/main/java/dk/aau/cs/model/CPN/Expressions/GuardExpression.java +++ b/src/main/java/dk/aau/cs/model/CPN/Expressions/GuardExpression.java @@ -15,6 +15,8 @@ public abstract class GuardExpression extends Expression { public ColorType getColorType() { return colorType; } + public void setColorType(ColorType colorType) { this.colorType = colorType; } + @Override public abstract GuardExpression replace(Expression object1, Expression object2, boolean replaceAllInstances); diff --git a/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java b/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java index 01d2016c3..79f2768d7 100644 --- a/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java +++ b/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java @@ -685,8 +685,8 @@ public Integer getVariableIndex(String name) { } public boolean doesSimilarRangeExist(ColorType newColorType) { - for (ColorType ct : colorTypes) { - if (ct.getColors().toString().equals(newColorType.getColors().toString())) { + for (ColorType ct : colorTypes) {; + if (ct.getColors().toString().equals(newColorType.getColors().toString()) && !ct.equals(newColorType)) { return true; } } diff --git a/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java b/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java index ea41e5379..1772fc2a1 100644 --- a/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java +++ b/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java @@ -86,6 +86,11 @@ public void redo() { arc.setExpression(arc.getExpression().getExprWithNewColorType(newColorType)); } } + for (TimedTransition transition : tapn.transitions()) { + if (transition.getGuard() != null) { + transition.getGuard().setColorType(newColorType); + } + } } eval(newColorType); From 1a45965748a9bac392a17065fb7a624634107380 Mon Sep 17 00:00:00 2001 From: mtygesen Date: Mon, 6 Nov 2023 18:12:30 +0100 Subject: [PATCH 03/12] removed empty statement --- src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java b/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java index 79f2768d7..1f9055e74 100644 --- a/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java +++ b/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java @@ -685,7 +685,7 @@ public Integer getVariableIndex(String name) { } public boolean doesSimilarRangeExist(ColorType newColorType) { - for (ColorType ct : colorTypes) {; + for (ColorType ct : colorTypes) { if (ct.getColors().toString().equals(newColorType.getColors().toString()) && !ct.equals(newColorType)) { return true; } From fd3cca3911968d387bc1914c9ea025fb6855df84 Mon Sep 17 00:00:00 2001 From: mtygesen Date: Mon, 6 Nov 2023 18:14:21 +0100 Subject: [PATCH 04/12] same for undo --- .../gui/petrinet/undo/Colored/UpdateColorTypeCommand.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java b/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java index 1772fc2a1..dcc43fec2 100644 --- a/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java +++ b/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java @@ -49,6 +49,11 @@ public void undo() { arc.setExpression(arc.getExpression().getExprWithNewColorType(oldColorType)); } } + for (TimedTransition transition : tapn.transitions()) { + if (transition.getGuard() != null) { + transition.getGuard().setColorType(newColorType); + } + } } eval(oldColorType); From de76c1d6a34f4f50693ab278100466545cee462b Mon Sep 17 00:00:00 2001 From: mtygesen Date: Mon, 6 Nov 2023 18:14:38 +0100 Subject: [PATCH 05/12] change variable for undo --- .../gui/petrinet/undo/Colored/UpdateColorTypeCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java b/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java index dcc43fec2..ba0d3e520 100644 --- a/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java +++ b/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java @@ -51,7 +51,7 @@ public void undo() { } for (TimedTransition transition : tapn.transitions()) { if (transition.getGuard() != null) { - transition.getGuard().setColorType(newColorType); + transition.getGuard().setColorType(oldColorType); } } } From d5dddde087eb85bf2c53db4f26d3caf4b9137167 Mon Sep 17 00:00:00 2001 From: mtygesen Date: Tue, 7 Nov 2023 00:10:16 +0100 Subject: [PATCH 06/12] Changed the name of the function to check if two integer ranges are identical --- .../java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java | 4 ++-- .../net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java | 2 +- .../gui/petrinet/undo/Colored/UpdateColorTypeCommand.java | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java b/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java index 1f9055e74..bd3f9dc72 100644 --- a/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java +++ b/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java @@ -683,8 +683,8 @@ public Integer getVariableIndex(String name) { } return null; } - - public boolean doesSimilarRangeExist(ColorType newColorType) { + + public boolean isIndeticalToExisting(ColorType newColorType) { for (ColorType ct : colorTypes) { if (ct.getColors().toString().equals(newColorType.getColors().toString()) && !ct.equals(newColorType)) { return true; diff --git a/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java b/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java index f2f534321..538e7ff8a 100644 --- a/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java +++ b/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java @@ -1079,7 +1079,7 @@ private void onOK() { newColorType.addColor(String.valueOf(i)); } - if (network.doesSimilarRangeExist(newColorType)) { + if (network.isIndeticalToExisting(newColorType)) { JOptionPane.showMessageDialog( TAPAALGUI.getApp(), "Color type with similar range already exists!", diff --git a/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java b/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java index ba0d3e520..8f9e2c32d 100644 --- a/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java +++ b/src/main/java/net/tapaal/gui/petrinet/undo/Colored/UpdateColorTypeCommand.java @@ -102,7 +102,6 @@ public void redo() { for (Variable var : network.variables()) { if (var.getColorType().equals(oldColorType)) { - System.out.println(); var.setColorType(newColorType); } } From e09680f180069ff76e0eedf7c3a561e363c23a7f Mon Sep 17 00:00:00 2001 From: mtygesen Date: Tue, 7 Nov 2023 17:57:20 +0100 Subject: [PATCH 07/12] Added function to get the semantic value of a color type --- src/main/java/dk/aau/cs/model/CPN/ColorType.java | 12 ++++++++---- .../aau/cs/model/tapn/TimedArcPetriNetNetwork.java | 2 +- .../gui/petrinet/editor/ColorTypeDialogPanel.java | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/dk/aau/cs/model/CPN/ColorType.java b/src/main/java/dk/aau/cs/model/CPN/ColorType.java index 47fcea3bf..5866c1a09 100644 --- a/src/main/java/dk/aau/cs/model/CPN/ColorType.java +++ b/src/main/java/dk/aau/cs/model/CPN/ColorType.java @@ -40,10 +40,14 @@ public Integer size() { return colors.iterator(); } - public Vector getColors(){ + public Vector getColors() { return colors; } + public String getSemanticValue() { + return getColors().toString(); + } + @Override public boolean equals(Object o) { if (!(o instanceof ColorType) || o instanceof ProductType) @@ -52,11 +56,11 @@ public boolean equals(Object o) { if (!object.name.equals(this.name)) return false; - - if(!object.size().equals(size())){ + + if (!object.size().equals(size())){ return false; } - for(int i = 0; i < colors.size(); i++){ + for (int i = 0; i < colors.size(); i++){ if(!colors.get(i).equals(object.colors.get(i))){ return false; } diff --git a/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java b/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java index bd3f9dc72..6f28da5c3 100644 --- a/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java +++ b/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java @@ -686,7 +686,7 @@ public Integer getVariableIndex(String name) { public boolean isIndeticalToExisting(ColorType newColorType) { for (ColorType ct : colorTypes) { - if (ct.getColors().toString().equals(newColorType.getColors().toString()) && !ct.equals(newColorType)) { + if (ct.getSemanticValue().equals(newColorType.getSemanticValue()) && !ct.equals(newColorType)) { return true; } } diff --git a/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java b/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java index 538e7ff8a..f66059e92 100644 --- a/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java +++ b/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java @@ -1082,7 +1082,7 @@ private void onOK() { if (network.isIndeticalToExisting(newColorType)) { JOptionPane.showMessageDialog( TAPAALGUI.getApp(), - "Color type with similar range already exists!", + "Color type with identical range already exists!", "Error", JOptionPane.ERROR_MESSAGE); return; } From f6fc691f4f9825c6acaa40a3da2b817f0c50bb02 Mon Sep 17 00:00:00 2001 From: mtygesen Date: Wed, 8 Nov 2023 13:07:26 +0100 Subject: [PATCH 08/12] added isIdentical method to check if two integer ranges are the same --- src/main/java/dk/aau/cs/model/CPN/ColorType.java | 16 ++++++++++++++++ .../cs/model/tapn/TimedArcPetriNetNetwork.java | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/dk/aau/cs/model/CPN/ColorType.java b/src/main/java/dk/aau/cs/model/CPN/ColorType.java index 5866c1a09..0172991ea 100644 --- a/src/main/java/dk/aau/cs/model/CPN/ColorType.java +++ b/src/main/java/dk/aau/cs/model/CPN/ColorType.java @@ -48,6 +48,10 @@ public String getSemanticValue() { return getColors().toString(); } + public boolean isIdentical(ColorType newColorType) { + return getFirstColorName().equals(newColorType.getFirstColorName()) && getLastColorName().equals(newColorType.getLastColorName()); + } + @Override public boolean equals(Object o) { if (!(o instanceof ColorType) || o instanceof ProductType) @@ -93,6 +97,18 @@ public Color getFirstColor() { return colors.firstElement(); } + public Color getLastColor() { + return colors.lastElement(); + } + + private String getFirstColorName() { + return getFirstColor().getColorName(); + } + + private String getLastColorName() { + return getLastColor().getColorName(); + } + public boolean isProductColorType(){ return getFirstColor().getTuple() != null && !getFirstColor().getTuple().isEmpty(); } diff --git a/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java b/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java index 6f28da5c3..682a7e0a6 100644 --- a/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java +++ b/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java @@ -686,7 +686,7 @@ public Integer getVariableIndex(String name) { public boolean isIndeticalToExisting(ColorType newColorType) { for (ColorType ct : colorTypes) { - if (ct.getSemanticValue().equals(newColorType.getSemanticValue()) && !ct.equals(newColorType)) { + if (ct.isIdentical(newColorType) && !ct.equals(newColorType)) { return true; } } From d7986fbfe757a9c8c21b31ef64d052d3112dac81 Mon Sep 17 00:00:00 2001 From: mtygesen Date: Wed, 8 Nov 2023 19:01:58 +0100 Subject: [PATCH 09/12] Moved check if the two color types are the same into isIdentical --- src/main/java/dk/aau/cs/model/CPN/ColorType.java | 2 +- src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dk/aau/cs/model/CPN/ColorType.java b/src/main/java/dk/aau/cs/model/CPN/ColorType.java index 0172991ea..f2519fa27 100644 --- a/src/main/java/dk/aau/cs/model/CPN/ColorType.java +++ b/src/main/java/dk/aau/cs/model/CPN/ColorType.java @@ -49,7 +49,7 @@ public String getSemanticValue() { } public boolean isIdentical(ColorType newColorType) { - return getFirstColorName().equals(newColorType.getFirstColorName()) && getLastColorName().equals(newColorType.getLastColorName()); + return getFirstColorName().equals(newColorType.getFirstColorName()) && getLastColorName().equals(newColorType.getLastColorName()) && !equals(newColorType); } @Override diff --git a/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java b/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java index 682a7e0a6..d6d9a4e22 100644 --- a/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java +++ b/src/main/java/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java @@ -686,7 +686,7 @@ public Integer getVariableIndex(String name) { public boolean isIndeticalToExisting(ColorType newColorType) { for (ColorType ct : colorTypes) { - if (ct.isIdentical(newColorType) && !ct.equals(newColorType)) { + if (ct.isIdentical(newColorType)) { return true; } } From 31846ef80f478ed1eb38c5d5e7ca3d1e97e6caf6 Mon Sep 17 00:00:00 2001 From: icecoldgold773 Date: Fri, 10 Nov 2023 15:32:03 +0100 Subject: [PATCH 10/12] removed getSemantics, getFirstColorName, and getLastColorName --- .../java/dk/aau/cs/model/CPN/ColorType.java | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/main/java/dk/aau/cs/model/CPN/ColorType.java b/src/main/java/dk/aau/cs/model/CPN/ColorType.java index f2519fa27..bf3667e2a 100644 --- a/src/main/java/dk/aau/cs/model/CPN/ColorType.java +++ b/src/main/java/dk/aau/cs/model/CPN/ColorType.java @@ -44,12 +44,11 @@ public Vector getColors() { return colors; } - public String getSemanticValue() { - return getColors().toString(); - } - public boolean isIdentical(ColorType newColorType) { - return getFirstColorName().equals(newColorType.getFirstColorName()) && getLastColorName().equals(newColorType.getLastColorName()) && !equals(newColorType); + boolean firstColorIdentical = getFirstColor().getColorName().equals(newColorType.getFirstColor().getColorName()); + boolean lastColorIdentical = getLastColor().getColorName().equals(newColorType.getLastColor().getColorName()); + + return firstColorIdentical && lastColorIdentical && !equals(newColorType); } @Override @@ -101,14 +100,6 @@ public Color getLastColor() { return colors.lastElement(); } - private String getFirstColorName() { - return getFirstColor().getColorName(); - } - - private String getLastColorName() { - return getLastColor().getColorName(); - } - public boolean isProductColorType(){ return getFirstColor().getTuple() != null && !getFirstColor().getTuple().isEmpty(); } From 9532fa39f41c1e33ef69aaaae75b24ce1eb22a55 Mon Sep 17 00:00:00 2001 From: icecoldgold773 Date: Fri, 10 Nov 2023 23:19:16 +0100 Subject: [PATCH 11/12] Fixed exception --- src/main/java/dk/aau/cs/model/CPN/ColorType.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/dk/aau/cs/model/CPN/ColorType.java b/src/main/java/dk/aau/cs/model/CPN/ColorType.java index bf3667e2a..b1835d104 100644 --- a/src/main/java/dk/aau/cs/model/CPN/ColorType.java +++ b/src/main/java/dk/aau/cs/model/CPN/ColorType.java @@ -44,10 +44,11 @@ public Vector getColors() { return colors; } + public boolean isIdentical(ColorType newColorType) { - boolean firstColorIdentical = getFirstColor().getColorName().equals(newColorType.getFirstColor().getColorName()); - boolean lastColorIdentical = getLastColor().getColorName().equals(newColorType.getLastColor().getColorName()); - + boolean firstColorIdentical = getFirstColor().getColorName().equals(newColorType.getFirstColor().getColorName()); + boolean lastColorIdentical = getColors().lastElement().getColorName().equals(newColorType.getColors().lastElement().getColorName()); + return firstColorIdentical && lastColorIdentical && !equals(newColorType); } @@ -96,10 +97,6 @@ public Color getFirstColor() { return colors.firstElement(); } - public Color getLastColor() { - return colors.lastElement(); - } - public boolean isProductColorType(){ return getFirstColor().getTuple() != null && !getFirstColor().getTuple().isEmpty(); } From 3c5da4b3ed04afcbf95c61c87ff1a05fc84aec0e Mon Sep 17 00:00:00 2001 From: Mikkel Tygesen <83021047+mtygesen@users.noreply.github.com> Date: Fri, 10 Nov 2023 23:29:33 +0100 Subject: [PATCH 12/12] Removed whitespace --- src/main/java/dk/aau/cs/model/CPN/ColorType.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/dk/aau/cs/model/CPN/ColorType.java b/src/main/java/dk/aau/cs/model/CPN/ColorType.java index b1835d104..a10ebc306 100644 --- a/src/main/java/dk/aau/cs/model/CPN/ColorType.java +++ b/src/main/java/dk/aau/cs/model/CPN/ColorType.java @@ -44,7 +44,6 @@ public Vector getColors() { return colors; } - public boolean isIdentical(ColorType newColorType) { boolean firstColorIdentical = getFirstColor().getColorName().equals(newColorType.getFirstColor().getColorName()); boolean lastColorIdentical = getColors().lastElement().getColorName().equals(newColorType.getColors().lastElement().getColorName()); @@ -147,4 +146,4 @@ public boolean isIntegerRange(){ } return true; } -} \ No newline at end of file +}