mirror of
https://gitlab.com/arnekeller/kit-programmieren-ws1920-final1.git
synced 2024-11-24 09:24:58 +00:00
Checkstyle
This commit is contained in:
parent
1f3802d380
commit
8803aab42a
@ -9,29 +9,95 @@ import edu.kit.informatik.ui.InvalidInputException;
|
|||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
public final class CommandFactory {
|
public final class CommandFactory {
|
||||||
|
/**
|
||||||
|
* Regex to match a number, accepting leading plus sign and zeros.
|
||||||
|
*/
|
||||||
public static final String NUMBER = "[+-]?\\d+";
|
public static final String NUMBER = "[+-]?\\d+";
|
||||||
|
/**
|
||||||
|
* Regex to accept two numbers separated by a comma.
|
||||||
|
*/
|
||||||
public static final String VECTOR = NUMBER + "," + NUMBER;
|
public static final String VECTOR = NUMBER + "," + NUMBER;
|
||||||
|
/**
|
||||||
|
* Regex to accept one word consisting of letters and digits.
|
||||||
|
*/
|
||||||
public static final String ALPHANUMERIC_WORD = "[\\p{L}\\d]+";
|
public static final String ALPHANUMERIC_WORD = "[\\p{L}\\d]+";
|
||||||
|
/**
|
||||||
|
* Regex to accept one rolling stock identifier.
|
||||||
|
*/
|
||||||
public static final String ROLLING_STOCK_IDENTIFIER
|
public static final String ROLLING_STOCK_IDENTIFIER
|
||||||
= "(" + ALPHANUMERIC_WORD + "-" + ALPHANUMERIC_WORD + ")|W" + NUMBER;
|
= "(" + ALPHANUMERIC_WORD + "-" + ALPHANUMERIC_WORD + ")|W" + NUMBER;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the add track command.
|
||||||
|
*/
|
||||||
public static final String ADD_TRACK = "add track";
|
public static final String ADD_TRACK = "add track";
|
||||||
|
/**
|
||||||
|
* Name of the add switch command.
|
||||||
|
*/
|
||||||
public static final String ADD_SWITCH = "add switch";
|
public static final String ADD_SWITCH = "add switch";
|
||||||
|
/**
|
||||||
|
* Name of the delete track command.
|
||||||
|
*/
|
||||||
public static final String DELETE_TRACK = "delete track";
|
public static final String DELETE_TRACK = "delete track";
|
||||||
|
/**
|
||||||
|
* Name of the list tracks command.
|
||||||
|
*/
|
||||||
public static final String LIST_TRACKS = "list tracks";
|
public static final String LIST_TRACKS = "list tracks";
|
||||||
|
/**
|
||||||
|
* Name of the set switch command.
|
||||||
|
*/
|
||||||
public static final String SET_SWITCH = "set switch";
|
public static final String SET_SWITCH = "set switch";
|
||||||
|
/**
|
||||||
|
* Name of the create engine command.
|
||||||
|
*/
|
||||||
public static final String CREATE_ENGINE = "create engine";
|
public static final String CREATE_ENGINE = "create engine";
|
||||||
|
/**
|
||||||
|
* Name of the list engines command.
|
||||||
|
*/
|
||||||
public static final String LIST_ENGINES = "list engines";
|
public static final String LIST_ENGINES = "list engines";
|
||||||
|
/**
|
||||||
|
* Name of the create coach command.
|
||||||
|
*/
|
||||||
public static final String CREATE_COACH = "create coach";
|
public static final String CREATE_COACH = "create coach";
|
||||||
|
/**
|
||||||
|
* Name of the list coaches command.
|
||||||
|
*/
|
||||||
public static final String LIST_COACHES = "list coaches";
|
public static final String LIST_COACHES = "list coaches";
|
||||||
|
/**
|
||||||
|
* Name of the create train-set command.
|
||||||
|
*/
|
||||||
public static final String CREATE_TRAIN_SET = "create train-set";
|
public static final String CREATE_TRAIN_SET = "create train-set";
|
||||||
|
/**
|
||||||
|
* Name of the list train-sets command.
|
||||||
|
*/
|
||||||
public static final String LIST_TRAIN_SETS = "list train-sets";
|
public static final String LIST_TRAIN_SETS = "list train-sets";
|
||||||
|
/**
|
||||||
|
* Name of the delete rolling stock command.
|
||||||
|
*/
|
||||||
public static final String DELETE_ROLLING_STOCK = "delete rolling stock";
|
public static final String DELETE_ROLLING_STOCK = "delete rolling stock";
|
||||||
|
/**
|
||||||
|
* Name of the add train command.
|
||||||
|
*/
|
||||||
public static final String ADD_TRAIN = "add train";
|
public static final String ADD_TRAIN = "add train";
|
||||||
|
/**
|
||||||
|
* Name of the delete train command.
|
||||||
|
*/
|
||||||
public static final String DELETE_TRAIN = "delete train";
|
public static final String DELETE_TRAIN = "delete train";
|
||||||
|
/**
|
||||||
|
* Name of the list train command.
|
||||||
|
*/
|
||||||
public static final String LIST_TRAINS = "list trains";
|
public static final String LIST_TRAINS = "list trains";
|
||||||
|
/**
|
||||||
|
* Name of the show train command.
|
||||||
|
*/
|
||||||
public static final String SHOW_TRAIN = "show train";
|
public static final String SHOW_TRAIN = "show train";
|
||||||
|
/**
|
||||||
|
* Name of the put train command.
|
||||||
|
*/
|
||||||
public static final String PUT_TRAIN = "put train";
|
public static final String PUT_TRAIN = "put train";
|
||||||
|
/**
|
||||||
|
* Name of the step command.
|
||||||
|
*/
|
||||||
public static final String STEP = "step";
|
public static final String STEP = "step";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +24,8 @@ import static edu.kit.informatik.ui.command.CommandFactory.NUMBER;
|
|||||||
*/
|
*/
|
||||||
public class CreateEngine extends Command {
|
public class CreateEngine extends Command {
|
||||||
private static final Pattern CREATE_ENGINE_ARGUMENTS
|
private static final Pattern CREATE_ENGINE_ARGUMENTS
|
||||||
= Pattern.compile(" (electrical|diesel|steam) (" + ALPHANUMERIC_WORD + ") (" + ALPHANUMERIC_WORD + ") (" + NUMBER + ") (true|false) (true|false)");
|
= Pattern.compile(" (electrical|diesel|steam) (" + ALPHANUMERIC_WORD + ") (" + ALPHANUMERIC_WORD + ") ("
|
||||||
|
+ NUMBER + ") (true|false) (true|false)");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of the new engine.
|
* Type of the new engine.
|
||||||
|
@ -20,7 +20,8 @@ import static edu.kit.informatik.ui.command.CommandFactory.NUMBER;
|
|||||||
*/
|
*/
|
||||||
public class CreateTrainSet extends Command {
|
public class CreateTrainSet extends Command {
|
||||||
private static final Pattern CREATE_TRAIN_SET_ARGUMENTS
|
private static final Pattern CREATE_TRAIN_SET_ARGUMENTS
|
||||||
= Pattern.compile(" (" + ALPHANUMERIC_WORD + ") (" + ALPHANUMERIC_WORD + ") (" + NUMBER + ") (true|false) (true|false)");
|
= Pattern.compile(" (" + ALPHANUMERIC_WORD + ") (" + ALPHANUMERIC_WORD + ") ("
|
||||||
|
+ NUMBER + ") (true|false) (true|false)");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Series (class) of the new train set.
|
* Series (class) of the new train set.
|
||||||
|
Loading…
Reference in New Issue
Block a user