Package jmri.implementation
Class DefaultCabSignal
java.lang.Object
jmri.implementation.DefaultCabSignal
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
,CabSignal
- Direct Known Subclasses:
CbusCabSignal
,LnCabSignal
public class DefaultCabSignal extends Object implements CabSignal, PropertyChangeListener
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.
-
Field Summary
Fields Modifier and Type Field Description (package private) PropertyChangeSupport
pcs
-
Constructor Summary
Constructors Constructor Description DefaultCabSignal(LocoAddress address)
-
Method Summary
Modifier and Type Method Description void
addPropertyChangeListener(PropertyChangeListener l)
Add a listener for consist eventsvoid
dispose()
A method for cleaning up the cab signalprotected void
firePropertyChange(String p, Object old, Object n)
protected void
forwardAspectToLayout()
Forward the command to the layout that sets the displayed signal aspect for this addressvoid
forwardCabSignalToLayout()
Forward the current cab signal value to the layout.Block
getBlock()
Get the Block position of the locomotive associated with the cab signal.LocoAddress
getCabSignalAddress()
Get the LocoAddress associated with the consistBlock
getNextBlock()
Get the Next Block the locomotive is expected to enter.SignalMast
getNextMast()
Get the Next Signal Mast the locomotive is expected to pass.boolean
isCabSignalActive()
void
propertyChange(PropertyChangeEvent event)
void
removePropertyChangeListener(PropertyChangeListener l)
Remove a listener for cab signal eventsprotected void
resetLayoutCabSignal()
Forward the command to the layout that clears any displayed signal for this addressvoid
setBlock()
Set the Block of the locomotive by searching the block list.void
setBlock(Block position)
Set the Block of the locomotivevoid
setCabSignalActive(boolean active)
void
setMasterCabSigPauseActive(boolean active)
-
Field Details
-
Constructor Details
-
Method Details
-
dispose
A method for cleaning up the cab signal -
getCabSignalAddress
Get the LocoAddress associated with the consist- Specified by:
getCabSignalAddress
in 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:
getNextBlock
in 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:
getNextMast
in interfaceCabSignal
- Returns:
- The next SignalMast position
-
forwardCabSignalToLayout
Forward the current cab signal value to the layout.- Specified by:
forwardCabSignalToLayout
in interfaceCabSignal
-
forwardAspectToLayout
Forward the command to the layout that sets the displayed signal aspect for this address -
isCabSignalActive
- Specified by:
isCabSignalActive
in interfaceCabSignal
-
setCabSignalActive
- Specified by:
setCabSignalActive
in interfaceCabSignal
-
setMasterCabSigPauseActive
- Specified by:
setMasterCabSigPauseActive
in 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:
addPropertyChangeListener
in interfaceCabSignal
- Parameters:
l
- is a PropertyChangeListener object
-
removePropertyChangeListener
Remove a listener for cab signal events- Specified by:
removePropertyChangeListener
in interfaceCabSignal
- Parameters:
l
- is a PropertyChangeListener object
-
firePropertyChange
-
propertyChange
- Specified by:
propertyChange
in interfacePropertyChangeListener
-