Class SerialLight

All Implemented Interfaces:
Comparable<NamedBean>, PropertyChangeProvider, DigitalIO, Light, NamedBean

public class SerialLight extends AbstractLight
SerialLight.java Implementation of the Light Object for C/MRI

Based in part on SerialTurnout.java

  • Field Details

  • Constructor Details

    • SerialLight

      public SerialLight(String systemName, CMRISystemConnectionMemo memo)
      Create a Light object, with only system name.

      'systemName' was previously validated in SerialLightManager

      Parameters:
      systemName - light system name.
      memo - system connection.
    • SerialLight

      public SerialLight(String systemName, String userName, CMRISystemConnectionMemo memo)
      Create a Light object, with both system and user names.

      'systemName' was previously validated in SerialLightManager

      Parameters:
      systemName - light system name.
      userName - light username.
      memo - system connection.
  • Method Details

    • doNewState

      protected void doNewState(int oldState, int newState)
      Set the current state of this Light This routine requests the hardware to change. If this is really a change in state of this bit (tested in SerialNode), a Transmit packet will be sent before this Node is next polled.
      Overrides:
      doNewState in class AbstractLight
      Parameters:
      oldState - old state
      newState - new state
    • compareSystemNameSuffix

      Compare the suffix of this NamedBean's name with the suffix of the argument NamedBean's name for the NamedBean.compareTo(jmri.NamedBean) operation. This is intended to be a system-specific comparison that understands the various formats, etc. By default, does an alphanumeric-by-chunks comparison. Sorts by node number and then by bit
      Specified by:
      compareSystemNameSuffix in interface NamedBean
      Overrides:
      compareSystemNameSuffix in class AbstractNamedBean
      Parameters:
      suffix1 - The suffix for the 1st bean in the comparison
      suffix2 - The suffix for the 2nd bean in the comparison
      n - The other (second) NamedBean in the comparison
      Returns:
      -1,0,+1 for ordering if the names are well-formed; may not provide proper ordering if the names are not well-formed.