mirror of
https://gitlab.com/arnekeller/kit-programmieren-ws1920-final1.git
synced 2024-11-24 17:34:58 +00:00
56 lines
1.7 KiB
Java
56 lines
1.7 KiB
Java
package edu.kit.informatik.model;
|
|
|
|
import edu.kit.informatik.ui.InvalidInputException;
|
|
|
|
/**
|
|
* Electrical engine.
|
|
*
|
|
* @author Arne Keller
|
|
* @version 1.0
|
|
*/
|
|
public class ElectricalEngine extends Engine {
|
|
/**
|
|
* ASCII art of an electrical 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
|
|
* @throws InvalidInputException on invalid user input (e.g. zero-sized engine)
|
|
*/
|
|
public ElectricalEngine(final String series, final String name, final int length,
|
|
final boolean couplingFront, final boolean couplingBack) throws InvalidInputException {
|
|
super(series, name, length, couplingFront, couplingBack);
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return String.format("e %s %s %d %b %b", getSeries(), getName(), getLength(),
|
|
hasCouplingFront(), hasCouplingBack());
|
|
}
|
|
|
|
@Override
|
|
public String[] textRepresentation() {
|
|
return ELECTRICAL_ENGINE_TEXT;
|
|
}
|
|
|
|
@Override
|
|
public String description() {
|
|
return "electrical engine";
|
|
}
|
|
}
|