Package jmri.jmrix.cmri.serial
Class SerialLight
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractLight
-
- jmri.jmrix.cmri.serial.SerialLight
-
- All Implemented Interfaces:
java.lang.Comparable<NamedBean>
,PropertyChangeProvider
,DigitalIO
,Light
,NamedBean
public class SerialLight extends AbstractLight
SerialLight.java Implementation of the Light Object for C/MRIBased in part on SerialTurnout.java
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException
-
-
Field Summary
Fields Modifier and Type Field Description (package private) CMRISystemConnectionMemo
_memo
(package private) int
mBit
System dependent instance variables-
Fields inherited from class jmri.implementation.AbstractLight
lightControlList, mActive, mCurrentIntensity, mEnabled, mMaxIntensity, mMinIntensity, mState
-
Fields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, register
-
Fields inherited from interface jmri.Light
FAST_CLOCK_CONTROL, INTERMEDIATE, NO_CONTROL, SENSOR_CONTROL, TIMED_ON_CONTROL, TRANSITIONING, TRANSITIONINGHIGHER, TRANSITIONINGLOWER, TRANSITIONINGTOFULLOFF, TRANSITIONINGTOFULLON, TURNOUT_STATUS_CONTROL, TWO_SENSOR_CONTROL
-
Fields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_STATE, QUOTED_NAME_FORMAT, UNKNOWN
-
-
Constructor Summary
Constructors Constructor Description SerialLight(java.lang.String systemName, java.lang.String userName, CMRISystemConnectionMemo memo)
Create a Light object, with both system and user names.SerialLight(java.lang.String systemName, CMRISystemConnectionMemo memo)
Create a Light object, with only system name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareSystemNameSuffix(java.lang.String suffix1, java.lang.String suffix2, NamedBean n)
Compare the suffix of this NamedBean's name with the suffix of the argument NamedBean's name for theNamedBean.compareTo(jmri.NamedBean)
operation.protected void
doNewState(int oldState, int newState)
Set the current state of this Light This routine requests the hardware to change.-
Methods inherited from class jmri.implementation.AbstractLight
activateLight, addLightControl, clearLightControls, deactivateLight, describeState, getBeanType, getEnabled, getLightControlList, getState, getUsageReport, notifyStateChange, notifyTargetIntensityChange, setEnabled, setState
-
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, dispose, equals, firePropertyChange, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, hashCode, removeProperty, removePropertyChangeListener, removePropertyChangeListener, setComment, setProperty, setUserName, toString, toStringSuffix, updateListenerRef, vetoableChange
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jmri.Light
getCommandedState, getKnownState, isConsistentState, requestUpdateFromLayout, setCommandedState
-
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareTo, dispose, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getSystemName, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef, vetoableChange
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
mBit
int mBit
System dependent instance variables
-
-
Constructor Detail
-
SerialLight
public SerialLight(java.lang.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(java.lang.String systemName, java.lang.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 Detail
-
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 classAbstractLight
- Parameters:
oldState
- old statenewState
- new state
-
compareSystemNameSuffix
@CheckReturnValue public int compareSystemNameSuffix(@Nonnull java.lang.String suffix1, @Nonnull java.lang.String suffix2, @Nonnull NamedBean n)
Compare the suffix of this NamedBean's name with the suffix of the argument NamedBean's name for theNamedBean.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 interfaceNamedBean
- Overrides:
compareSystemNameSuffix
in classAbstractNamedBean
- Parameters:
suffix1
- The suffix for the 1st bean in the comparisonsuffix2
- The suffix for the 2nd bean in the comparisonn
- 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.
-
-