Class MatrixSignalMast
- All Implemented Interfaces:
VetoableChangeListener
,Comparable<NamedBean>
,EventListener
,PropertyChangeProvider
,NamedBean
,SignalMast
public class MatrixSignalMast extends AbstractSignalMast
A MatrixSignalMast is built up from an array of turnouts to control each aspect. System name specifies the creation information (except for the actual output beans):
IF$xsm:basic:one-searchlight:($0001)-3tThe name is a colon-separated series of terms:
- IF$xsm - defines signal masts of this type (x for matriX)
- basic - name of the signaling system
- one-searchlight - name of the particular aspect map/mast model
- ($0001) - small ordinal number for telling various matrix signal masts apart
- name ending in -nt for (binary) Turnout outputs where n = the number of binary outputs, between 1 and mastBitNum i.e. -3t
-
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 protected HashMap<String,NamedBeanHandle<Turnout>>
outputsToBeans
Fields inherited from class jmri.implementation.AbstractSignalMast
allowUnLit, aspect, disabledAspects, disablePermissiveSignalMastLogic, map, speed, systemDefn
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
-
Constructor Summary
Constructors Constructor Description MatrixSignalMast(String systemName)
MatrixSignalMast(String systemName, String userName)
-
Method Summary
Modifier and Type Method Description void
dispose()
Deactivate this object, so that it releases as many resources as possible and no longer effects others.int
getBitNum()
char[]
getBitsForAspect(String aspect)
Look up the pattern for an aspect.String
getBitstring(String aspect)
Provide one series of on/off digits from aspectToOutput hashmap to xml.static int
getLastRef()
int
getMatrixMastCommandDelay()
Get the delay between issuing Matrix Output commands to the outputs on this specific mast.NamedBeanHandle<Turnout>
getOutputHandle(int colNum)
Fetch output from outputsToBeans hashmap.String
getOutputName(int colnum)
Fetch output from outputsToBeans hashmap and provide to xml.List<String>
getOutputs()
Provide the names of the on/off turnout outputs from outputsToBeans hashmap to xml.char[]
getUnLitBits()
Provide Unlit bits to panel for editing.String
getUnLitChars()
Hand unLitBits to xml.(package private) boolean
isTurnoutUsed(Turnout t)
boolean
resetPreviousStates()
void
resetPreviousStates(boolean boo)
If the signal mast driver requires the previous state to be cleared down before the next state is set.void
setAspect(String aspect)
Set aspect to a valid name in the current signal system definition.void
setAspectDisabled(String aspect)
void
setBitNum(char[] bits)
Store number of outputs from integer.void
setBitNum(int number)
Store number of outputs from integer.void
setBitsForAspect(String aspect, char[] bitArray)
Store bits in aspectToOutput hashmap, synchronized.void
setBitstring(String aspect, char[] bitArray)
Receive aspect name from xml and store matching setting in outputsToBeans hashmap.void
setBitstring(String aspect, String bitString)
Receive aspect name from xml and store matching setting in outputsToBeans hashmap.protected static void
setLastRef(int newVal)
void
setLit(boolean newLit)
Set the lit property.void
setMatrixMastCommandDelay(int delay)
Set the delay between issuing Matrix Output commands to the outputs on this specific mast.void
setOutput(String colname, String turnoutname)
Receive properties from xml, convert name to NamedBeanHandle, store in hashmap outputsToBeans.void
setUnLitBits(char[] bits)
void
setUnLitBits(String bitString)
Receive unLitBits from xml and store.void
updateOutputs(char[] bits)
Send hardware instruction.void
vetoableChange(PropertyChangeEvent evt)
Methods inherited from class jmri.implementation.AbstractSignalMast
allowUnLit, configureAspectTable, configureSignalSystemDefinition, getAllKnownAspects, getAppearanceMap, getAspect, getBeanType, getDisabledAspects, getHeld, getLit, getMastType, getSignalSystem, getSpeed, getState, getValidAspects, isAspectDisabled, isPermissiveSmlDisabled, setAllowUnLit, setAspectEnabled, setHeld, setMastType, setPermissiveSmlDisabled, setState
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, describeState, equals, firePropertyChange, getComment, getDisplayName, getDisplayName, getFullyFormattedDisplayName, getFullyFormattedDisplayName, 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, getFullyFormattedDisplayName, getFullyFormattedDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
Constructor Details
-
Method Details
-
setBitsForAspect
Store bits in aspectToOutput hashmap, synchronized.Length of bitArray should match the number of outputs defined, so one digit per output.
- Parameters:
aspect
- String valid aspect to definebitArray
- char[] of on/off outputs for the aspect, like "00010"
-
getBitsForAspect
Look up the pattern for an aspect.- Parameters:
aspect
- String describing a (valid) signal mast aspect, like "Clear" only called for an already existing mast- Returns:
- char[] of on/off outputs per aspect, like "00010" length of array should match the number of outputs defined when a mast is changed in the interface, extra 0's are added or superfluous elements deleted by the Add Mast panel
-
setAspect
Description copied from interface:SignalMast
Set aspect to a valid name in the current signal system definition.- Specified by:
setAspect
in interfaceSignalMast
- Overrides:
setAspect
in classAbstractSignalMast
- Parameters:
aspect
- the new aspect shown
-
setLit
Description copied from class:AbstractSignalMast
Set the lit property.This acts on all the SignalHeads included in this SignalMast
- Specified by:
setLit
in interfaceSignalMast
- Overrides:
setLit
in classAbstractSignalMast
- Parameters:
newLit
- the new value of lit
-
setUnLitBits
-
setUnLitBits
Receive unLitBits from xml and store.- Parameters:
bitString
- String for 1-n 1/0 chararacters setting an unlit aspect
-
getUnLitBits
Provide Unlit bits to panel for editing.- Returns:
- char[] containing a series of 1's and 0's set for Unlit mast
-
getUnLitChars
Hand unLitBits to xml.- Returns:
- String for 1-n 1/0 chararacters setting an unlit aspect
-
getOutputHandle
Fetch output from outputsToBeans hashmap. Used?- Parameters:
colNum
- int index (1 up to mastBitNum) for the column of the desired output- Returns:
- NamedBeanHandle to the configured turnout output
-
getOutputName
Fetch output from outputsToBeans hashmap and provide to xml.- Parameters:
colnum
- int index (1 up to mastBitNum) for the column of the desired output- Returns:
- String with the desplay name of the configured turnout output
- See Also:
MatrixSignalMastXml.store(java.lang.Object)
-
setBitstring
Receive aspect name from xml and store matching setting in outputsToBeans hashmap.- Parameters:
aspect
- String describing (valid) signal mast aspect, like "Clear"bitString
- String of 1/0 digits representing on/off outputs per aspect, like "00010"- See Also:
MatrixSignalMastXml.load(org.jdom2.Element, org.jdom2.Element)
-
setBitstring
Receive aspect name from xml and store matching setting in outputsToBeans hashmap.- Parameters:
aspect
- String describing (valid) signal mast aspect, like "Clear"bitArray
- char[] of 1/0 digits representing on/off outputs per aspect, like {0,0,0,1,0}
-
getBitstring
Provide one series of on/off digits from aspectToOutput hashmap to xml.- Parameters:
aspect
- String describing valid signal mast aspect, like "Clear"- Returns:
- bitString String of 1 (= on) and 0 (= off) chars
-
getOutputs
Provide the names of the on/off turnout outputs from outputsToBeans hashmap to xml.- Returns:
- outputlist List<String> of display names for the outputs in order 1 to (max) mastBitNum
-
setOutput
Receive properties from xml, convert name to NamedBeanHandle, store in hashmap outputsToBeans.- Parameters:
colname
- String describing the name of the corresponding output, like "output1"turnoutname
- String for the display name of the output, like "LT1"
-
updateOutputs
Send hardware instruction.- Parameters:
bits
- char[] of on/off outputs per aspect, like "00010" Length of array should match the number of outputs defined
-
resetPreviousStates
If the signal mast driver requires the previous state to be cleared down before the next state is set.- Parameters:
boo
- true to configure for intermediate reset step
-
resetPreviousStates
-
isTurnoutUsed
-
getLastRef
- Returns:
- highest ordinal of all MatrixSignalMasts in use
-
setLastRef
- Parameters:
newVal
- for ordinal of all MatrixSignalMasts in use
-
vetoableChange
- Specified by:
vetoableChange
in interfaceNamedBean
- Specified by:
vetoableChange
in interfaceVetoableChangeListener
- Overrides:
vetoableChange
in classAbstractSignalMast
- Throws:
PropertyVetoException
-
setBitNum
Store number of outputs from integer.- Parameters:
number
- int for the number of outputs defined for this mast- See Also:
mastBitNum
-
setBitNum
Store number of outputs from integer.- Parameters:
bits
- char[] for outputs defined for this mast- See Also:
mastBitNum
-
getBitNum
-
setAspectDisabled
- Overrides:
setAspectDisabled
in classAbstractSignalMast
-
setMatrixMastCommandDelay
Set the delay between issuing Matrix Output commands to the outputs on this specific mast. Mast Delay will be extended by a connection specific Output Delay set in the connection config.- Parameters:
delay
- the new delay in milliseconds- See Also:
MatrixSignalMastXml.load(org.jdom2.Element, org.jdom2.Element)
-
getMatrixMastCommandDelay
Get the delay between issuing Matrix Output commands to the outputs on this specific mast. Delay be extended by a connection specific Output Delay set in the connection config.- Returns:
- the delay in milliseconds
- See Also:
MatrixSignalMastXml.load(org.jdom2.Element, org.jdom2.Element)
-
dispose
Description copied from interface:NamedBean
Deactivate this object, so that it releases as many resources as possible and no longer effects others.For example, if this object has listeners, after a call to this method it should no longer notify those listeners. Any native or system-wide resources it maintains should be released, including threads, files, etc.
It is an error to invoke any other methods on this object once dispose() has been called. Note, however, that there is no guarantee about behavior in that case.
Afterwards, references to this object may still exist elsewhere, preventing its garbage collection. But it's formally dead, and shouldn't be keeping any other objects alive. Therefore, this method should null out any references to other objects that this NamedBean contained.
- Specified by:
dispose
in interfaceNamedBean
- Overrides:
dispose
in classAbstractNamedBean
-