Package jmri.implementation
Class DefaultCabSignal
java.lang.Object
jmri.implementation.DefaultCabSignal
- All Implemented Interfaces:
PropertyChangeListener,EventListener,CabSignal
- Direct Known Subclasses:
CbusCabSignal,LnCabSignal
Default implementation of a Cab Signal Object, describing the state of the
track ahead relative to a locomotive with a given address. This is
effectively a mobile signal mast.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a listener for consist eventsvoiddispose()A method for cleaning up the cab signalprotected voidfirePropertyChange(String p, Object old, Object n) protected voidForward the command to the layout that sets the displayed signal aspect for this addressvoidForward the current cab signal value to the layout.getBlock()Get the Block position of the locomotive associated with the cab signal.Get Block List to the end of Path or Signal Mast Stop, whichever first.Get the LocoAddress associated with the consistGet the Next Block the locomotive is expected to enter.Get the Next Signal Mast the locomotive is expected to pass.booleanvoidvoidRemove a listener for cab signal eventsprotected voidForward the command to the layout that clears any displayed signal for this addressvoidsetBlock()Set the Block of the locomotive by searching the block list.voidSet the Block of the locomotivevoidsetCabSignalActive(boolean active) voidsetMasterCabSigPauseActive(boolean active) toString()
-
Constructor Details
-
DefaultCabSignal
-
-
Method Details
-
dispose
A method for cleaning up the cab signal -
getCabSignalAddress
Get the LocoAddress associated with the consist- Specified by:
getCabSignalAddressin interfaceCabSignal- Returns:
- the cab signal address
-
setBlock
Set the Block of the locomotive -
setBlock
Set the Block of the locomotive by searching the block list. -
getBlock
Get the Block position of the locomotive associated with the cab signal. -
getNextBlock
Get the Next Block the locomotive is expected to enter. This value is calculated from the current block and direction of travel.- Specified by:
getNextBlockin interfaceCabSignal- Returns:
- The next Block position
-
getNextMast
Get the Next Signal Mast the locomotive is expected to pass. This value is calculated from the current block and direction of travel.- Specified by:
getNextMastin interfaceCabSignal- Returns:
- The next SignalMast position
-
getBlockList
Get Block List to the end of Path or Signal Mast Stop, whichever first. The first Block in the list ( if any ), will be the current Block.- Specified by:
getBlockListin interfaceCabSignal- Returns:
- list of Blocks that the loco address is expected to traverse.
-
forwardCabSignalToLayout
Forward the current cab signal value to the layout.- Specified by:
forwardCabSignalToLayoutin interfaceCabSignal
-
forwardAspectToLayout
Forward the command to the layout that sets the displayed signal aspect for this address -
isCabSignalActive
- Specified by:
isCabSignalActivein interfaceCabSignal
-
setCabSignalActive
- Specified by:
setCabSignalActivein interfaceCabSignal
-
setMasterCabSigPauseActive
- Specified by:
setMasterCabSigPauseActivein interfaceCabSignal
-
resetLayoutCabSignal
Forward the command to the layout that clears any displayed signal for this address -
addPropertyChangeListener
Add a listener for consist events- Specified by:
addPropertyChangeListenerin interfaceCabSignal- Parameters:
l- is a PropertyChangeListener object
-
removePropertyChangeListener
Remove a listener for cab signal events- Specified by:
removePropertyChangeListenerin interfaceCabSignal- Parameters:
l- is a PropertyChangeListener object
-
firePropertyChange
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-
toString
-