mirror of
https://gitlab.com/arnekeller/kit-programmieren-ws1920-final1.git
synced 2024-11-09 02:10:40 +00:00
Checkstyle
This commit is contained in:
parent
6ba920c82d
commit
ccca59fc4a
@ -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());
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user