package edu.kit.informatik; /** * 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. */ protected String series; /** * Name of this engine. */ protected String name; /** * @return the name of this engine */ 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; } }