From e0034200fbdfd01f66b64c565f2812169c111247 Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Mon, 9 Mar 2020 23:52:03 +0100 Subject: [PATCH] Document unusual equals behaviour --- .../kit/informatik/modelrailwaysimulator/model/Switch.java | 2 +- .../kit/informatik/modelrailwaysimulator/model/Track.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/edu/kit/informatik/modelrailwaysimulator/model/Switch.java b/src/edu/kit/informatik/modelrailwaysimulator/model/Switch.java index 2a84432..14b8947 100644 --- a/src/edu/kit/informatik/modelrailwaysimulator/model/Switch.java +++ b/src/edu/kit/informatik/modelrailwaysimulator/model/Switch.java @@ -149,7 +149,7 @@ public final class Switch extends Rail { } /** - * Check whether two switches are equal, ignoring the current configuration. + * Check whether two switches are equal, ignoring the current configuration and their identifiers. * * @return whether this switch is equal to the other */ diff --git a/src/edu/kit/informatik/modelrailwaysimulator/model/Track.java b/src/edu/kit/informatik/modelrailwaysimulator/model/Track.java index 6be8ee5..e580734 100644 --- a/src/edu/kit/informatik/modelrailwaysimulator/model/Track.java +++ b/src/edu/kit/informatik/modelrailwaysimulator/model/Track.java @@ -150,6 +150,11 @@ public final class Track extends Rail { return String.format("t %d %s -> %s %d", getIdentifier(), start, end, getLength()); } + /** + * Check whether two tracks are equal, ignoring their identifiers. + * + * @return whether this track is equal to another + */ @Override public boolean equals(Object obj) { if (obj != null && getClass().equals(obj.getClass())) {