Package jmri

Interface Consist

  • All Known Implementing Classes:
    DccConsist, EasyDccConsist, LocoNetConsist, MqttConsist, NceConsist, NmraConsist, WiFiConsist, XNetConsist

    public interface Consist
    Interface for a Consist Object, describing one or more cooperatively-operating locomotives.
    This file is part of JMRI.

    JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.

    JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

    • Method Detail

      • dispose

        void dispose()
        A method for cleaning up the consist
      • setConsistType

        void setConsistType​(int consist_type)
        Set the Consist Type.
        Parameters:
        consist_type - the consist type
      • getConsistType

        int getConsistType()
        Get the Consist Type.
        Returns:
        the consist type
      • isAddressAllowed

        boolean isAddressAllowed​(DccLocoAddress address)
        Is the specific address allowed? (needed for system specific restrictions)
        Parameters:
        address - the address
        Returns:
        true if allowed; false otherwise
      • sizeLimit

        int sizeLimit()
        Is there a size limit for this type of consist?
        Returns:
        -1 if no limit; 0 if the Consist Type is not supported; or the total number of usable spaces if the consist has a limit (do not subtract used spaces).
      • getConsistList

        java.util.ArrayList<DccLocoAddressgetConsistList()
        Get a list of the locomotives in the consist.
        Returns:
        the list of addresses
      • contains

        boolean contains​(DccLocoAddress address)
        Does the consist contain the specified locomotive address?
        Parameters:
        address - the address to check
        Returns:
        true if in consist; false otherwise
      • getLocoDirection

        boolean getLocoDirection​(DccLocoAddress address)
        Get the relative direction setting for a specific locomotive in the consist.
        Parameters:
        address - the address to check
        Returns:
        true if locomotive is in consist in its normal direction of travel; false otherwise
      • add

        void add​(DccLocoAddress address,
                 boolean directionNormal)
        Add a Locomotive to a Consist
        Parameters:
        address - is the Locomotive address to add to the locomotive
        directionNormal - is True if the locomotive is traveling the same direction as the consist, or false otherwise.
      • restore

        void restore​(DccLocoAddress address,
                     boolean directionNormal)
        Restore a Locomotive to a Consist, but don't write to the command station. This is used for restoring the consist from a file or adding a consist read from the command station.
        Parameters:
        address - is the Locomotive address to add to the consist
        directionNormal - is True if the locomotive is traveling the same direction as the consist, or false otherwise.
      • remove

        void remove​(DccLocoAddress address)
        Remove a Locomotive from this Consist
        Parameters:
        address - is the Locomotive address to add to the locomotive
      • setPosition

        void setPosition​(DccLocoAddress address,
                         int position)
        Set the position of a locomotive within the consist
        Parameters:
        address - is the Locomotive address
        position - is a constant representing the position within the consist.
      • getPosition

        int getPosition​(DccLocoAddress address)
        Get the position of a locomotive within the consist
        Parameters:
        address - is the Locomotive address of interest
        Returns:
        integer equal to jmri.Consist.POSITION_LEAD for the designated lead locomotive. equal to jmri.Consist.POSITION_TRAIL for the designated trailing locomotive. between 1 and 254 for other locomotives in the consist
      • setRosterId

        void setRosterId​(DccLocoAddress address,
                         java.lang.String rosterId)
        Set the roster entry of a locomotive within the consist
        Parameters:
        address - is the Locomotive address
        rosterId - is the roster Identifer of the associated roster entry.
      • getRosterId

        java.lang.String getRosterId​(DccLocoAddress address)
        Get the rosterId of a locomotive within the consist
        Parameters:
        address - is the Locomotive address of interest
        Returns:
        string roster Identifier associated with the given address in the consist. Returns null if no roster entry is associated with this entry.
      • setConsistID

        void setConsistID​(java.lang.String ID)
        Set the text ID associated with the consist
        Parameters:
        ID - is a string identifier for the consist
      • getConsistID

        java.lang.String getConsistID()
        Get the text ID associated with the consist
        Returns:
        String identifier for the consist default value is the string Identifier for the consist address.
      • reverse

        void reverse()
        Reverse the order of the consist and the direction the locomotives are traveling
      • restore

        void restore()
        restore the consist to the command station.