Checkstyle

This commit is contained in:
Arne Keller 2020-02-16 14:57:54 +01:00
parent d446628f35
commit bfccc89237
6 changed files with 42 additions and 2 deletions

View File

@ -32,7 +32,13 @@ public class Coach extends RollingStock {
" (O) (O) " " (O) (O) "
}; };
/**
* The type of this coach (passenger, freight or special). TODO: consider using three classes
*/
private CoachType type; private CoachType type;
/**
* The unique identifier of this coach.
*/
private int identifier; private int identifier;
/** /**
@ -68,10 +74,16 @@ public class Coach extends RollingStock {
return false; return false;
} }
/**
* @return the numerical identifier of this coach
*/
public int getNumericalIdentifier() { public int getNumericalIdentifier() {
return identifier; return identifier;
} }
/**
* @return the type of this coach (passenger, freight or special)
*/
public CoachType getType() { public CoachType getType() {
return type; return type;
} }

View File

@ -12,6 +12,9 @@ import edu.kit.informatik.command.CommandFactory;
public class CommandLine { public class CommandLine {
private static final String EXIT = "exit"; private static final String EXIT = "exit";
/**
* Start a new interactive user session. Returns when standard in is fully processed or user exits.
*/
public static void startInteractive() { public static void startInteractive() {
// create a new simulation // create a new simulation
ModelRailwaySimulation simulation = new ModelRailwaySimulation(); ModelRailwaySimulation simulation = new ModelRailwaySimulation();

View File

@ -1,5 +1,11 @@
package edu.kit.informatik; package edu.kit.informatik;
/**
* Generic engine, is usually either diesel, steam or electric.
*
* @author Arne Keller
* @version 1.0
*/
public abstract class Engine extends RollingStock { public abstract class Engine extends RollingStock {
/** /**
* Series/class of this engine. * Series/class of this engine.
@ -10,6 +16,9 @@ public abstract class Engine extends RollingStock {
*/ */
protected String name; protected String name;
/**
* @return the name of this engine
*/
public String getName() { public String getName() {
return name; return name;
} }

View File

@ -7,7 +7,11 @@ package edu.kit.informatik;
* @version 1.0 * @version 1.0
*/ */
public class InvalidInputException extends Exception { public class InvalidInputException extends Exception {
public InvalidInputException(String message) { /**
* Construct a new invalid input expection.
* @param message the error message
*/
public InvalidInputException(final String message) {
super(message); super(message);
} }
} }

View File

@ -12,10 +12,17 @@ public abstract class Rail {
*/ */
protected final int id; protected final int id;
/**
* Initialize a new rail with the specified identifier.
* @param id the identifier of this rail
*/
protected Rail(final int id) { protected Rail(final int id) {
this.id = id; this.id = id;
} }
/**
* @return the unique identifier of this rail
*/
public int getIdentifier() { public int getIdentifier() {
return this.id; return this.id;
} }
@ -56,5 +63,10 @@ public abstract class Rail {
*/ */
public abstract boolean contains(Vector2D position); public abstract boolean contains(Vector2D position);
/**
* Get the direction trains can move on this rail starting at the specified position
* @param position the position to check
* @return the direction trains can move starting at that position
*/
public abstract Vector2D getDirectionFrom(Vector2D position); public abstract Vector2D getDirectionFrom(Vector2D position);
} }

View File

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* Train. * A train consisting of one or more rolling stock. Can be placed on a rail network.
* *
* @author Arne Keller * @author Arne Keller
* @version 1.0 * @version 1.0