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-15 14:17:23 +00:00
|
|
|
protected String series;
|
2020-02-15 15:38:54 +00:00
|
|
|
/**
|
|
|
|
* Name of this engine.
|
|
|
|
*/
|
2020-02-15 14:17:23 +00:00
|
|
|
protected String name;
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getIdentifier() {
|
|
|
|
return String.format("%s-%s", series, getName());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canCoupleFrontTo(RollingStock rollingStock) {
|
|
|
|
// train-sets can ONLY connect to other matching train-sets, not to engines.
|
|
|
|
return hasCouplingFront() && rollingStock.hasCouplingBack() && !(rollingStock instanceof TrainSet);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canCoupleToTrainSetSeries(String series) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|