Package jmri.jmrix

Class AbstractMRNodeTrafficController

java.lang.Object
jmri.jmrix.AbstractMRTrafficController
jmri.jmrix.AbstractMRNodeTrafficController
Direct Known Subclasses:
AcelaTrafficController, IEEE802154TrafficController, SerialTrafficController, SerialTrafficController, SerialTrafficController, SerialTrafficController, SerialTrafficController

public abstract class AbstractMRNodeTrafficController
extends AbstractMRTrafficController
Abstract Traffic Controller base class for those implementations that track a set of nodes.

The nodes are descendents of AbstractNode. Provides node management services, but no additional protocol.

  • Field Details

  • Constructor Details

  • Method Details

    • init

      protected void init​(int minNode, int maxNode)
      Initialize based on number of first and last nodes.
      Parameters:
      minNode - lowest node number, usually 0
      maxNode - highest node number
    • getMustInit

      protected boolean getMustInit​(int i)
      Does a given node need to have initialization data sent?
      Parameters:
      i - the node address (number)
      Returns:
      true if initialization data is required
    • setMustInit

      protected void setMustInit​(int i, boolean v)
      Mark whether a given node needs to have initialization data sent.
      Parameters:
      i - the node index
      v - true if set to require sending initialization data
    • setMustInit

      protected void setMustInit​(AbstractNode node, boolean v)
    • getNumNodes

      public int getNumNodes()
      Get the total number of currently registered nodes.
      Returns:
      the number of registerd nodes on this connection
    • registerNode

      public void registerNode​(AbstractNode node)
      Register a Serial node on this TrafficController.
      Parameters:
      node - the node object to register
    • getNode

      public AbstractNode getNode​(int index)
      Get the Serial node for a given index as registered with this TrafficController.
      Parameters:
      index - the index number of the node. To cycle through all nodes, begin with index=0, and increment your index at each call.
      Returns:
      the node at index, 'null' when index exceeds the number of defined nodes
    • getNodeFromAddress

      public AbstractNode getNodeFromAddress​(int addr)
      Identify a SerialNode from its node address.
      Parameters:
      addr - the node address, numbered from 0
      Returns:
      the node at node address, 'null' if a SerialNode with the specified address was not found
    • deleteNode

      public void deleteNode​(int nodeAddress)
      Delete a SerialNode by node address.
      Parameters:
      nodeAddress - address number for the node to be deleted