Class XNetConsist

    • Constructor Detail

      • XNetConsist

        public XNetConsist​(int address,
                           XNetTrafficController controller,
                           XNetSystemConnectionMemo systemMemo)
        Initialize a consist for the specific address. Default consist type is an advanced consist.
        Parameters:
        address - loco address.
        controller - system connection traffic controller.
        systemMemo - system connection.
    • Method Detail

      • setConsistType

        public void setConsistType​(int consistType)
        Set the Consist Type.
        Specified by:
        setConsistType in interface Consist
        Overrides:
        setConsistType in class DccConsist
        Parameters:
        consistType - An integer, should be either jmri.Consist.ADVANCED_CONSIST or jmri.Consist.CS_CONSIST.
      • isAddressAllowed

        public boolean isAddressAllowed​(DccLocoAddress address)
        Is this address allowed?

        On Lenz systems, All addresses but 0 can be used in a consist (Either and Advanced Consist or a Double Header). Is this address allowed? Since address 00 is an analog locomotive, we can't program CV19 to include it in a consist, but all other addresses are ok.

        Specified by:
        isAddressAllowed in interface Consist
        Overrides:
        isAddressAllowed in class DccConsist
        Parameters:
        address - DccLocoAddress object to check.
        Returns:
        true if allowed; false otherwise
      • sizeLimit

        public int sizeLimit()
        Is there a size limit for this consist?
        Specified by:
        sizeLimit in interface Consist
        Overrides:
        sizeLimit in class DccConsist
        Returns:
        2 For Lenz double headers. -1 (no limit) For Decoder Assisted Consists. 0 for any other consist type.
      • contains

        public boolean contains​(DccLocoAddress address)
        Does the consist contain the specified address? Does the consist contain the specified locomotive address?
        Specified by:
        contains in interface Consist
        Overrides:
        contains in class DccConsist
        Parameters:
        address - DccLocoAddress object to check.
        Returns:
        true if in consist; false otherwise
      • add

        public void add​(DccLocoAddress locoAddress,
                        boolean directionNormal)
        Add a Locomotive to a Consist.
        Specified by:
        add in interface Consist
        Overrides:
        add in class DccConsist
        Parameters:
        locoAddress - 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

        public void restore​(DccLocoAddress locoAddress,
                            boolean directionNormal)
        Restore a Locomotive to an Advanced 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.

        Specified by:
        restore in interface Consist
        Overrides:
        restore in class DccConsist
        Parameters:
        locoAddress - the Locomotive address to add to the locomotive
        directionNormal - True if the locomotive is traveling the same direction as the Consist, or false otherwise.
      • remove

        public void remove​(DccLocoAddress locoAddress)
        Remove a Locomotive from this Consist.
        Specified by:
        remove in interface Consist
        Overrides:
        remove in class DccConsist
        Parameters:
        locoAddress - the Locomotive address to add to the Consist
      • addToAdvancedConsist

        protected void addToAdvancedConsist​(DccLocoAddress locoAddress,
                                            boolean directionNormal)
        Add a Locomotive to an Advanced Consist.
        Overrides:
        addToAdvancedConsist in class DccConsist
        Parameters:
        locoAddress - 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.
      • removeFromCSConsist

        public void removeFromCSConsist​(DccLocoAddress locoAddress)
        Remove a Locomotive from a Lenz Double Header.locoAddress
        Parameters:
        locoAddress - is the Locomotive address, unused here.
      • message

        public void message​(XNetReply l)
        Listeners for messages from the command station.
        Specified by:
        message in interface XNetListener
        Parameters:
        l - The received XNet message. Note that this same object may be presented to multiple users. It should not be modified here.
      • message

        public void message​(XNetMessage l)
        Description copied from interface: XNetListener
        Member function that will be invoked by an XNetInterface implementation to forward an XNet message sent to the layout. Normally, this function will do nothing.
        Specified by:
        message in interface XNetListener
        Parameters:
        l - The received XNet message. Note that this same object may be presented to multiple users. It should not be modified here.
      • notifyTimeout

        public void notifyTimeout​(XNetMessage msg)
        Description copied from interface: XNetListener
        Member function invoked by an XNetInterface implementation to notify a sender that an outgoing message timed out and was dropped from the queue.
        Specified by:
        notifyTimeout in interface XNetListener
        Parameters:
        msg - message which has timed out.