Class Engine

    • Constructor Detail

      • Engine

        public Engine​(java.lang.String road,
                      java.lang.String number)
      • Engine

        public Engine​(Element e)
        Construct this Entry from XML. This member has to remain synchronized with the detailed DTD in operations-engines.dtd
        Parameters:
        e - Engine XML element
    • Method Detail

      • setModel

        public void setModel​(java.lang.String model)
        Set the locomotive's model. Note a model has only one length, type, and horsepower rating.
        Parameters:
        model - The string model name.
      • getModel

        public java.lang.String getModel()
      • setTypeName

        public void setTypeName​(java.lang.String type)
        Set the locomotive type for this locomotive's model
        Overrides:
        setTypeName in class RollingStock
        Parameters:
        type - Locomotive type: Steam, Diesel, Gas Turbine, etc.
      • setHp

        public void setHp​(java.lang.String hp)
        Set the locomotive horsepower rating for this locomotive's model
        Parameters:
        hp - locomotive horsepower
      • getHp

        public java.lang.String getHp()
      • setWeightTons

        public void setWeightTons​(java.lang.String weight)
        Set the locomotive weight for this locomotive's model
        Overrides:
        setWeightTons in class RollingStock
        Parameters:
        weight - locomotive weight
      • setBunit

        public void setBunit​(boolean bUnit)
      • isBunit

        public boolean isBunit()
      • setConsist

        public void setConsist​(Consist consist)
        Place locomotive in a consist
        Parameters:
        consist - The Consist to use.
      • getConsist

        public Consist getConsist()
        Get the consist for this locomotive
        Returns:
        null if locomotive isn't in a consist
      • isLead

        public boolean isLead()
        Used to determine if engine is lead engine in a consist
        Returns:
        true if lead engine in a consist
      • getDccAddress

        public java.lang.String getDccAddress()
        Get the DCC address for this engine from the JMRI roster. Does 4 attempts, 1st by road and number, 2nd by number, 3rd by dccAddress using the engine's road number, 4th by id.
        Returns:
        dccAddress
      • getRosterEntry

        public RosterEntry getRosterEntry()
        Get the RosterEntry for this engine from the JMRI roster. Does 4 attempts, 1st by road and number, 2nd by number, 3rd by dccAddress using the engine's road number, 4th by id.
        Returns:
        RosterEntry, can be null
      • checkDestination

        public java.lang.String checkDestination​(Location destination,
                                                 Track track)
        Used to check destination track to see if it will accept locomotive
        Overrides:
        checkDestination in class RollingStock
        Parameters:
        destination - The Location.
        track - The Track at destination.
        Returns:
        status, see RollingStock.java
      • moveRollingStock

        protected void moveRollingStock​(RouteLocation current,
                                        RouteLocation next)
        Determine if there's a change in the lead locomotive. There are two possible locations in a train's route. TODO this code places the last loco added to the train as the lead. It would be better if the first one became the lead loco.
        Overrides:
        moveRollingStock in class RollingStock
      • store

        public Element store()
        Create an XML element to represent this Entry. This member has to remain synchronized with the detailed DTD in operations-engines.dtd.
        Returns:
        Contents in a JDOM Element
      • propertyChange

        public void propertyChange​(java.beans.PropertyChangeEvent e)
        Specified by:
        propertyChange in interface java.beans.PropertyChangeListener
        Overrides:
        propertyChange in class RollingStock