Checkstyle

This commit is contained in:
Arne Keller 2020-02-15 16:11:13 +01:00
parent 49e2e65908
commit 9cc4ba0015
4 changed files with 78 additions and 31 deletions

View File

@ -1,7 +1,31 @@
package edu.kit.informatik; package edu.kit.informatik;
/**
* Diesel engine.
*
* @author Arne Keller
* @version 1.0
*/
public class DieselEngine extends Engine { public class DieselEngine extends Engine {
public DieselEngine(final String series, final String name, final int length, final boolean couplingFront, final boolean couplingBack) { private static final String[] DIESEL_ENGINE_TEXT = new String[] {
" _____________|____ ",
" /_| ____________ |_\\ ",
"/ |____________| \\",
"\\ /",
" \\__________________/ ",
" (O)(O) (O)(O) ",
};
/**
* Construct a new diesel engine.
* @param series series/class of engine
* @param name name of engine
* @param length length of engine
* @param couplingFront whether the engine should have a front coupling
* @param couplingBack whether the engine should have a back coupling
*/
public DieselEngine(final String series, final String name, final int length,
final boolean couplingFront, final boolean couplingBack) {
super.name = name; super.name = name;
super.series = series; super.series = series;
super.length = length; super.length = length;
@ -14,15 +38,6 @@ public class DieselEngine extends Engine {
return String.format("d %s %s %d %b %b", series, name, length, couplingFront, couplingBack); return String.format("d %s %s %d %b %b", series, name, length, couplingFront, couplingBack);
} }
private static final String[] DIESEL_ENGINE_TEXT = new String[] {
" _____________|____ ",
" /_| ____________ |_\\ ",
"/ |____________| \\",
"\\ /",
" \\__________________/ ",
" (O)(O) (O)(O) ",
};
@Override @Override
public String[] textRepresentation() { public String[] textRepresentation() {
return DIESEL_ENGINE_TEXT; return DIESEL_ENGINE_TEXT;

View File

@ -1,6 +1,31 @@
package edu.kit.informatik; package edu.kit.informatik;
/**
* Electrical engine.
*
* @author Arne Keller
* @version 1.0
*/
public class ElectricalEngine extends Engine { public class ElectricalEngine extends Engine {
private static final String[] ELECTRICAL_ENGINE_TEXT = new String[] {
" ___ ",
" \\ ",
" _______________/__ ",
" /_| ____________ |_\\ ",
"/ |____________| \\",
"\\ /",
" \\__________________/ ",
" (O)(O) (O)(O) ",
};
/**
* Construct a new electrical engine.
* @param series series/class of engine
* @param name name of engine
* @param length length of engine
* @param couplingFront whether the engine should have a front coupling
* @param couplingBack whether the engine should have a back coupling
*/
public ElectricalEngine(final String series, final String name, final int length, final boolean couplingFront, final boolean couplingBack) { public ElectricalEngine(final String series, final String name, final int length, final boolean couplingFront, final boolean couplingBack) {
super.name = name; super.name = name;
super.series = series; super.series = series;
@ -14,17 +39,6 @@ public class ElectricalEngine extends Engine {
return String.format("e %s %s %d %b %b", series, name, length, couplingFront, couplingBack); return String.format("e %s %s %d %b %b", series, name, length, couplingFront, couplingBack);
} }
private static final String[] ELECTRICAL_ENGINE_TEXT = new String[] {
" ___ ",
" \\ ",
" _______________/__ ",
" /_| ____________ |_\\ ",
"/ |____________| \\",
"\\ /",
" \\__________________/ ",
" (O)(O) (O)(O) ",
};
@Override @Override
public String[] textRepresentation() { public String[] textRepresentation() {
return ELECTRICAL_ENGINE_TEXT; return ELECTRICAL_ENGINE_TEXT;

View File

@ -2,6 +2,9 @@ package edu.kit.informatik;
/** /**
* Generic rail that other rails can connect to. * Generic rail that other rails can connect to.
*
* @author Arne Keller
* @version 1.0
*/ */
public abstract class Rail { public abstract class Rail {
protected int id; protected int id;

View File

@ -1,7 +1,31 @@
package edu.kit.informatik; package edu.kit.informatik;
/**
* Steam engine.
*
* @author Arne Keller
* @version 1.0
*/
public class SteamEngine extends Engine { public class SteamEngine extends Engine {
public SteamEngine(final String series, final String name, final int length, final boolean couplingFront, final boolean couplingBack) { private static final String[] STEAM_ENGINE_TEXT = new String[] {
" ++ +------",
" || |+-+ | ",
" /---------|| | | ",
" + ======== +-+ | ",
" _|--/~\\------/~\\-+ ",
"//// \\_/ \\_/ "
};
/**
* Construct a new steam engine.
* @param series series/class of engine
* @param name name of engine
* @param length length of engine
* @param couplingFront whether the engine should have a front coupling
* @param couplingBack whether the engine should have a back coupling
*/
public SteamEngine(final String series, final String name, final int length,
final boolean couplingFront, final boolean couplingBack) {
super.name = name; super.name = name;
super.series = series; super.series = series;
super.length = length; super.length = length;
@ -14,15 +38,6 @@ public class SteamEngine extends Engine {
return String.format("s %s %s %d %b %b", series, name, length, couplingFront, couplingBack); return String.format("s %s %s %d %b %b", series, name, length, couplingFront, couplingBack);
} }
private static final String[] STEAM_ENGINE_TEXT = new String[] {
" ++ +------",
" || |+-+ | ",
" /---------|| | | ",
" + ======== +-+ | ",
" _|--/~\\------/~\\-+ ",
"//// \\_/ \\_/ "
};
@Override @Override
public String[] textRepresentation() { public String[] textRepresentation() {
return STEAM_ENGINE_TEXT; return STEAM_ENGINE_TEXT;