Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change of range in product - fix 2037066 #115

Merged
merged 12 commits into from
Nov 11, 2023
12 changes: 8 additions & 4 deletions src/main/java/dk/aau/cs/model/CPN/ColorType.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ public Integer size() {
return colors.iterator();
}

public Vector<Color> getColors(){
public Vector<Color> getColors() {
return colors;
}

public String getSemanticValue() {
srba marked this conversation as resolved.
Show resolved Hide resolved
srba marked this conversation as resolved.
Show resolved Hide resolved
return getColors().toString();
}

@Override
public boolean equals(Object o) {
if (!(o instanceof ColorType) || o instanceof ProductType)
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading