package edu.kit.informatik.model; import edu.kit.informatik.ui.InvalidInputException; /** * 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 final String series; /** * Name of this engine. */ private final String name; /** * Initialize an engine. * @param series series/class of this engine * @param name name of this engine * @param length length of this engine * @param couplingFront whether this engine should have a front coupling * @param couplingBack whether this engine should have a back coupling * @throws InvalidInputException on invalid user input (zero-sized coach) */ protected Engine(final String series, final String name, final int length, final boolean couplingFront, final boolean couplingBack) throws InvalidInputException { 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; } }