Package jmri.implementation
Class SingleTurnoutSignalHead
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractSignalHead
-
- jmri.implementation.DefaultSignalHead
-
- jmri.implementation.SingleTurnoutSignalHead
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.beans.VetoableChangeListener
,java.lang.Comparable<NamedBean>
,java.util.EventListener
,PropertyChangeProvider
,NamedBean
,Signal
,SignalHead
public class SingleTurnoutSignalHead extends DefaultSignalHead implements java.beans.PropertyChangeListener
Drive a single signal head via one "Turnout" object.After much confusion, the user-level terminology was changed to call these "Single Output"; the class name remains the same to reduce recoding.
One Turnout object is provided during construction, and drives the appearance to be either ON or OFF. Normally, "THROWN" is on, and "CLOSED" is off. The facility to set the appearance via any of the basic four appearance colors + Lunar is provided, however they all do the same.
Based upon DoubleTurnoutSignalHead by Bob Jacobsen
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException
-
-
Field Summary
-
Fields inherited from class jmri.implementation.DefaultSignalHead
delay, masterDelay, mFlashOn, timer
-
Fields inherited from class jmri.implementation.AbstractSignalHead
mAppearance, mHeld, mLit
-
Fields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, register
-
Fields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_STATE, QUOTED_NAME_FORMAT, UNKNOWN
-
Fields inherited from interface jmri.SignalHead
DARK, FLASHGREEN, FLASHLUNAR, FLASHRED, FLASHYELLOW, GREEN, HELD, LUNAR, RED, YELLOW
-
-
Constructor Summary
Constructors Constructor Description SingleTurnoutSignalHead(java.lang.String sys, java.lang.String user, NamedBeanHandle<Turnout> lit, int on, int off)
Ctor including user name.SingleTurnoutSignalHead(java.lang.String sys, NamedBeanHandle<Turnout> lit, int on, int off)
Ctor using only a system name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Remove references to and from this object, so that it can eventually be garbage-collected.int
getOffAppearance()
int
getOnAppearance()
NamedBeanHandle<Turnout>
getOutput()
java.lang.String[]
getValidStateKeys()
Get an array of non-localized appearance keys valid for the mast type.java.lang.String[]
getValidStateNames()
Get an array of localized appearance descriptions valid for the mast type.int[]
getValidStates()
Get an array of appearance indexes valid for the mast type.boolean
isTurnoutUsed(Turnout t)
Check if a given turnout is used on this head.void
propertyChange(java.beans.PropertyChangeEvent evt)
void
setOffAppearance(int off)
void
setOnAppearance(int on)
void
setOutput(NamedBeanHandle<Turnout> t)
protected void
updateOutput()
Type-specific routine to handle output to the layout hardware.-
Methods inherited from class jmri.implementation.DefaultSignalHead
appearanceSetsFlashTimer, getUsageReport, setAppearance, setHeld, setLit, startFlash, stopFlash
-
Methods inherited from class jmri.implementation.AbstractSignalHead
getAppearance, getAppearanceKey, getAppearanceKey, getAppearanceName, getAppearanceName, getBeanType, getDefaultStateName, getDefaultValidStateNames, getDefaultValidStates, getHeld, getLit, getState, isAtStop, isCleared, isShowingRestricting, setState, vetoableChange
-
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, describeState, 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
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, describeState, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Constructor Detail
-
SingleTurnoutSignalHead
public SingleTurnoutSignalHead(java.lang.String sys, java.lang.String user, NamedBeanHandle<Turnout> lit, int on, int off)
Ctor including user name.- Parameters:
sys
- system name for headuser
- userName user name for headlit
- named bean for turnout switching the Lit propertyon
- Appearance constant fromSignalHead
for the output on (Turnout thrown) appearanceoff
- Appearance constant fromSignalHead
for the signal off (Turnout closed) appearance
-
SingleTurnoutSignalHead
public SingleTurnoutSignalHead(java.lang.String sys, NamedBeanHandle<Turnout> lit, int on, int off)
Ctor using only a system name.- Parameters:
sys
- system name for headlit
- named bean for turnout switching the Lit propertyon
- Appearance constant fromSignalHead
for the output on (Turnout thrown) appearanceoff
- Appearance constant fromSignalHead
for the signal off (Turnout closed) appearance
-
-
Method Detail
-
updateOutput
protected void updateOutput()
Description copied from class:DefaultSignalHead
Type-specific routine to handle output to the layout hardware.Does not notify listeners of changes; that's done elsewhere. Should use the following variables to determine what to send:
- mAppearance
- mLit
- mFlashOn
- Specified by:
updateOutput
in classDefaultSignalHead
-
dispose
public void dispose()
Remove references to and from this object, so that it can eventually be garbage-collected.- Specified by:
dispose
in interfaceNamedBean
- Overrides:
dispose
in classAbstractNamedBean
-
getOnAppearance
public int getOnAppearance()
-
getOffAppearance
public int getOffAppearance()
-
setOnAppearance
public void setOnAppearance(int on)
-
setOffAppearance
public void setOffAppearance(int off)
-
getOutput
public NamedBeanHandle<Turnout> getOutput()
-
setOutput
public void setOutput(NamedBeanHandle<Turnout> t)
-
getValidStates
public int[] getValidStates()
Get an array of appearance indexes valid for the mast type.- Specified by:
getValidStates
in interfaceSignalHead
- Overrides:
getValidStates
in classDefaultSignalHead
- Returns:
- array of appearance state values available on this mast type
-
getValidStateKeys
public java.lang.String[] getValidStateKeys()
Get an array of non-localized appearance keys valid for the mast type. For GUI application consider using (capitalized)SignalHead.getValidStateNames()
- Specified by:
getValidStateKeys
in interfaceSignalHead
- Overrides:
getValidStateKeys
in classDefaultSignalHead
- Returns:
- array of translated appearance names available on this mast type
-
getValidStateNames
public java.lang.String[] getValidStateNames()
Get an array of localized appearance descriptions valid for the mast type. For persistance and comparison consider usingSignalHead.getValidStateKeys()
- Specified by:
getValidStateNames
in interfaceSignalHead
- Overrides:
getValidStateNames
in classDefaultSignalHead
- Returns:
- array of translated appearance names
-
isTurnoutUsed
public boolean isTurnoutUsed(Turnout t)
Description copied from class:AbstractSignalHead
Check if a given turnout is used on this head.- Overrides:
isTurnoutUsed
in classDefaultSignalHead
- Parameters:
t
- Turnout object to check- Returns:
- true if turnout is configured as output or driver of head
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
-