From ac089109b2b2b40eb6a2cd32e216ca13c15ea6dd Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Sat, 15 Feb 2020 15:44:07 +0100 Subject: [PATCH] Add javadoc --- src/edu/kit/informatik/command/AddSwitch.java | 12 ++++++++++++ src/edu/kit/informatik/command/AddTrack.java | 11 +++++++++++ src/edu/kit/informatik/command/AddTrain.java | 11 +++++++++++ .../kit/informatik/command/CommandFactory.java | 11 +++++++++++ src/edu/kit/informatik/command/CreateCoach.java | 13 +++++++++++++ src/edu/kit/informatik/command/CreateEngine.java | 15 +++++++++++++++ 6 files changed, 73 insertions(+) diff --git a/src/edu/kit/informatik/command/AddSwitch.java b/src/edu/kit/informatik/command/AddSwitch.java index 59851d7..dbe5f45 100644 --- a/src/edu/kit/informatik/command/AddSwitch.java +++ b/src/edu/kit/informatik/command/AddSwitch.java @@ -4,11 +4,23 @@ import edu.kit.informatik.ModelRailwaySimulation; import edu.kit.informatik.Point; import edu.kit.informatik.Terminal; +/** + * Command used to add a switch to the rail network. + * + * @author Arne Keller + * @version 1.0 + */ public class AddSwitch extends Command { private final Point start; private final Point end1; private final Point end2; + /** + * Construct a new 'add switch' command. + * @param start start position + * @param end1 end position 1 + * @param end2 end position 2 + */ public AddSwitch(final Point start, final Point end1, final Point end2) { this.start = start; this.end1 = end1; diff --git a/src/edu/kit/informatik/command/AddTrack.java b/src/edu/kit/informatik/command/AddTrack.java index 9eee6d6..75f7bc2 100644 --- a/src/edu/kit/informatik/command/AddTrack.java +++ b/src/edu/kit/informatik/command/AddTrack.java @@ -4,10 +4,21 @@ import edu.kit.informatik.ModelRailwaySimulation; import edu.kit.informatik.Point; import edu.kit.informatik.Terminal; +/** + * Command used to add a track to the rail network. + * + * @author Arne Keller + * @version 1.0 + */ public class AddTrack extends Command { private Point start; private Point end; + /** + * Construct a new 'add track' command. + * @param start + * @param end + */ public AddTrack(final Point start, final Point end) { this.start = start; this.end = end; diff --git a/src/edu/kit/informatik/command/AddTrain.java b/src/edu/kit/informatik/command/AddTrain.java index 1b836c3..8704d3f 100644 --- a/src/edu/kit/informatik/command/AddTrain.java +++ b/src/edu/kit/informatik/command/AddTrain.java @@ -4,10 +4,21 @@ import edu.kit.informatik.ModelRailwaySimulation; import edu.kit.informatik.RollingStock; import edu.kit.informatik.Terminal; +/** + * Command used to construct a new train or modify an existing train. + * + * @author Arne Keller + * @version 1.0 + */ public class AddTrain extends Command { private final int trainId; private final String rollingStockId; + /** + * Construct a new 'add train' command. + * @param trainId identifier of the train to be added/modified + * @param rollingStockId identifer of the rolling to be added to the train + */ public AddTrain(final int trainId, final String rollingStockId) { this.trainId = trainId; this.rollingStockId = rollingStockId; diff --git a/src/edu/kit/informatik/command/CommandFactory.java b/src/edu/kit/informatik/command/CommandFactory.java index fe43a15..3df7f1c 100644 --- a/src/edu/kit/informatik/command/CommandFactory.java +++ b/src/edu/kit/informatik/command/CommandFactory.java @@ -7,6 +7,12 @@ import edu.kit.informatik.Terminal; import java.util.regex.Matcher; import java.util.regex.Pattern; +/** + * Factory used to parse user input into commands. + * + * @author Arne Keller + * @version 1.0 + */ public class CommandFactory { public static final String ADD_TRACK = "add track"; public static final Pattern ADD_TRACK_ARGUMENTS @@ -46,6 +52,11 @@ public class CommandFactory { public static final String STEP = "step"; public static final String POSITIVE_NUMBER = " \\+?\\d+"; + /** + * Parse a single line of user input into one command. + * @param command user input line + * @return a fully specified command object + */ public static Command getCommand(final String command) { if (command.startsWith(ADD_TRACK)) { String arguments = command.substring(ADD_TRACK.length()); diff --git a/src/edu/kit/informatik/command/CreateCoach.java b/src/edu/kit/informatik/command/CreateCoach.java index ee5bf13..0c632de 100644 --- a/src/edu/kit/informatik/command/CreateCoach.java +++ b/src/edu/kit/informatik/command/CreateCoach.java @@ -4,12 +4,25 @@ import edu.kit.informatik.CoachType; import edu.kit.informatik.ModelRailwaySimulation; import edu.kit.informatik.Terminal; +/** + * Command used to create a single coach. + * + * @author Arne Keller + * @version 1.0 + */ public class CreateCoach extends Command { private final CoachType type; private final int length; private final boolean couplingFront; private final boolean couplingBack; + /** + * Create a new 'create coach' command. + * @param type type of the coach + * @param length length of the coach + * @param couplingFront whether the coach should have a front coupling + * @param couplingBack whether the coach should have a back coupling + */ public CreateCoach(final CoachType type, final int length, final boolean couplingFront, final boolean couplingBack) { this.type = type; this.length = length; diff --git a/src/edu/kit/informatik/command/CreateEngine.java b/src/edu/kit/informatik/command/CreateEngine.java index a43b126..e02b858 100644 --- a/src/edu/kit/informatik/command/CreateEngine.java +++ b/src/edu/kit/informatik/command/CreateEngine.java @@ -2,6 +2,12 @@ package edu.kit.informatik.command; import edu.kit.informatik.*; +/** + * Command used to create a single engine. + * + * @author Arne Keller + * @version 1.0 + */ public class CreateEngine extends Command { private final String type; private final String series; @@ -10,6 +16,15 @@ public class CreateEngine extends Command { private final boolean couplingFront; private final boolean couplingBack; + /** + * Construct a new 'create engine' command. + * @param type type of the engine + * @param series series/class of the engine + * @param name name of the engine + * @param length length of the engine + * @param couplingFront whether the new engine should have a front coupling + * @param couplingBack whether the new engine should have a back coupling + */ public CreateEngine(final String type, final String series, final String name, final int length, final boolean couplingFront, final boolean couplingBack) { this.type = type; this.series = series;