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

50 lines
1.0 KiB
Java

package edu.kit.informatik.model;
/**
* Generic engine, is usually either diesel, steam or electric.
*
* @author Arne Keller
* @version 1.0
*/
public abstract class Engine extends RollingStock {
/**
* Series/class of this engine.
*/
private String series;
/**
* Name of this engine.
*/
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;
}
/**
* @return the name of this engine
*/
public String getName() {
return name;
}
/**
* @return the series of this engine
*/
public String getSeries() {
return series;
}
@Override
public String getIdentifier() {
return String.format("%s-%s", series, getName());
}
@Override
public boolean canCoupleTo(RollingStock rollingStock) {
return true;
}
}