2020-02-16 14:01:33 +00:00
|
|
|
package edu.kit.informatik.model;
|
2020-02-15 14:17:23 +00:00
|
|
|
|
2020-02-18 14:57:04 +00:00
|
|
|
import edu.kit.informatik.ui.InvalidInputException;
|
|
|
|
|
2020-02-15 15:11:13 +00:00
|
|
|
/**
|
|
|
|
* Electrical engine.
|
|
|
|
*
|
|
|
|
* @author Arne Keller
|
|
|
|
* @version 1.0
|
|
|
|
*/
|
2020-02-15 14:17:23 +00:00
|
|
|
public class ElectricalEngine extends Engine {
|
2020-02-17 09:39:26 +00:00
|
|
|
/**
|
|
|
|
* ASCII art of an electrical engine.
|
|
|
|
*/
|
2020-02-15 15:11:13 +00:00
|
|
|
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
|
2020-02-18 14:57:04 +00:00
|
|
|
* @throws InvalidInputException on invalid user input (e.g. zero-sized engine)
|
2020-02-15 15:11:13 +00:00
|
|
|
*/
|
2020-02-15 15:38:54 +00:00
|
|
|
public ElectricalEngine(final String series, final String name, final int length,
|
2020-02-18 14:57:04 +00:00
|
|
|
final boolean couplingFront, final boolean couplingBack) throws InvalidInputException {
|
2020-02-17 10:19:56 +00:00
|
|
|
super(series, name, length, couplingFront, couplingBack);
|
2020-02-15 14:17:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
2020-02-17 10:19:56 +00:00
|
|
|
return String.format("e %s %s %d %b %b", getSeries(), getName(), getLength(),
|
|
|
|
hasCouplingFront(), hasCouplingBack());
|
2020-02-15 14:17:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String[] textRepresentation() {
|
|
|
|
return ELECTRICAL_ENGINE_TEXT;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String description() {
|
|
|
|
return "electrical engine";
|
|
|
|
}
|
|
|
|
}
|