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

50 lines
1.0 KiB
Java
Raw Normal View History

2020-02-16 14:01:33 +00:00
package edu.kit.informatik.model;
2020-02-15 14:17:23 +00:00
2020-02-16 13:57:54 +00:00
/**
* Generic engine, is usually either diesel, steam or electric.
*
* @author Arne Keller
* @version 1.0
*/
2020-02-15 14:17:23 +00:00
public abstract class Engine extends RollingStock {
2020-02-15 15:38:54 +00:00
/**
* Series/class of this engine.
*/
2020-02-17 10:19:56 +00:00
private String series;
2020-02-15 15:38:54 +00:00
/**
* Name of this engine.
*/
2020-02-17 10:19:56 +00:00
private String name;
protected Engine(final String series, final String name, final int length,
final boolean couplingFront, final boolean couplingBack) {
super(length, couplingFront, couplingBack);
this.series = series;
this.name = name;
}
2020-02-15 14:17:23 +00:00
2020-02-16 13:57:54 +00:00
/**
* @return the name of this engine
*/
2020-02-15 14:17:23 +00:00
public String getName() {
return name;
}
2020-02-17 10:19:56 +00:00
/**
* @return the series of this engine
*/
public String getSeries() {
return series;
}
2020-02-15 14:17:23 +00:00
@Override
public String getIdentifier() {
return String.format("%s-%s", series, getName());
}
@Override
public boolean canCoupleTo(RollingStock rollingStock) {
return true;
2020-02-15 14:17:23 +00:00
}
}