kit-programmieren-ws1920-fi.../src/edu/kit/informatik/model/FreightCoach.java

52 lines
1.4 KiB
Java
Raw Normal View History

2020-02-19 17:44:25 +00:00
package edu.kit.informatik.model;
import edu.kit.informatik.ui.InvalidInputException;
2020-02-25 07:52:20 +00:00
/**
* A freight coach.
*
* @author Arne Keller
* @version 1.0
*/
2020-02-19 17:44:25 +00:00
public class FreightCoach extends Coach {
/**
* ASCII art representation of a freight coach.
*/
private static final String[] FREIGHT_TEXT = new String[] {
"| |",
"| |",
"| |",
"|__________________|",
" (O) (O) "
};
/**
* Construct a new freight coach.
* @param identifier identifier to use
* @param length length of coach
* @param couplingFront whether the coach should have a front coupling
* @param couplingBack whether the coach should have a back coupling
* @throws InvalidInputException on invalid user input (zero-sized coach)
*/
2020-02-19 17:49:18 +00:00
public FreightCoach(int identifier, int length, boolean couplingFront, boolean couplingBack)
throws InvalidInputException {
2020-02-19 17:44:25 +00:00
super(identifier, length, couplingFront, couplingBack);
}
@Override
public String description() {
return "freight coach";
}
@Override
public String[] textRepresentation() {
2020-02-20 13:11:26 +00:00
// make sure caller can not modify private data
return FREIGHT_TEXT.clone();
2020-02-19 17:44:25 +00:00
}
@Override
public String getType() {
return "f";
}
}