From 4393850a70e1cd58c8af2ffdfc96d1888491af12 Mon Sep 17 00:00:00 2001 From: mtygesen6 Date: Wed, 25 Oct 2023 18:22:36 +0200 Subject: [PATCH] Compare by ColorTypes equals() function instead of comparing memory address --- src/main/java/dk/aau/cs/model/CPN/ColorMultiset.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dk/aau/cs/model/CPN/ColorMultiset.java b/src/main/java/dk/aau/cs/model/CPN/ColorMultiset.java index c5150e4fe..09d34201f 100644 --- a/src/main/java/dk/aau/cs/model/CPN/ColorMultiset.java +++ b/src/main/java/dk/aau/cs/model/CPN/ColorMultiset.java @@ -57,7 +57,7 @@ public Integer get(Object o) { @Override public Integer put(Color color, Integer integer) { - if (color.getColorType() != colorType) { + if (!(color.getColorType().equals(colorType))) { throw new IllegalArgumentException(String.format("Type mismatch: Attempted to put %s in multiset of type %s", color.getName(), colorType.getName())); } //If at most 0, clean key from set