Package jmri.jmrix.openlcb
Class OlcbLight
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractLight
-
- jmri.jmrix.openlcb.OlcbLight
-
- All Implemented Interfaces:
java.lang.Comparable<NamedBean>
,PropertyChangeProvider
,DigitalIO
,Light
,NamedBean
public final class OlcbLight extends AbstractLight
-
-
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) OlcbAddress
addrOff
(package private) OlcbAddress
addrOn
(package private) static boolean
DEFAULT_IS_AUTHORITATIVE
(package private) static boolean
DEFAULT_LISTEN
(package private) VersionedValueListener<java.lang.Boolean>
lightListener
(package private) BitProducerConsumer
pc
-
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 OlcbLight(java.lang.String prefix, java.lang.String address, CanSystemConnectionMemo memo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activateLight()
Activate a light activating all its LightControl objects.void
dispose()
Deactivate this object, so that it releases as many resources as possible and no longer effects others.protected void
doNewState(int oldState, int newState)
Set the current state of this Light This routine requests the hardware to change to newState.(package private) void
finishLoad()
Helper function that will be invoked after construction once the properties have been loaded.java.lang.String
getRecommendedToolTip()
Get a recommended text for a tooltip when displaying the NamedBean, e.g. in a list or table.void
setProperty(java.lang.String key, java.lang.Object value)
Attach a key/value pair to the NamedBean, which can be retrieved later.void
setState(int newState)
Handle a request for a state change.-
Methods inherited from class jmri.implementation.AbstractLight
addLightControl, clearLightControls, deactivateLight, describeState, getBeanType, getEnabled, getLightControlList, getState, getUsageReport, notifyStateChange, notifyTargetIntensityChange, setEnabled
-
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, equals, firePropertyChange, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, hashCode, removeProperty, removePropertyChangeListener, removePropertyChangeListener, setComment, 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, compareSystemNameSuffix, compareTo, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, removeProperty, setComment, setUserName, toString, updateListenerRef, vetoableChange
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
DEFAULT_IS_AUTHORITATIVE
static final boolean DEFAULT_IS_AUTHORITATIVE
- See Also:
- Constant Field Values
-
DEFAULT_LISTEN
static final boolean DEFAULT_LISTEN
- See Also:
- Constant Field Values
-
addrOn
OlcbAddress addrOn
-
addrOff
OlcbAddress addrOff
-
lightListener
VersionedValueListener<java.lang.Boolean> lightListener
-
-
Constructor Detail
-
OlcbLight
public OlcbLight(java.lang.String prefix, java.lang.String address, CanSystemConnectionMemo memo)
-
-
Method Detail
-
finishLoad
void finishLoad()
Helper function that will be invoked after construction once the properties have been loaded. Used specifically for preventing double initialization when loading lights from XML.
-
getRecommendedToolTip
@CheckReturnValue @Nonnull public java.lang.String getRecommendedToolTip()
Description copied from interface:NamedBean
Get a recommended text for a tooltip when displaying the NamedBean, e.g. in a list or table. By default, this is the comment from the NamedBean, on the theory that the system name and/or user name are being displayed directly. Specific system implementations may override that.
-
activateLight
public void activateLight()
Activate a light activating all its LightControl objects.- Specified by:
activateLight
in interfaceLight
- Overrides:
activateLight
in classAbstractLight
-
setState
public void setState(int newState)
Handle a request for a state change. For these lights, ON and OFF just transition immediately between MinIntensity and MaxIntensity. Ignores any outputDelay setting for connection.
-
doNewState
protected void doNewState(int oldState, int newState)
Set the current state of this Light This routine requests the hardware to change to newState.- Overrides:
doNewState
in classAbstractLight
- Parameters:
oldState
- old statenewState
- new state
-
setProperty
public void setProperty(@Nonnull java.lang.String key, java.lang.Object value)
Attach a key/value pair to the NamedBean, which can be retrieved later. These are not bound properties as yet, and don't throw events on modification. Key must not be null.The key is constrained to String to make these behave like normal Java Beans.
- Specified by:
setProperty
in interfaceNamedBean
- Overrides:
setProperty
in classAbstractNamedBean
- Parameters:
key
- the property to setvalue
- the value of the property
-
dispose
public void dispose()
Deactivate this object, so that it releases as many resources as possible and no longer effects others.For example, if this object has listeners, after a call to this method it should no longer notify those listeners. Any native or system-wide resources it maintains should be released, including threads, files, etc.
It is an error to invoke any other methods on this object once dispose() has been called. Note, however, that there is no guarantee about behavior in that case.
Afterwards, references to this object may still exist elsewhere, preventing its garbage collection. But it's formally dead, and shouldn't be keeping any other objects alive. Therefore, this method should null out any references to other objects that this NamedBean contained.
- Specified by:
dispose
in interfaceNamedBean
- Overrides:
dispose
in classAbstractNamedBean
-
-