mirror of
https://gitlab.com/arnekeller/kit-programmieren-ws1920-final1.git
synced 2024-11-24 17:34:58 +00:00
27 lines
696 B
Java
27 lines
696 B
Java
|
package edu.kit.informatik;
|
||
|
|
||
|
public abstract class Engine extends RollingStock {
|
||
|
protected String series;
|
||
|
protected String name;
|
||
|
|
||
|
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;
|
||
|
}
|
||
|
}
|