diff --git a/src/edu/kit/informatik/model/RollingStock.java b/src/edu/kit/informatik/model/RollingStock.java index 783448e..cd555f3 100644 --- a/src/edu/kit/informatik/model/RollingStock.java +++ b/src/edu/kit/informatik/model/RollingStock.java @@ -3,8 +3,8 @@ package edu.kit.informatik.model; import edu.kit.informatik.ui.InvalidInputException; /** - * A rolling stock. Is usually an engine, train set or coach. - * + * A rolling stock with a specific integer length and couplings. Is usually an engine, train set or coach. + * * @author Arne Keller * @version 1.0 */ @@ -24,6 +24,7 @@ public abstract class RollingStock { /** * Initialize a rolling stock. + * * @param length length of this rolling stock * @param couplingFront whether this rolling stock should have a front coupling * @param couplingBack whether this rolling stock should have a back coupling @@ -43,6 +44,8 @@ public abstract class RollingStock { } /** + * Get the identifier of this rolling stock. + * * @return identifier of this rolling stock */ public abstract String getIdentifier(); diff --git a/src/edu/kit/informatik/model/Train.java b/src/edu/kit/informatik/model/Train.java index 30a1562..86631c6 100644 --- a/src/edu/kit/informatik/model/Train.java +++ b/src/edu/kit/informatik/model/Train.java @@ -343,6 +343,7 @@ public final class Train { /** * Update the direction of this train. + * * @param newDirection new direction of the train */ public void setDirection(final Vector2D newDirection) { @@ -369,6 +370,8 @@ public final class Train { } /** + * Check if this train is on the specified position. This includes the front and back of the train. + * * @param point position to check * @return whether this train is on the specified position */ @@ -377,15 +380,18 @@ public final class Train { } /** + * Check if this train is on any of the provided positions. This includes the front and back of the train. + * * @param positions list of positions to check * @return whether this train is on any of the specified positions */ - public boolean isOnAnyPosition(final List positions) { + public boolean isOnAnyPosition(List positions) { return position != null && position.stream().anyMatch(positions::contains); } /** * Calculate the length of this train, summing the length of all rolling stocks. + * * @return total length of this train */ public long getLength() {