Package jmri.implementation
Class DoubleTurnoutSignalHead
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractSignalHead
-
- jmri.implementation.DefaultSignalHead
-
- jmri.implementation.DoubleTurnoutSignalHead
-
- All Implemented Interfaces:
java.beans.VetoableChangeListener
,java.lang.Comparable<NamedBean>
,java.util.EventListener
,PropertyChangeProvider
,NamedBean
,Signal
,SignalHead
- Direct Known Subclasses:
TripleOutputSignalHead
,TripleTurnoutSignalHead
public class DoubleTurnoutSignalHead extends DefaultSignalHead
Drive a single signal head via two "Turnout" objects.After much confusion, the user-level terminology was changed to call these "Double Output"; the class name remains the same to reduce recoding.
The two Turnout objects are provided during construction, and each drives a specific color (RED and GREEN). Normally, "THROWN" is on, and "CLOSED" is off. YELLOW is provided by turning both on ("THROWN")
This class also listens to the Turnouts to see if they've been changed via some other mechanism.
-
-
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) NamedBeanHandle<Turnout>
mGreen
(package private) int
mGreenCommanded
(package private) NamedBeanHandle<Turnout>
mRed
(package private) int
mRedCommanded
(package private) javax.swing.Timer
readUpdateTimer
-
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 DoubleTurnoutSignalHead(java.lang.String sys, java.lang.String user, NamedBeanHandle<Turnout> green, NamedBeanHandle<Turnout> red)
DoubleTurnoutSignalHead(java.lang.String sys, NamedBeanHandle<Turnout> green, NamedBeanHandle<Turnout> red)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
commandState(int red, int green)
Sets the output turnouts' commanded state.void
dispose()
Remove references to and from this object, so that it can eventually be garbage-collected.NamedBeanHandle<Turnout>
getGreen()
NamedBeanHandle<Turnout>
getRed()
boolean
isTurnoutUsed(Turnout t)
Check if a given turnout is used on this head.(package private) void
readOutput()
Checks if the turnouts' output state matches the commanded output state; if not, then changes the appearance to match the output's current state.void
setGreen(NamedBeanHandle<Turnout> t)
void
setRed(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, getValidStateKeys, getValidStateNames, getValidStates, 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
-
-
-
-
Field Detail
-
mRed
NamedBeanHandle<Turnout> mRed
-
mGreen
NamedBeanHandle<Turnout> mGreen
-
mRedCommanded
int mRedCommanded
-
mGreenCommanded
int mGreenCommanded
-
readUpdateTimer
javax.swing.Timer readUpdateTimer
-
-
Constructor Detail
-
DoubleTurnoutSignalHead
public DoubleTurnoutSignalHead(java.lang.String sys, java.lang.String user, NamedBeanHandle<Turnout> green, NamedBeanHandle<Turnout> red)
-
DoubleTurnoutSignalHead
public DoubleTurnoutSignalHead(java.lang.String sys, NamedBeanHandle<Turnout> green, NamedBeanHandle<Turnout> red)
-
-
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
-
commandState
void commandState(int red, int green)
Sets the output turnouts' commanded state.- Parameters:
red
- state to set the mRed turnoutgreen
- state to set the mGreen turnout.
-
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
-
getRed
public NamedBeanHandle<Turnout> getRed()
-
getGreen
public NamedBeanHandle<Turnout> getGreen()
-
setRed
public void setRed(NamedBeanHandle<Turnout> t)
-
setGreen
public void setGreen(NamedBeanHandle<Turnout> t)
-
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
-
readOutput
void readOutput()
Checks if the turnouts' output state matches the commanded output state; if not, then changes the appearance to match the output's current state.
-
-