Class SE8cSignalHead
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractSignalHead
-
- jmri.implementation.DefaultSignalHead
-
- jmri.implementation.SE8cSignalHead
-
- All Implemented Interfaces:
java.beans.VetoableChangeListener
,java.lang.Comparable<NamedBean>
,java.util.EventListener
,PropertyChangeProvider
,NamedBean
,Signal
,SignalHead
public class SE8cSignalHead extends DefaultSignalHead
Extend jmri.SignalHead for signals implemented by an SE8C.This implementation writes out to the physical signal when it's commanded to change appearance, and updates its internal state when it hears commands from other places.
To get a complete set of aspects, we assume that the SE8C board has been configured such that the 4th aspect is "dark". We then do flashing aspects by commanding the lit appearance to change.
We can't assume any form of numbering for Turnouts to address the digits, so we take two turnout names as arguments. As a convenience, we manage the user names if they're not already set.
Only the DARK, RED, GREEN and YELLOW appearances will be properly tracked when they occur on the LocoNet. The FLASHING aspects won't be, nor will the Held or Lit states.
The algorithms in this class are a collaborative effort of Digitrax, Inc and 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 Modifier and Type Field Description (package private) NamedBeanHandle<Turnout>
highTurnout
(package private) NamedBeanHandle<Turnout>
lowTurnout
-
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 SE8cSignalHead(int pNumber)
Compatibility ctorSE8cSignalHead(int pNumber, java.lang.String userName)
Compatibility ctor.SE8cSignalHead(java.lang.String sname, NamedBeanHandle<Turnout> lowTO, NamedBeanHandle<Turnout> highTO)
Ctor specifying system name.SE8cSignalHead(java.lang.String sname, NamedBeanHandle<Turnout> lowTO, NamedBeanHandle<Turnout> highTO, java.lang.String userName)
Ctor specifying system name and user name.SE8cSignalHead(NamedBeanHandle<Turnout> lowTO, NamedBeanHandle<Turnout> highTO)
Primary ctor without user name.SE8cSignalHead(NamedBeanHandle<Turnout> lowTO, NamedBeanHandle<Turnout> highTO, java.lang.String userName)
Primary ctor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description NamedBeanHandle<Turnout>
getHigh()
NamedBeanHandle<Turnout>
getLow()
(package private) void
init()
boolean
isTurnoutUsed(Turnout t)
Check if a given turnout is used on this head.(package private) static NamedBeanHandle<Turnout>
makeHandle(int i)
Create a handle from a raw number.(package private) static java.lang.String
makeSystemName(NamedBeanHandle<Turnout> lowTO, NamedBeanHandle<Turnout> highTO)
Implement convention for making a system name.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, 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
-
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, dispose, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getSystemName, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
lowTurnout
NamedBeanHandle<Turnout> lowTurnout
-
highTurnout
NamedBeanHandle<Turnout> highTurnout
-
-
Constructor Detail
-
SE8cSignalHead
public SE8cSignalHead(NamedBeanHandle<Turnout> lowTO, NamedBeanHandle<Turnout> highTO, java.lang.String userName)
Primary ctor.- Parameters:
lowTO
- lower-numbered Turnout referencehighTO
- higher-numbered Turnout referenceuserName
- user name for mast
-
SE8cSignalHead
public SE8cSignalHead(NamedBeanHandle<Turnout> lowTO, NamedBeanHandle<Turnout> highTO)
Primary ctor without user name.- Parameters:
lowTO
- lower-numbered Turnout referencehighTO
- higher-numbered Turnout reference
-
SE8cSignalHead
public SE8cSignalHead(java.lang.String sname, NamedBeanHandle<Turnout> lowTO, NamedBeanHandle<Turnout> highTO, java.lang.String userName)
Ctor specifying system name and user name.- Parameters:
sname
- system name for mastlowTO
- lower-numbered Turnout referencehighTO
- higher-numbered Turnout referenceuserName
- user name for mast
-
SE8cSignalHead
public SE8cSignalHead(java.lang.String sname, NamedBeanHandle<Turnout> lowTO, NamedBeanHandle<Turnout> highTO)
Ctor specifying system name.- Parameters:
sname
- system name for mastlowTO
- lower-numbered Turnout referencehighTO
- higher-numbered Turnout reference
-
SE8cSignalHead
public SE8cSignalHead(int pNumber, java.lang.String userName)
Compatibility ctor.- Parameters:
pNumber
- number (address) of low turnoutuserName
- name to use for this signal head
-
SE8cSignalHead
public SE8cSignalHead(int pNumber)
Compatibility ctor- Parameters:
pNumber
- number (address) of low turnout
-
-
Method Detail
-
makeSystemName
static java.lang.String makeSystemName(NamedBeanHandle<Turnout> lowTO, NamedBeanHandle<Turnout> highTO)
Implement convention for making a system name.Must pass arguments, as it is used before object is complete.
- Parameters:
lowTO
- lower-numbered Turnout referencehighTO
- higher-numbered Turnout reference- Returns:
- system name with fixed elements, i.e. IH:SE8c:to1\to2
-
makeHandle
static NamedBeanHandle<Turnout> makeHandle(int i) throws java.lang.IllegalArgumentException
Create a handle from a raw number.Static, so can be referenced before ctor complete.
- Parameters:
i
- index number (address) of a turnout on the signal head- Returns:
- NamedBeanHandle<Turnout> object to use as output for head
- Throws:
java.lang.IllegalArgumentException
- when creation from i fails
-
init
void init()
-
updateOutput
protected void updateOutput()
Type-specific routine to handle output to the layout hardware. Implemented to handle a request to change state by sending a LocoNet command.Does not notify listeners of changes; that's done elsewhere. Should consider the following variables to determine what to send:
- mAppearance
- mLit
- mFlashOn
- Specified by:
updateOutput
in classDefaultSignalHead
-
getLow
public NamedBeanHandle<Turnout> getLow()
-
getHigh
public NamedBeanHandle<Turnout> getHigh()
-
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
-
-