From ccca59fc4afbdb63d7d09f41cf7b1b22e03df95f Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Sat, 15 Feb 2020 15:55:20 +0100 Subject: [PATCH] Checkstyle --- src/edu/kit/informatik/command/CreateTrainSet.java | 13 ++++++++++++- .../kit/informatik/command/DeleteRollingStock.java | 9 ++++++++- src/edu/kit/informatik/command/DeleteTrack.java | 14 ++++++++++++-- src/edu/kit/informatik/command/DeleteTrain.java | 12 +++++++++++- src/edu/kit/informatik/command/ListCoaches.java | 8 +++++++- 5 files changed, 50 insertions(+), 6 deletions(-) diff --git a/src/edu/kit/informatik/command/CreateTrainSet.java b/src/edu/kit/informatik/command/CreateTrainSet.java index 3725b0a..562f149 100644 --- a/src/edu/kit/informatik/command/CreateTrainSet.java +++ b/src/edu/kit/informatik/command/CreateTrainSet.java @@ -4,6 +4,9 @@ import edu.kit.informatik.ModelRailwaySimulation; import edu.kit.informatik.Terminal; import edu.kit.informatik.TrainSet; +/** + * Command used to add a new train set. + */ public class CreateTrainSet extends Command { private final String series; private final String name; @@ -11,6 +14,14 @@ public class CreateTrainSet extends Command { private final boolean couplingFront; private final boolean couplingBack; + /** + * Construct a new 'create train-set' command. + * @param series series/class of the train set + * @param name name of the train set + * @param length length of the train set + * @param couplingFront whether the train set should have a front coupling + * @param couplingBack whether the train set should have a back coupling + */ public CreateTrainSet(final String series, final String name, final int length, final boolean couplingFront, final boolean couplingBack) { this.series = series; this.name = name; @@ -20,7 +31,7 @@ public class CreateTrainSet extends Command { } @Override - public void apply(ModelRailwaySimulation simulation) { + public void apply(final ModelRailwaySimulation simulation) { TrainSet trainSet = new TrainSet(series, name, length, couplingFront, couplingBack); if (simulation.createTrainSet(trainSet)) { Terminal.printLine(trainSet.getIdentifier()); diff --git a/src/edu/kit/informatik/command/DeleteRollingStock.java b/src/edu/kit/informatik/command/DeleteRollingStock.java index a5efac7..5f27e0c 100644 --- a/src/edu/kit/informatik/command/DeleteRollingStock.java +++ b/src/edu/kit/informatik/command/DeleteRollingStock.java @@ -3,15 +3,22 @@ package edu.kit.informatik.command; import edu.kit.informatik.ModelRailwaySimulation; import edu.kit.informatik.Terminal; +/** + * Command used to delete rolling stock. + */ public class DeleteRollingStock extends Command { private final String id; + /** + * Construct a new 'delete rolling stock' command. + * @param id identifier of the rolling stock to delete + */ public DeleteRollingStock(final String id) { this.id = id; } @Override - public void apply(ModelRailwaySimulation simulation) { + public void apply(final ModelRailwaySimulation simulation) { if (simulation.deleteRollingStock(id)) { Terminal.printLine("OK"); } else { diff --git a/src/edu/kit/informatik/command/DeleteTrack.java b/src/edu/kit/informatik/command/DeleteTrack.java index 5fececf..a5b246f 100644 --- a/src/edu/kit/informatik/command/DeleteTrack.java +++ b/src/edu/kit/informatik/command/DeleteTrack.java @@ -3,15 +3,25 @@ package edu.kit.informatik.command; import edu.kit.informatik.ModelRailwaySimulation; import edu.kit.informatik.Terminal; +/** + * Command used to delete a track or switch. + * + * @author Arne Keller + * @version 1.0 + */ public class DeleteTrack extends Command { private final int id; - public DeleteTrack(int id) { + /** + * Construct a new 'delete track' command. + * @param id identifier of the track/switch to delete + */ + public DeleteTrack(final int id) { this.id = id; } @Override - public void apply(ModelRailwaySimulation simulation) { + public void apply(final ModelRailwaySimulation simulation) { if (simulation.removeRail(id)) { Terminal.printLine("OK"); } else { diff --git a/src/edu/kit/informatik/command/DeleteTrain.java b/src/edu/kit/informatik/command/DeleteTrain.java index d8f5ad3..e45d3aa 100644 --- a/src/edu/kit/informatik/command/DeleteTrain.java +++ b/src/edu/kit/informatik/command/DeleteTrain.java @@ -3,15 +3,25 @@ package edu.kit.informatik.command; import edu.kit.informatik.ModelRailwaySimulation; import edu.kit.informatik.Terminal; +/** + * Command used to delete a train, without deleting rolling stock of the train. + * + * @author Arne Keller + * @version 1.0 + */ public class DeleteTrain extends Command { private final int id; + /** + * Construct a new 'delete train' command. + * @param id identifier of the train to delete + */ public DeleteTrain(final int id) { this.id = id; } @Override - public void apply(ModelRailwaySimulation simulation) { + public void apply(final ModelRailwaySimulation simulation) { if (simulation.deleteTrain(id)) { Terminal.printLine("OK"); } else { diff --git a/src/edu/kit/informatik/command/ListCoaches.java b/src/edu/kit/informatik/command/ListCoaches.java index a791786..f13d8f9 100644 --- a/src/edu/kit/informatik/command/ListCoaches.java +++ b/src/edu/kit/informatik/command/ListCoaches.java @@ -2,9 +2,15 @@ package edu.kit.informatik.command; import edu.kit.informatik.ModelRailwaySimulation; +/** + * Command used to print a list of coaches. + * + * @author Arne Keller + * @version 1.0 + */ public class ListCoaches extends Command { @Override - public void apply(ModelRailwaySimulation simulation) { + public void apply(final ModelRailwaySimulation simulation) { simulation.printCoaches(); } }