mirror of
https://gitlab.com/arnekeller/kit-programmieren-ws1920-final1.git
synced 2024-11-24 09:24:58 +00:00
Add javadoc
This commit is contained in:
parent
1e8026216a
commit
ac089109b2
@ -4,11 +4,23 @@ import edu.kit.informatik.ModelRailwaySimulation;
|
|||||||
import edu.kit.informatik.Point;
|
import edu.kit.informatik.Point;
|
||||||
import edu.kit.informatik.Terminal;
|
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 {
|
public class AddSwitch extends Command {
|
||||||
private final Point start;
|
private final Point start;
|
||||||
private final Point end1;
|
private final Point end1;
|
||||||
private final Point end2;
|
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) {
|
public AddSwitch(final Point start, final Point end1, final Point end2) {
|
||||||
this.start = start;
|
this.start = start;
|
||||||
this.end1 = end1;
|
this.end1 = end1;
|
||||||
|
@ -4,10 +4,21 @@ import edu.kit.informatik.ModelRailwaySimulation;
|
|||||||
import edu.kit.informatik.Point;
|
import edu.kit.informatik.Point;
|
||||||
import edu.kit.informatik.Terminal;
|
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 {
|
public class AddTrack extends Command {
|
||||||
private Point start;
|
private Point start;
|
||||||
private Point end;
|
private Point end;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new 'add track' command.
|
||||||
|
* @param start
|
||||||
|
* @param end
|
||||||
|
*/
|
||||||
public AddTrack(final Point start, final Point end) {
|
public AddTrack(final Point start, final Point end) {
|
||||||
this.start = start;
|
this.start = start;
|
||||||
this.end = end;
|
this.end = end;
|
||||||
|
@ -4,10 +4,21 @@ import edu.kit.informatik.ModelRailwaySimulation;
|
|||||||
import edu.kit.informatik.RollingStock;
|
import edu.kit.informatik.RollingStock;
|
||||||
import edu.kit.informatik.Terminal;
|
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 {
|
public class AddTrain extends Command {
|
||||||
private final int trainId;
|
private final int trainId;
|
||||||
private final String rollingStockId;
|
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) {
|
public AddTrain(final int trainId, final String rollingStockId) {
|
||||||
this.trainId = trainId;
|
this.trainId = trainId;
|
||||||
this.rollingStockId = rollingStockId;
|
this.rollingStockId = rollingStockId;
|
||||||
|
@ -7,6 +7,12 @@ import edu.kit.informatik.Terminal;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory used to parse user input into commands.
|
||||||
|
*
|
||||||
|
* @author Arne Keller
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
public class CommandFactory {
|
public class CommandFactory {
|
||||||
public static final String ADD_TRACK = "add track";
|
public static final String ADD_TRACK = "add track";
|
||||||
public static final Pattern ADD_TRACK_ARGUMENTS
|
public static final Pattern ADD_TRACK_ARGUMENTS
|
||||||
@ -46,6 +52,11 @@ public class CommandFactory {
|
|||||||
public static final String STEP = "step";
|
public static final String STEP = "step";
|
||||||
public static final String POSITIVE_NUMBER = " \\+?\\d+";
|
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) {
|
public static Command getCommand(final String command) {
|
||||||
if (command.startsWith(ADD_TRACK)) {
|
if (command.startsWith(ADD_TRACK)) {
|
||||||
String arguments = command.substring(ADD_TRACK.length());
|
String arguments = command.substring(ADD_TRACK.length());
|
||||||
|
@ -4,12 +4,25 @@ import edu.kit.informatik.CoachType;
|
|||||||
import edu.kit.informatik.ModelRailwaySimulation;
|
import edu.kit.informatik.ModelRailwaySimulation;
|
||||||
import edu.kit.informatik.Terminal;
|
import edu.kit.informatik.Terminal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command used to create a single coach.
|
||||||
|
*
|
||||||
|
* @author Arne Keller
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
public class CreateCoach extends Command {
|
public class CreateCoach extends Command {
|
||||||
private final CoachType type;
|
private final CoachType type;
|
||||||
private final int length;
|
private final int length;
|
||||||
private final boolean couplingFront;
|
private final boolean couplingFront;
|
||||||
private final boolean couplingBack;
|
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) {
|
public CreateCoach(final CoachType type, final int length, final boolean couplingFront, final boolean couplingBack) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.length = length;
|
this.length = length;
|
||||||
|
@ -2,6 +2,12 @@ package edu.kit.informatik.command;
|
|||||||
|
|
||||||
import edu.kit.informatik.*;
|
import edu.kit.informatik.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command used to create a single engine.
|
||||||
|
*
|
||||||
|
* @author Arne Keller
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
public class CreateEngine extends Command {
|
public class CreateEngine extends Command {
|
||||||
private final String type;
|
private final String type;
|
||||||
private final String series;
|
private final String series;
|
||||||
@ -10,6 +16,15 @@ public class CreateEngine extends Command {
|
|||||||
private final boolean couplingFront;
|
private final boolean couplingFront;
|
||||||
private final boolean couplingBack;
|
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) {
|
public CreateEngine(final String type, final String series, final String name, final int length, final boolean couplingFront, final boolean couplingBack) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.series = series;
|
this.series = series;
|
||||||
|
Loading…
Reference in New Issue
Block a user