mirror of
https://gitlab.com/arnekeller/kit-programmieren-ws1920-final1.git
synced 2024-11-24 09:24:58 +00:00
Make command an interface
This commit is contained in:
parent
972000204f
commit
b24b7cd83f
@ -10,7 +10,7 @@ import edu.kit.informatik.Terminal;
|
||||
* @author Arne Keller
|
||||
* @version 1.0
|
||||
*/
|
||||
public class AddSwitch extends Command {
|
||||
public class AddSwitch implements Command {
|
||||
private final Point start;
|
||||
private final Point end1;
|
||||
private final Point end2;
|
||||
|
@ -10,7 +10,7 @@ import edu.kit.informatik.Terminal;
|
||||
* @author Arne Keller
|
||||
* @version 1.0
|
||||
*/
|
||||
public class AddTrack extends Command {
|
||||
public class AddTrack implements Command {
|
||||
private Point start;
|
||||
private Point end;
|
||||
|
||||
|
@ -10,7 +10,7 @@ import edu.kit.informatik.Terminal;
|
||||
* @author Arne Keller
|
||||
* @version 1.0
|
||||
*/
|
||||
public class AddTrain extends Command {
|
||||
public class AddTrain implements Command {
|
||||
private final int trainId;
|
||||
private final String rollingStockId;
|
||||
|
||||
|
@ -3,12 +3,12 @@ package edu.kit.informatik.command;
|
||||
import edu.kit.informatik.ModelRailwaySimulation;
|
||||
|
||||
/**
|
||||
* Generic command that can be applied to a simulation.
|
||||
* Commands are implemented as separate classes to avoid god enums :)
|
||||
* Command that can be applied to a simulation.
|
||||
* Commands are implemented as separate classes to avoid a god enum :)
|
||||
*
|
||||
* @author Arne Keller
|
||||
* @version 1.0
|
||||
*/
|
||||
public abstract class Command {
|
||||
public abstract void apply(ModelRailwaySimulation simulation);
|
||||
public interface Command {
|
||||
void apply(ModelRailwaySimulation simulation);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import edu.kit.informatik.Terminal;
|
||||
* @author Arne Keller
|
||||
* @version 1.0
|
||||
*/
|
||||
public class CreateCoach extends Command {
|
||||
public class CreateCoach implements Command {
|
||||
private final CoachType type;
|
||||
private final int length;
|
||||
private final boolean couplingFront;
|
||||
|
@ -8,7 +8,7 @@ import edu.kit.informatik.*;
|
||||
* @author Arne Keller
|
||||
* @version 1.0
|
||||
*/
|
||||
public class CreateEngine extends Command {
|
||||
public class CreateEngine implements Command {
|
||||
private final EngineType type;
|
||||
private final String series;
|
||||
private final String name;
|
||||
|
@ -10,7 +10,7 @@ import edu.kit.informatik.TrainSet;
|
||||
* @author Arne Keller
|
||||
* @version Arne Keller
|
||||
*/
|
||||
public class CreateTrainSet extends Command {
|
||||
public class CreateTrainSet implements Command {
|
||||
private final String series;
|
||||
private final String name;
|
||||
private final int length;
|
||||
|
@ -9,7 +9,7 @@ import edu.kit.informatik.Terminal;
|
||||
* @author Arne Keller
|
||||
* @version 1.0
|
||||
*/
|
||||
public class DeleteRollingStock extends Command {
|
||||
public class DeleteRollingStock implements Command {
|
||||
private final String id;
|
||||
|
||||
/**
|
||||
|
@ -9,7 +9,7 @@ import edu.kit.informatik.Terminal;
|
||||
* @author Arne Keller
|
||||
* @version 1.0
|
||||
*/
|
||||
public class DeleteTrack extends Command {
|
||||
public class DeleteTrack implements Command {
|
||||
private final int id;
|
||||
|
||||
/**
|
||||
|
@ -9,7 +9,7 @@ import edu.kit.informatik.Terminal;
|
||||
* @author Arne Keller
|
||||
* @version 1.0
|
||||
*/
|
||||
public class DeleteTrain extends Command {
|
||||
public class DeleteTrain implements Command {
|
||||
private final int id;
|
||||
|
||||
/**
|
||||
|
@ -8,7 +8,7 @@ import edu.kit.informatik.ModelRailwaySimulation;
|
||||
* @author Arne Keller
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ListCoaches extends Command {
|
||||
public class ListCoaches implements Command {
|
||||
@Override
|
||||
public void apply(final ModelRailwaySimulation simulation) {
|
||||
simulation.printCoaches();
|
||||
|
@ -8,7 +8,7 @@ import edu.kit.informatik.ModelRailwaySimulation;
|
||||
* @author Arne Keller
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ListEngines extends Command {
|
||||
public class ListEngines implements Command {
|
||||
@Override
|
||||
public void apply(final ModelRailwaySimulation simulation) {
|
||||
simulation.printEngines();
|
||||
|
@ -8,7 +8,7 @@ import edu.kit.informatik.ModelRailwaySimulation;
|
||||
* @author Arne Keller
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ListTracks extends Command {
|
||||
public class ListTracks implements Command {
|
||||
@Override
|
||||
public void apply(final ModelRailwaySimulation simulation) {
|
||||
simulation.printTracks();
|
||||
|
@ -8,7 +8,7 @@ import edu.kit.informatik.ModelRailwaySimulation;
|
||||
* @author Arne Keller
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ListTrainSets extends Command {
|
||||
public class ListTrainSets implements Command {
|
||||
@Override
|
||||
public void apply(final ModelRailwaySimulation simulation) {
|
||||
simulation.printTrainSets();
|
||||
|
@ -8,7 +8,7 @@ import edu.kit.informatik.ModelRailwaySimulation;
|
||||
* @author Arne Keller
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ListTrains extends Command {
|
||||
public class ListTrains implements Command {
|
||||
@Override
|
||||
public void apply(final ModelRailwaySimulation simulation) {
|
||||
simulation.printTrains();
|
||||
|
@ -10,7 +10,7 @@ import edu.kit.informatik.Terminal;
|
||||
* @author Arne Keller
|
||||
* @version 1.0
|
||||
*/
|
||||
public class PutTrain extends Command {
|
||||
public class PutTrain implements Command {
|
||||
private final int id;
|
||||
private final Point point;
|
||||
private final int x;
|
||||
|
@ -10,7 +10,7 @@ import edu.kit.informatik.Terminal;
|
||||
* @author Arne Keller
|
||||
* @version 1.0
|
||||
*/
|
||||
public class SetSwitch extends Command {
|
||||
public class SetSwitch implements Command {
|
||||
private final int id;
|
||||
private final Point point;
|
||||
|
||||
|
@ -8,7 +8,7 @@ import edu.kit.informatik.ModelRailwaySimulation;
|
||||
* @author Arne Keller
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ShowTrain extends Command {
|
||||
public class ShowTrain implements Command {
|
||||
private final int id;
|
||||
|
||||
/**
|
||||
|
@ -8,7 +8,7 @@ import edu.kit.informatik.ModelRailwaySimulation;
|
||||
* @author Arne Keller
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Step extends Command {
|
||||
public class Step implements Command {
|
||||
private final short speed;
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user