mirror of
https://gitlab.com/arnekeller/kit-programmieren-ws1920-final1.git
synced 2024-11-28 03:05:54 +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.Terminal;
|
||||||
import edu.kit.informatik.TrainSet;
|
import edu.kit.informatik.TrainSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command used to add a new train set.
|
||||||
|
*/
|
||||||
public class CreateTrainSet extends Command {
|
public class CreateTrainSet extends Command {
|
||||||
private final String series;
|
private final String series;
|
||||||
private final String name;
|
private final String name;
|
||||||
@ -11,6 +14,14 @@ public class CreateTrainSet extends Command {
|
|||||||
private final boolean couplingFront;
|
private final boolean couplingFront;
|
||||||
private final boolean couplingBack;
|
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) {
|
public CreateTrainSet(final String series, final String name, final int length, final boolean couplingFront, final boolean couplingBack) {
|
||||||
this.series = series;
|
this.series = series;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -20,7 +31,7 @@ public class CreateTrainSet extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(ModelRailwaySimulation simulation) {
|
public void apply(final ModelRailwaySimulation simulation) {
|
||||||
TrainSet trainSet = new TrainSet(series, name, length, couplingFront, couplingBack);
|
TrainSet trainSet = new TrainSet(series, name, length, couplingFront, couplingBack);
|
||||||
if (simulation.createTrainSet(trainSet)) {
|
if (simulation.createTrainSet(trainSet)) {
|
||||||
Terminal.printLine(trainSet.getIdentifier());
|
Terminal.printLine(trainSet.getIdentifier());
|
||||||
|
@ -3,15 +3,22 @@ package edu.kit.informatik.command;
|
|||||||
import edu.kit.informatik.ModelRailwaySimulation;
|
import edu.kit.informatik.ModelRailwaySimulation;
|
||||||
import edu.kit.informatik.Terminal;
|
import edu.kit.informatik.Terminal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command used to delete rolling stock.
|
||||||
|
*/
|
||||||
public class DeleteRollingStock extends Command {
|
public class DeleteRollingStock extends Command {
|
||||||
private final String id;
|
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) {
|
public DeleteRollingStock(final String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(ModelRailwaySimulation simulation) {
|
public void apply(final ModelRailwaySimulation simulation) {
|
||||||
if (simulation.deleteRollingStock(id)) {
|
if (simulation.deleteRollingStock(id)) {
|
||||||
Terminal.printLine("OK");
|
Terminal.printLine("OK");
|
||||||
} else {
|
} else {
|
||||||
|
@ -3,15 +3,25 @@ package edu.kit.informatik.command;
|
|||||||
import edu.kit.informatik.ModelRailwaySimulation;
|
import edu.kit.informatik.ModelRailwaySimulation;
|
||||||
import edu.kit.informatik.Terminal;
|
import edu.kit.informatik.Terminal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command used to delete a track or switch.
|
||||||
|
*
|
||||||
|
* @author Arne Keller
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
public class DeleteTrack extends Command {
|
public class DeleteTrack extends Command {
|
||||||
private final int id;
|
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;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(ModelRailwaySimulation simulation) {
|
public void apply(final ModelRailwaySimulation simulation) {
|
||||||
if (simulation.removeRail(id)) {
|
if (simulation.removeRail(id)) {
|
||||||
Terminal.printLine("OK");
|
Terminal.printLine("OK");
|
||||||
} else {
|
} else {
|
||||||
|
@ -3,15 +3,25 @@ package edu.kit.informatik.command;
|
|||||||
import edu.kit.informatik.ModelRailwaySimulation;
|
import edu.kit.informatik.ModelRailwaySimulation;
|
||||||
import edu.kit.informatik.Terminal;
|
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 {
|
public class DeleteTrain extends Command {
|
||||||
private final int id;
|
private final int id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new 'delete train' command.
|
||||||
|
* @param id identifier of the train to delete
|
||||||
|
*/
|
||||||
public DeleteTrain(final int id) {
|
public DeleteTrain(final int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(ModelRailwaySimulation simulation) {
|
public void apply(final ModelRailwaySimulation simulation) {
|
||||||
if (simulation.deleteTrain(id)) {
|
if (simulation.deleteTrain(id)) {
|
||||||
Terminal.printLine("OK");
|
Terminal.printLine("OK");
|
||||||
} else {
|
} else {
|
||||||
|
@ -2,9 +2,15 @@ package edu.kit.informatik.command;
|
|||||||
|
|
||||||
import edu.kit.informatik.ModelRailwaySimulation;
|
import edu.kit.informatik.ModelRailwaySimulation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command used to print a list of coaches.
|
||||||
|
*
|
||||||
|
* @author Arne Keller
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
public class ListCoaches extends Command {
|
public class ListCoaches extends Command {
|
||||||
@Override
|
@Override
|
||||||
public void apply(ModelRailwaySimulation simulation) {
|
public void apply(final ModelRailwaySimulation simulation) {
|
||||||
simulation.printCoaches();
|
simulation.printCoaches();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user