Package jmri.jmrit.tracker
Class StoppingBlock
java.lang.Object
jmri.jmrit.tracker.StoppingBlock
Stop a train in a block if required.
Watches a Block object that is passing around a Throttle object as its value. When the Block goes OCCUPIED, check whether a signal is telling the train to stop; if so, force the Throttle to zero speed.
This contains multiple SignalHead objects, each associated with a Path that contains one or more BeanSettings (e.g. Turnout positions) and directions. When needed, this consults the paths to see which one is active (has its Turnouts set) and corresponds to the current direction of the block. There should be exactly one of these, which will then identify which signal to monitor.
Limitations:
- Current implementation does not protect against changing direction and backing out of the block
- Should track speed at time of stop and restore it on restart (or should it not restart? Optional restart?)
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) Block(package private) int(package private) SignalHead(package private) SignalHead -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSignal(SignalHead s, int dir) voidaddSignal(SignalHead s1, SignalHead s2, int dir) (package private) void(package private) voiddoSlow()(package private) voiddoStop()Perform the stop operation(package private) int(package private) void(package private) void(package private) voidsetSpeed(float speed, boolean f1, boolean f2, boolean f3) voidsetSpeeds(float s, float f) Set speeds.
-
Field Details
-
block
-
sig1
-
sig2
-
direction
int direction
-
-
Constructor Details
-
StoppingBlock
-
-
Method Details
-
handleBlockChange
-
handleSignalChange
-
addSignal
-
addSignal
-
fastestAppearance
int fastestAppearance() -
doStop
void doStop()Perform the stop operation -
doSlow
void doSlow() -
doRestart
void doRestart() -
setSpeed
-
setSpeeds
Set speeds.- Parameters:
s- the slow speed, default 0.3f- the fast speed, default 0.6
-