Package jmri.jmrit.ussctc
Class SignalHeadSection
- java.lang.Object
-
- jmri.jmrit.ussctc.SignalHeadSection
-
- All Implemented Interfaces:
CentralSection<CodeGroupThreeBits,CodeGroupThreeBits>
,FieldSection<CodeGroupThreeBits,CodeGroupThreeBits>
,Section<CodeGroupThreeBits,CodeGroupThreeBits>
public class SignalHeadSection extends java.lang.Object implements Section<CodeGroupThreeBits,CodeGroupThreeBits>
Drive a signal section on a USS CTC panel. ImplementsSection
for both the field and CTC machine parts.Based on the Signal interface.
Note that this intentionally does not turn off indicators when the code button is pressed unless a change has been requested. This is a model-railroad compromise to speed up the dispatcher's ability to see what's going on.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
SignalHeadSection.Machine
-
Field Summary
Fields Modifier and Type Field Description static CodeGroupThreeBits
CODE_LEFT
static CodeGroupThreeBits
CODE_OFF
static CodeGroupThreeBits
CODE_RIGHT
static CodeGroupThreeBits
CODE_STOP
(package private) static int
DEFAULT_RUN_TIME_LENGTH
(package private) boolean
deferIndication
(package private) java.util.ArrayDeque<NamedBeanHandle<Signal>>
hLeftHeads
(package private) NamedBeanHandle<Turnout>
hLeftIndicator
(package private) NamedBeanHandle<Sensor>
hLeftInput
(package private) java.util.ArrayDeque<NamedBeanHandle<Signal>>
hRightHeads
(package private) NamedBeanHandle<Turnout>
hRightIndicator
(package private) NamedBeanHandle<Sensor>
hRightInput
(package private) NamedBeanHandle<Turnout>
hStopIndicator
(package private) CodeGroupThreeBits
lastIndication
(package private) java.util.List<Lock>
leftwardLocks
(package private) SignalHeadSection.Machine
machine
static int
MOVEMENT_DELAY
(package private) java.beans.PropertyChangeSupport
pcs
(package private) java.util.List<Lock>
rightwardLocks
(package private) Station<CodeGroupThreeBits,CodeGroupThreeBits>
station
(package private) Sensor
timeLogSensor
(package private) Memory
timeMemory
(package private) boolean
timeRunning
-
Constructor Summary
Constructors Constructor Description SignalHeadSection()
Anonymous object only for testingSignalHeadSection(java.util.List<java.lang.String> rightHeads, java.util.List<java.lang.String> leftHeads, java.lang.String leftIndicator, java.lang.String stopIndicator, java.lang.String rightIndicator, java.lang.String leftInput, java.lang.String rightInput, Station<CodeGroupThreeBits,CodeGroupThreeBits> station)
Create and configure.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLeftwardLocks(java.util.List<Lock> locks)
void
addPropertyChangeListener(java.beans.PropertyChangeListener l)
void
addRightwardLocks(java.util.List<Lock> locks)
CodeGroupThreeBits
codeSendStart()
Start of sending code operation: Set indicators off if a change has been requested Provide values to send over linevoid
codeValueDelivered(CodeGroupThreeBits value)
Code arrives in field.protected void
firePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)
CodeGroupThreeBits
getCurrentIndication()
Work out current indication from layout status.(package private) CodeGroupThreeBits
getLastIndication()
java.lang.String
getName()
Name of this Section.Station<CodeGroupThreeBits,CodeGroupThreeBits>
getStation()
boolean
headShowsClear(NamedBeanHandle<Signal> handle)
Clear is defined as showing above Restricting.boolean
headShowsRestricting(NamedBeanHandle<Signal> handle)
"Restricting" means that a signal is showing FLASHREDvoid
indicationComplete(CodeGroupThreeBits value)
Process values received from the field unit.CodeGroupThreeBits
indicationStart()
Provide state that's returned from field to machine via indication.boolean
isRunningTime()
(package private) void
layoutSignalHeadChanged(java.beans.PropertyChangeEvent e)
void
removePropertyChangeListener(java.beans.PropertyChangeListener l)
(package private) void
setLastIndication(CodeGroupThreeBits v)
protected void
setListHeldState(java.lang.Iterable<NamedBeanHandle<Signal>> list, boolean state)
(package private) void
startRunningTime()
java.lang.String
toString()
-
-
-
Field Detail
-
DEFAULT_RUN_TIME_LENGTH
static final int DEFAULT_RUN_TIME_LENGTH
- See Also:
- Constant Field Values
-
timeMemory
Memory timeMemory
-
timeLogSensor
Sensor timeLogSensor
-
hRightHeads
java.util.ArrayDeque<NamedBeanHandle<Signal>> hRightHeads
-
hLeftHeads
java.util.ArrayDeque<NamedBeanHandle<Signal>> hLeftHeads
-
hLeftIndicator
NamedBeanHandle<Turnout> hLeftIndicator
-
hStopIndicator
NamedBeanHandle<Turnout> hStopIndicator
-
hRightIndicator
NamedBeanHandle<Turnout> hRightIndicator
-
hLeftInput
NamedBeanHandle<Sensor> hLeftInput
-
hRightInput
NamedBeanHandle<Sensor> hRightInput
-
CODE_LEFT
public static final CodeGroupThreeBits CODE_LEFT
-
CODE_STOP
public static final CodeGroupThreeBits CODE_STOP
-
CODE_RIGHT
public static final CodeGroupThreeBits CODE_RIGHT
-
CODE_OFF
public static final CodeGroupThreeBits CODE_OFF
-
machine
SignalHeadSection.Machine machine
-
lastIndication
CodeGroupThreeBits lastIndication
-
timeRunning
boolean timeRunning
-
station
Station<CodeGroupThreeBits,CodeGroupThreeBits> station
-
rightwardLocks
java.util.List<Lock> rightwardLocks
-
leftwardLocks
java.util.List<Lock> leftwardLocks
-
MOVEMENT_DELAY
public static int MOVEMENT_DELAY
-
deferIndication
boolean deferIndication
-
pcs
final java.beans.PropertyChangeSupport pcs
-
-
Constructor Detail
-
SignalHeadSection
SignalHeadSection()
Anonymous object only for testing
-
SignalHeadSection
public SignalHeadSection(java.util.List<java.lang.String> rightHeads, java.util.List<java.lang.String> leftHeads, java.lang.String leftIndicator, java.lang.String stopIndicator, java.lang.String rightIndicator, java.lang.String leftInput, java.lang.String rightInput, Station<CodeGroupThreeBits,CodeGroupThreeBits> station)
Create and configure. Accepts user or system names.- Parameters:
rightHeads
- Set of Signals to release when rightward travel allowedleftHeads
- Set of Signals to release when leftward travel allowedleftIndicator
- Turnout name for leftward indicatorstopIndicator
- Turnout name for stop indicatorrightIndicator
- Turnout name for rightward indicatorleftInput
- Sensor name for rightward side of lever on panelrightInput
- Sensor name for leftward side of lever on panelstation
- Station to which this Section belongs
-
-
Method Detail
-
setLastIndication
void setLastIndication(CodeGroupThreeBits v)
-
getLastIndication
CodeGroupThreeBits getLastIndication()
-
isRunningTime
public boolean isRunningTime()
-
getStation
public Station<CodeGroupThreeBits,CodeGroupThreeBits> getStation()
- Specified by:
getStation
in interfaceSection<CodeGroupThreeBits,CodeGroupThreeBits>
-
getName
public java.lang.String getName()
Description copied from interface:Section
Name of this Section. Does not include name of associated Station.- Specified by:
getName
in interfaceSection<CodeGroupThreeBits,CodeGroupThreeBits>
- Returns:
- section name without station.
-
addRightwardLocks
public void addRightwardLocks(java.util.List<Lock> locks)
-
addLeftwardLocks
public void addLeftwardLocks(java.util.List<Lock> locks)
-
codeSendStart
public CodeGroupThreeBits codeSendStart()
Start of sending code operation:- Set indicators off if a change has been requested
- Provide values to send over line
- Specified by:
codeSendStart
in interfaceCentralSection<CodeGroupThreeBits,CodeGroupThreeBits>
- Returns:
- code line value to transmit from machine to field
-
startRunningTime
void startRunningTime()
-
codeValueDelivered
public void codeValueDelivered(CodeGroupThreeBits value)
Code arrives in field. Sets the signals on the layout.- Specified by:
codeValueDelivered
in interfaceFieldSection<CodeGroupThreeBits,CodeGroupThreeBits>
- Parameters:
value
- transfer value.
-
setListHeldState
protected void setListHeldState(java.lang.Iterable<NamedBeanHandle<Signal>> list, boolean state)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
indicationStart
public CodeGroupThreeBits indicationStart()
Provide state that's returned from field to machine via indication.- Specified by:
indicationStart
in interfaceFieldSection<CodeGroupThreeBits,CodeGroupThreeBits>
- Returns:
- The value to be conveyed to the central CTC machine.
-
headShowsClear
public boolean headShowsClear(NamedBeanHandle<Signal> handle)
Clear is defined as showing above Restricting. We implement that as not Held, not RED, not Restricting.- Parameters:
handle
- signal bean handle.- Returns:
- true if clear.
-
headShowsRestricting
public boolean headShowsRestricting(NamedBeanHandle<Signal> handle)
"Restricting" means that a signal is showing FLASHRED- Parameters:
handle
- signal bean handle.- Returns:
- true if showing restricting.
-
getCurrentIndication
public CodeGroupThreeBits getCurrentIndication()
Work out current indication from layout status.- Returns:
- code group.
-
indicationComplete
public void indicationComplete(CodeGroupThreeBits value)
Process values received from the field unit.- Specified by:
indicationComplete
in interfaceCentralSection<CodeGroupThreeBits,CodeGroupThreeBits>
- Parameters:
value
- to be conveyed.
-
layoutSignalHeadChanged
void layoutSignalHeadChanged(java.beans.PropertyChangeEvent e)
-
addPropertyChangeListener
@OverridingMethodsMustInvokeSuper public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
-
removePropertyChangeListener
@OverridingMethodsMustInvokeSuper public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
-
firePropertyChange
@OverridingMethodsMustInvokeSuper protected void firePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)
-
-