Class MergSD2SignalHead
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractSignalHead
-
- jmri.implementation.DefaultSignalHead
-
- jmri.implementation.MergSD2SignalHead
-
- All Implemented Interfaces:
java.beans.VetoableChangeListener
,java.lang.Comparable<NamedBean>
,java.util.EventListener
,PropertyChangeProvider
,NamedBean
,Signal
,SignalHead
public class MergSD2SignalHead extends DefaultSignalHead
Implement SignalHead for the MERG Signal Driver 2.The Signal Driver, runs off of the output of a steady State Accessory decoder. Can be configured to run 2, 3 or 4 Aspect signals. With 2 or 3 aspect signals it may have a feather included.
The driver is designed to be used with UK based signals.
The class assigns turnout positions for RED, YELLOW, GREEN and Double Yellow aspects. THE SD2 does not support flashing double yellow aspects on turnouts, so an alternative method is required to do this, as per the MERG SD2 documentation.
As there is no Double Yellow asigned within JMRI, we use the Lunar instead.
For more info on the signals, see http://www.merg.info.
-
-
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) int
mAspects
(package private) boolean
mFeather
(package private) boolean
mHome
(package private) NamedBeanHandle<Turnout>
mInput1
(package private) NamedBeanHandle<Turnout>
mInput2
(package private) NamedBeanHandle<Turnout>
mInput3
-
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 MergSD2SignalHead(java.lang.String sys, int aspect, NamedBeanHandle<Turnout> t1, NamedBeanHandle<Turnout> t2, NamedBeanHandle<Turnout> t3, boolean feather, boolean home)
MergSD2SignalHead(java.lang.String sys, java.lang.String user, int aspect, NamedBeanHandle<Turnout> t1, NamedBeanHandle<Turnout> t2, NamedBeanHandle<Turnout> t3, boolean feather, boolean home)
-
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
getAspects()
Return the number of aspects for this signal.boolean
getFeather()
boolean
getHome()
Return whether this signal is a home or a distant/Repeater signal.NamedBeanHandle<Turnout>
getInput1()
NamedBeanHandle<Turnout>
getInput2()
NamedBeanHandle<Turnout>
getInput3()
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
setAppearance(int newAppearance)
Set the Signal Head Appearance.void
setAspects(int i)
Set the number of aspects on the signal.void
setFeather(boolean boo)
void
setHome(boolean boo)
Set whether the signal is a home or distance/repeater signal.void
setInput1(NamedBeanHandle<Turnout> t)
Set the first turnout used on the driver.void
setInput2(NamedBeanHandle<Turnout> t)
Set the second turnout used on the driver.void
setInput3(NamedBeanHandle<Turnout> t)
Set the third turnout used on the driver.void
setLit(boolean newLit)
protected void
updateOutput()
Type-specific routine to handle output to the layout hardware.-
Methods inherited from class jmri.implementation.DefaultSignalHead
appearanceSetsFlashTimer, getUsageReport, setHeld, 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, getRecommendedToolTip, getSystemName, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
mInput1
NamedBeanHandle<Turnout> mInput1
-
mInput2
NamedBeanHandle<Turnout> mInput2
-
mInput3
NamedBeanHandle<Turnout> mInput3
-
mAspects
int mAspects
-
mFeather
boolean mFeather
-
mHome
boolean mHome
-
-
Constructor Detail
-
MergSD2SignalHead
public MergSD2SignalHead(java.lang.String sys, java.lang.String user, int aspect, NamedBeanHandle<Turnout> t1, NamedBeanHandle<Turnout> t2, NamedBeanHandle<Turnout> t3, boolean feather, boolean home)
-
MergSD2SignalHead
public MergSD2SignalHead(java.lang.String sys, int aspect, NamedBeanHandle<Turnout> t1, NamedBeanHandle<Turnout> t2, NamedBeanHandle<Turnout> t3, boolean feather, boolean home)
-
-
Method Detail
-
setAppearance
public void setAppearance(int newAppearance)
Set the Signal Head Appearance. Modified from DefaultSignalHead. Removed option for software flashing.- Specified by:
setAppearance
in interfaceSignalHead
- Overrides:
setAppearance
in classDefaultSignalHead
- Parameters:
newAppearance
- integer representing a valid Appearance for this head
-
setLit
public void setLit(boolean newLit)
Description copied from interface:SignalHead
- Specified by:
setLit
in interfaceSignal
- Specified by:
setLit
in interfaceSignalHead
- Overrides:
setLit
in classDefaultSignalHead
-
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
-
getInput1
@CheckForNull public NamedBeanHandle<Turnout> getInput1()
-
getInput2
@CheckForNull public NamedBeanHandle<Turnout> getInput2()
-
getInput3
@CheckForNull public NamedBeanHandle<Turnout> getInput3()
-
getAspects
public int getAspects()
Return the number of aspects for this signal.- Returns:
- the number of aspects
-
getFeather
public boolean getFeather()
-
getHome
public boolean getHome()
Return whether this signal is a home or a distant/Repeater signal.- Returns:
- true if signal is set up as Home signal (default); false if Distant
-
setInput1
public void setInput1(NamedBeanHandle<Turnout> t)
Set the first turnout used on the driver. Relates to the section directly in front of the Signal (2, 3 & 4 aspect Signals).- Parameters:
t
- turnout (named bean handel) to use as input 1
-
setInput2
public void setInput2(NamedBeanHandle<Turnout> t)
Set the second turnout used on the driver. Relates to the section in front of the next Signal (3 and 4 aspect Signal).- Parameters:
t
- turnout (named bean handel) to use as input 2
-
setInput3
public void setInput3(NamedBeanHandle<Turnout> t)
Set the third turnout used on the driver. Relates to the section directly in front the third Signal (4 aspect Signal).- Parameters:
t
- turnout (named bean handel) to use as input 3
-
setAspects
public void setAspects(int i)
Set the number of aspects on the signal.- Parameters:
i
- the number of aspects on mast; valid values: 2, 3, 4
-
setFeather
public void setFeather(boolean boo)
-
setHome
public void setHome(boolean boo)
Set whether the signal is a home or distance/repeater signal.- Parameters:
boo
- true if configuring as a Home signal, false for a Distant
-
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
-
-