Package jmri.implementation
Class DefaultSignalHead
java.lang.Object
jmri.implementation.AbstractNamedBean
jmri.implementation.AbstractSignalHead
jmri.implementation.DefaultSignalHead
- All Implemented Interfaces:
VetoableChangeListener,Comparable<NamedBean>,EventListener,PropertyChangeProvider,NamedBean,Signal,SignalHead
- Direct Known Subclasses:
AcelaSignalHead,DoubleTurnoutSignalHead,LsDecSignalHead,MergSD2SignalHead,SE8cSignalHead,SE8cSignalHead,SerialSignalHead,SingleTurnoutSignalHead,VirtualSignalHead
Default implementation of the basic logic of the SignalHead interface.
This class only claims support for the Red, Yellow and Green appearances, and
their corresponding flashing forms. Support for Lunar is deferred to
DefaultLunarSignalHead or an extended class.
-
Nested Class Summary
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException -
Field Summary
FieldsModifier and TypeFieldDescriptionintOn or off time of flashing signal.static intprotected booleanShould a flashing signal be on (lit) now?(package private) TimerFields inherited from class jmri.implementation.AbstractSignalHead
mAppearance, mHeld, mLitFields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, registerFields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWNFields inherited from interface jmri.Signal
PROPERTY_HELD, PROPERTY_LITFields inherited from interface jmri.SignalHead
DARK, FLASHGREEN, FLASHLUNAR, FLASHRED, FLASHYELLOW, GREEN, HELD, LUNAR, PROPERTY_APPEARANCE, RED, YELLOW -
Constructor Summary
ConstructorsConstructorDescriptionDefaultSignalHead(String systemName) DefaultSignalHead(String systemName, String userName) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappearanceSetsFlashTimer(int newAppearance) Call to set timer when updating the appearance.getUsageReport(NamedBean bean) Get a list of references for the specified bean.String[]Get an array of non-localized appearance keys valid for the mast type.String[]Get an array of localized appearance descriptions valid for the mast type.int[]Get an array of appearance indexes valid for the mast type.booleanCheck if a given turnout is used on this head.voidsetAppearance(int newAppearance) Set the Signal Head Appearance.voidsetHeld(boolean newHeld) Set the held parameter.voidsetLit(boolean newLit) protected voidStart the timer that controls flashing.protected voidprotected abstract voidType-specific routine to handle output to the layout hardware.Methods inherited from class jmri.implementation.AbstractSignalHead
describeState, getAppearance, getAppearanceKey, getAppearanceKey, getAppearanceName, getAppearanceName, getBeanType, getDefaultStateName, getDefaultValidStateNames, getDefaultValidStates, getHeld, getLit, getState, isAtStop, isCleared, isShowingRestricting, setState, vetoableChangeMethods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, 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, updateListenerRefMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, dispose, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getSystemName, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRefMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
mFlashOn
Should a flashing signal be on (lit) now? -
timer
-
delay
On or off time of flashing signal. Public so that it can be overridden by scripting (before first use) -
masterDelay
-
-
Constructor Details
-
DefaultSignalHead
-
DefaultSignalHead
-
-
Method Details
-
setAppearance
Description copied from interface:SignalHeadSet the Signal Head Appearance.- Parameters:
newAppearance- integer representing a valid Appearance for this head
-
appearanceSetsFlashTimer
Call to set timer when updating the appearance.- Parameters:
newAppearance- the new appearance
-
setLit
Description copied from interface:SignalHead -
setHeld
Set the held parameter.Note that this does not directly effect the output on the layout; the held parameter is a local variable which effects the aspect only via higher-level logic.
- Parameters:
newHeld- new Held state, true if Held, to be compared with current Held state
-
updateOutput
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
-
startFlash
Start the timer that controls flashing. -
stopFlash
-
getValidStates
Get an array of appearance indexes valid for the mast type.- Specified by:
getValidStatesin interfaceSignalHead- Overrides:
getValidStatesin classAbstractSignalHead- Returns:
- array of appearance state values available on this mast type
-
getValidStateKeys
Get an array of non-localized appearance keys valid for the mast type. For GUI application consider using (capitalized)SignalHead.getValidStateNames()- Specified by:
getValidStateKeysin interfaceSignalHead- Overrides:
getValidStateKeysin classAbstractSignalHead- Returns:
- array of translated appearance names available on this mast type
-
getValidStateNames
Get an array of localized appearance descriptions valid for the mast type. For persistance and comparison consider usingSignalHead.getValidStateKeys()- Specified by:
getValidStateNamesin interfaceSignalHead- Overrides:
getValidStateNamesin classAbstractSignalHead- Returns:
- array of translated appearance names
-
isTurnoutUsed
Description copied from class:AbstractSignalHeadCheck if a given turnout is used on this head.- Specified by:
isTurnoutUsedin classAbstractSignalHead- Parameters:
t- Turnout object to check- Returns:
- true if turnout is configured as output or driver of head
-
getUsageReport
Description copied from interface:NamedBeanGet a list of references for the specified bean.- Parameters:
bean- The bean to be checked.- Returns:
- a list of NamedBeanUsageReports or an empty ArrayList.
-