Package jmri.jmrit.ussctc
Class TurnoutSection
- java.lang.Object
-
- jmri.jmrit.ussctc.TurnoutSection
-
- All Implemented Interfaces:
CentralSection<CodeGroupTwoBits,CodeGroupTwoBits>
,FieldSection<CodeGroupTwoBits,CodeGroupTwoBits>
,Section<CodeGroupTwoBits,CodeGroupTwoBits>
public class TurnoutSection extends java.lang.Object implements Section<CodeGroupTwoBits,CodeGroupTwoBits>
Drive a single Turnout section on a USS CTC panel. ImplementsSection
for both the field and CTC machine parts. The two parts are implemented as separateFieldSection
andCentralSection
static inner classes to ensure they're functionally separate, connected only by the code they exchange. They're combined in this single class to make sure they work together.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.
The state diagram for the central section is presented in three parts to make it more useful:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
TurnoutSection.TurnoutCentralSection
(package private) class
TurnoutSection.TurnoutFieldSection
-
Field Summary
Fields Modifier and Type Field Description (package private) TurnoutSection.TurnoutCentralSection
central
(package private) static CodeGroupTwoBits
CODE_CLOSED
(package private) static CodeGroupTwoBits
CODE_NEITHER
(package private) static CodeGroupTwoBits
CODE_THROWN
(package private) TurnoutSection.TurnoutFieldSection
field
(package private) Station<CodeGroupTwoBits,CodeGroupTwoBits>
station
-
Constructor Summary
Constructors Constructor Description TurnoutSection()
Anonymous object only for testingTurnoutSection(java.lang.String layoutTO, java.lang.String normalIndicator, java.lang.String reversedIndicator, java.lang.String normalInput, java.lang.String reversedInput, Station<CodeGroupTwoBits,CodeGroupTwoBits> station)
Create and configure.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLocks(java.util.List<Lock> locks)
CodeGroupTwoBits
codeSendStart()
Inform central CTC machine part of section that a code-send operation (from central to field) has started and obtain the value to be sent over the line.void
codeValueDelivered(CodeGroupTwoBits value)
Provide the transferred value to the field unit at the end of the code-send operation.java.lang.String
getName()
Name of this Section.Station<CodeGroupTwoBits,CodeGroupTwoBits>
getStation()
void
indicationComplete(CodeGroupTwoBits value)
Provides the code sequence to the central CTC machine at the end of the indication-send operation.CodeGroupTwoBits
indicationStart()
Inform field part of section that an indication operation (from field to machine) has started and obtain the value to be conveyed to the central CTC machine.java.lang.String
toString()
-
-
-
Field Detail
-
station
Station<CodeGroupTwoBits,CodeGroupTwoBits> station
-
CODE_CLOSED
static final CodeGroupTwoBits CODE_CLOSED
-
CODE_THROWN
static final CodeGroupTwoBits CODE_THROWN
-
CODE_NEITHER
static final CodeGroupTwoBits CODE_NEITHER
-
-
Constructor Detail
-
TurnoutSection
TurnoutSection()
Anonymous object only for testing
-
TurnoutSection
public TurnoutSection(java.lang.String layoutTO, java.lang.String normalIndicator, java.lang.String reversedIndicator, java.lang.String normalInput, java.lang.String reversedInput, Station<CodeGroupTwoBits,CodeGroupTwoBits> station)
Create and configure. Accepts user or system names.- Parameters:
layoutTO
- Name for turnout on railroadnormalIndicator
- Turnout name for normal (left) indicator light on panelreversedIndicator
- Turnout name for reversed (right) indicator light on panelnormalInput
- Sensor name for normal (left) side of switch on panelreversedInput
- Sensor name for reversed (right) side of switch on panelstation
- Station to which this Section belongs
-
-
Method Detail
-
getStation
public Station<CodeGroupTwoBits,CodeGroupTwoBits> getStation()
- Specified by:
getStation
in interfaceSection<CodeGroupTwoBits,CodeGroupTwoBits>
-
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<CodeGroupTwoBits,CodeGroupTwoBits>
- Returns:
- section name without station.
-
codeSendStart
public CodeGroupTwoBits codeSendStart()
Description copied from interface:CentralSection
Inform central CTC machine part of section that a code-send operation (from central to field) has started and obtain the value to be sent over the line.- Specified by:
codeSendStart
in interfaceCentralSection<CodeGroupTwoBits,CodeGroupTwoBits>
- Returns:
- The value to be conveyed to the field.
-
codeValueDelivered
public void codeValueDelivered(CodeGroupTwoBits value)
Description copied from interface:FieldSection
Provide the transferred value to the field unit at the end of the code-send operation.- Specified by:
codeValueDelivered
in interfaceFieldSection<CodeGroupTwoBits,CodeGroupTwoBits>
- Parameters:
value
- transfer value.
-
indicationStart
public CodeGroupTwoBits indicationStart()
Description copied from interface:FieldSection
Inform field part of section that an indication operation (from field to machine) has started and obtain the value to be conveyed to the central CTC machine.- Specified by:
indicationStart
in interfaceFieldSection<CodeGroupTwoBits,CodeGroupTwoBits>
- Returns:
- The value to be conveyed to the central CTC machine.
-
indicationComplete
public void indicationComplete(CodeGroupTwoBits value)
Description copied from interface:CentralSection
Provides the code sequence to the central CTC machine at the end of the indication-send operation.- Specified by:
indicationComplete
in interfaceCentralSection<CodeGroupTwoBits,CodeGroupTwoBits>
- Parameters:
value
- to be conveyed.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-