|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.implementation.AbstractNamedBean
jmri.jmrit.logix.Warrant
public class Warrant
An Warrant contains the operating permissions and directives needed for a train to proceed from an Origin to a Destination
Version 1.11 - remove setting of SignalHeads
| Field Summary | |
|---|---|
protected List<ThrottleSetting> |
_commands
|
protected int |
_idxCurrentOrder
|
protected boolean |
_tempRunBlind
|
protected float |
_throttleFactor
|
static int |
ABORT
|
static int |
HALT
|
static int |
MODE_LEARN
|
static int |
MODE_MANUAL
|
static int |
MODE_NONE
|
static int |
MODE_RUN
|
static int |
RESUME
|
static int |
RUNNING
|
static int |
SPEED_RESTRICTED
|
static int |
WAIT_FOR_CLEAR
|
static int |
WAIT_FOR_TRAIN
|
| Fields inherited from class jmri.implementation.AbstractNamedBean |
|---|
mSystemName, mUserName |
| Fields inherited from interface jmri.NamedBean |
|---|
INCONSISTENT, UNKNOWN |
| Constructor Summary | |
|---|---|
Warrant(String sName,
String uName)
Create an object with no route defined. |
|
| Method Summary | |
|---|---|
void |
addBlockOrder(BlockOrder order)
Add permanently saved BlockOrder |
void |
addThrottleCommand(ThrottleSetting ts)
|
String |
allocateRoute()
Allocate the current saved blocks of this warrant. |
void |
clearAll()
|
boolean |
controlRunTrain(int idx)
Pause and resume auto-running train or abort any allocation state _engineer.abort() calls setRunMode(MODE_NONE,...) which calls deallocate all. |
void |
deAllocate()
Deallocates blocks from the current BlockOrder list |
protected void |
fireRunStatus(String property,
Object old,
Object status)
Engineer reports its status |
BlockOrder |
getAvoidOrder()
|
protected OBlock |
getBlockAt(int idx)
Call is only valid when in MODE_LEARN and MODE_RUN |
protected BlockOrder |
getBlockOrderAt(int index)
Call is only valid when in MODE_LEARN and MODE_RUN |
BlockOrder |
getCurrentBlockOrder()
Call is only valid when in MODE_LEARN and MODE_RUN |
int |
getCurrentCommandIndex()
|
int |
getCurrentOrderIndex()
|
DccLocoAddress |
getDccAddress()
|
BlockOrder |
getfirstOrder()
Return permanently saved Origin |
protected int |
getIndexOfBlock(OBlock block)
Call is only valid when in MODE_LEARN and MODE_RUN |
protected int |
getIndexOfBlock(String name)
Call is only valid when in MODE_LEARN and MODE_RUN |
BlockOrder |
getLastOrder()
Return permanently saved Destination |
List<BlockOrder> |
getOrders()
Return permanently saved BlockOrders |
protected String |
getRoutePathInBlock(OBlock block)
|
boolean |
getRunBlind()
|
int |
getRunMode()
Methods for running trains |
String |
getRunningMessage()
|
static SignalSpeedMap |
getSpeedMap()
|
int |
getState()
Provide generic access to internal state. |
List<ThrottleSetting> |
getThrottleCommands()
|
String |
getTrainId()
|
String |
getTrainName()
|
BlockOrder |
getViaOrder()
Return permanently saved BlockOrder that must be included in the route |
protected void |
goingActive(OBlock block)
Block in the route is going active. |
protected void |
goingInactive(OBlock block)
Block in the route is going Inactive |
boolean |
hasRouteSet()
Turnouts and signals are set for the route |
boolean |
isAllocated()
Listeners are installed for the route |
void |
notifyFailedThrottleRequest(DccLocoAddress address,
String reason)
Get notification that an attempt to request a throttle has failed |
void |
notifyThrottleFound(DccThrottle throttle)
Get notification that a throttle has been found as you requested. |
void |
propertyChange(PropertyChangeEvent evt)
|
boolean |
routeIsFree()
Test if the permanent saved blocks of this warrant are free (unoccupied and unallocated) |
boolean |
routeIsOccupied()
Test if the permanent saved blocks of this warrant are occupied |
String |
runAutoTrain(boolean run)
Starts or ends an automated train run. |
void |
setAvoidOrder(BlockOrder order)
|
void |
setDccAddress(DccLocoAddress address)
|
String |
setRoute(int delay,
List<BlockOrder> orders)
Set the route paths and turnouts for the warrant. |
void |
setRunBlind(boolean runBlind)
|
protected String |
setRunMode(int mode,
DccLocoAddress address,
LearnThrottleFrame student,
List<ThrottleSetting> commands,
boolean runBlind)
Sets up recording and playing back throttle commands - also cleans up afterwards. |
void |
setState(int state)
Provide generic access to internal state. |
String |
setThrottleFactor(String sFactor)
|
boolean |
setTrainId(String id)
|
void |
setTrainName(String name)
|
void |
setViaOrder(BlockOrder order)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean _tempRunBlind
protected float _throttleFactor
protected List<ThrottleSetting> _commands
protected int _idxCurrentOrder
public static final int MODE_NONE
public static final int MODE_LEARN
public static final int MODE_RUN
public static final int MODE_MANUAL
public static final int HALT
public static final int RESUME
public static final int ABORT
public static final int WAIT_FOR_TRAIN
public static final int RUNNING
public static final int SPEED_RESTRICTED
public static final int WAIT_FOR_CLEAR
| Constructor Detail |
|---|
public Warrant(String sName,
String uName)
| Method Detail |
|---|
public static final SignalSpeedMap getSpeedMap()
public int getState()
NamedBeanThis generally shouldn't be used by Java code; use the class-specific form instead. (E.g. getCommandedState in Turnout) This provided to make Jython script access easier to read.
getState in interface NamedBeanpublic void setState(int state)
NamedBeanThis generally shouldn't be used by Java code; use the class-specific form instead. (E.g. setCommandedState in Turnout) This provided to make Jython script access easier to read.
setState in interface NamedBeanpublic void clearAll()
public List<BlockOrder> getOrders()
public void addBlockOrder(BlockOrder order)
public BlockOrder getfirstOrder()
public BlockOrder getLastOrder()
public BlockOrder getViaOrder()
public void setViaOrder(BlockOrder order)
public BlockOrder getAvoidOrder()
public void setAvoidOrder(BlockOrder order)
protected String getRoutePathInBlock(OBlock block)
public BlockOrder getCurrentBlockOrder()
public int getCurrentOrderIndex()
protected int getIndexOfBlock(OBlock block)
protected int getIndexOfBlock(String name)
protected BlockOrder getBlockOrderAt(int index)
protected OBlock getBlockAt(int idx)
public List<ThrottleSetting> getThrottleCommands()
public void addThrottleCommand(ThrottleSetting ts)
public String getTrainName()
public void setTrainName(String name)
public String getTrainId()
public boolean setTrainId(String id)
id - may be either Roster entry or DCC address
public DccLocoAddress getDccAddress()
public void setDccAddress(DccLocoAddress address)
public boolean getRunBlind()
public void setRunBlind(boolean runBlind)
public String setThrottleFactor(String sFactor)
protected void fireRunStatus(String property,
Object old,
Object status)
public boolean isAllocated()
public boolean hasRouteSet()
public boolean routeIsFree()
public boolean routeIsOccupied()
public int getRunMode()
public String runAutoTrain(boolean run)
run - set Run throttle command or Stop
public String getRunningMessage()
public int getCurrentCommandIndex()
protected String setRunMode(int mode,
DccLocoAddress address,
LearnThrottleFrame student,
List<ThrottleSetting> commands,
boolean runBlind)
Rule for (auto) MODE_RUN: 1. At least the Origin block must be owned (allocated) by this warrant. (block._warrant == this) and path set for Run Mode Rule for (auto) LEARN_RUN: 2. Entire Route must be allocated and Route Set for Learn Mode. i.e. this warrant has listeners on all block sensors in the route. Rule for MODE_MANUAL The Origin block must be allocated to this warrant and path set for the route
public boolean controlRunTrain(int idx)
public void notifyThrottleFound(DccThrottle throttle)
ThrottleListener
notifyThrottleFound in interface ThrottleListenerthrottle - An instantiation of the DccThrottle with the address requested.
public void notifyFailedThrottleRequest(DccLocoAddress address,
String reason)
ThrottleListener
notifyFailedThrottleRequest in interface ThrottleListeneraddress - DccLocoAddress of the failed loco request.reason - The reason why the throttle request failed.public String allocateRoute()
public void deAllocate()
public String setRoute(int delay,
List<BlockOrder> orders)
delay - - delay in seconds, between setting signals and throwing turnoutsorders - - BlockOrder list of route. If null, use permanent warrant copy.
public void propertyChange(PropertyChangeEvent evt)
propertyChange in interface PropertyChangeListenerprotected void goingActive(OBlock block)
protected void goingInactive(OBlock block)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||