Package jmri.jmrit.tracker
Class StoppingBlock
- java.lang.Object
-
- jmri.jmrit.tracker.StoppingBlock
-
public class StoppingBlock extends java.lang.Object
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
Fields Modifier and Type Field Description (package private) Block
block
(package private) int
direction
(package private) float
fast
(package private) SignalHead
sig1
(package private) SignalHead
sig2
(package private) float
slow
-
Constructor Summary
Constructors Constructor Description StoppingBlock(Block b)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSignal(SignalHead s, int dir)
void
addSignal(SignalHead s1, SignalHead s2, int dir)
(package private) void
doRestart()
(package private) void
doSlow()
(package private) void
doStop()
Perform the stop operation(package private) int
fastestAppearance()
(package private) void
handleBlockChange(java.beans.PropertyChangeEvent e)
(package private) void
handleSignalChange(java.beans.PropertyChangeEvent e)
(package private) void
setSpeed(float speed, boolean f1, boolean f2, boolean f3)
void
setSpeeds(float s, float f)
-
-
-
Field Detail
-
sig1
SignalHead sig1
-
sig2
SignalHead sig2
-
direction
int direction
-
slow
float slow
-
fast
float fast
-
-
Constructor Detail
-
StoppingBlock
public StoppingBlock(Block b)
-
-
Method Detail
-
handleBlockChange
void handleBlockChange(java.beans.PropertyChangeEvent e)
-
handleSignalChange
void handleSignalChange(java.beans.PropertyChangeEvent e)
-
addSignal
public void addSignal(SignalHead s, int dir)
-
addSignal
public void addSignal(SignalHead s1, SignalHead s2, int dir)
-
fastestAppearance
int fastestAppearance()
-
doStop
void doStop()
Perform the stop operation
-
doSlow
void doSlow()
-
doRestart
void doRestart()
-
setSpeed
void setSpeed(float speed, boolean f1, boolean f2, boolean f3)
-
setSpeeds
public void setSpeeds(float s, float f)
-
-