|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.implementation.AbstractNamedBean
jmri.implementation.DefaultRoute
public class DefaultRoute
| Field Summary | |
|---|---|
protected String |
mControlTurnout
Persistant instance variables (saved between runs) |
protected int |
mControlTurnoutState
|
protected int |
mDelay
|
protected String |
mLockControlTurnout
|
protected int |
mLockControlTurnoutState
|
protected Turnout |
mLockTurnout
|
protected PropertyChangeListener |
mLockTurnoutListener
|
protected Turnout |
mTurnout
|
protected PropertyChangeListener |
mTurnoutListener
|
protected String |
mTurnoutsAlignedSensor
|
protected String |
scriptFilename
|
protected String |
soundFilename
|
| Fields inherited from interface jmri.Route |
|---|
MAX_CONTROL_SENSORS, ONACTIVE, ONCHANGE, ONCLOSED, ONINACTIVE, ONTHROWN, TOGGLE, VETOACTIVE, VETOCLOSED, VETOINACTIVE, VETOTHROWN |
| Fields inherited from interface jmri.NamedBean |
|---|
INCONSISTENT, UNKNOWN |
| Constructor Summary | |
|---|---|
DefaultRoute(String systemName)
|
|
DefaultRoute(String systemName,
String userName)
|
|
| Method Summary | |
|---|---|
void |
activateRoute()
Method to activate the Route via Sensors and control Turnout Sets up for Route activation based on a list of Sensors and a control Turnout Registers to receive known state changes for output turnouts |
boolean |
addOutputSensor(String systemName,
int state)
Add an output Sensor to this Route |
boolean |
addOutputTurnout(String turnoutSystemName,
int turnoutState)
Add an output Turnout to this Route |
boolean |
addSensorToRoute(String sensorSystemName,
int mode)
Method to add a Sensor to the list of control Sensors for this Route. |
boolean |
canLock()
Determine if route can be locked. |
protected void |
checkSensor(int newState,
int oldState,
Sensor sensor)
Handle sensor update event to see if that will set the route. |
void |
checkTurnoutAlignment()
Method to check if the turnouts for this route are correctly aligned. |
void |
clearOutputSensors()
Delete all output Sensors from this Route |
void |
clearOutputTurnouts()
Delete all output Turnouts from this Route |
void |
clearRouteSensors()
Method to delete all control Sensors from this Route |
void |
deActivateRoute()
Method to deactivate the Route Deactivates Route based on a list of Sensors and two control Turnouts |
String |
getControlTurnout()
Method to get the SystemName of a control Turnout for this Route |
int |
getControlTurnoutState()
Method to get the State of control Turnout that fires this Route |
boolean |
getEnabled()
Get enabled status |
String |
getLockControlTurnout()
Method to get the SystemName of a lock control Turnout for this Route |
int |
getLockControlTurnoutState()
Method to get the State of lock control Turnout |
boolean |
getLocked()
Get locked status. |
int |
getNumOutputSensors()
|
int |
getNumOutputTurnouts()
|
String |
getOutputScriptName()
Get name of script file to be run when Route is fired |
Sensor |
getOutputSensor(int k)
Method to return the 'k'th Sensor of the Route. |
String |
getOutputSensorByIndex(int index)
Method to get an ouput Sensor system name by Index Returns null if there is no sensor with that index |
int |
getOutputSensorSetState(String name)
Method to get the Set State of a Sensor included in this Route If the Sensor is not found, -1 is returned. |
int |
getOutputSensorState(int k)
Method to get the desired state of 'k'th Sensor of the Route. |
String |
getOutputSoundName()
Get name of sound file to be played when Route is fired |
Turnout |
getOutputTurnout(int k)
Method to return the 'k'th Turnout of the Route. |
String |
getOutputTurnoutByIndex(int index)
Method to get a Route Turnout System Name by Index Returns null if there is no turnout with that index |
int |
getOutputTurnoutSetState(String name)
Method to get the Set State of a Turnout included in this Route Noth the input and internal names can be either a user or system name |
int |
getOutputTurnoutState(int k)
Method to get the desired state of 'k'th Turnout of the Route. |
int |
getRouteCommandDelay()
Method to get delay (milliseconds) between issuing Turnout commands |
Sensor |
getRouteSensor(int index)
Method to get the control Sensor in this Route 'index' is the index in the Sensor array of the requested Sensor. |
int |
getRouteSensorMode(int index)
Method to get the mode associated with a control Sensor in this Route 'index' is the index in the Sensor array of the requested Sensor. |
String |
getRouteSensorName(int index)
Method to get the SystemName of a control Sensor in this Route 'index' is the index in the Sensor array of the requested Sensor. |
int |
getState()
Not needed for Routes - included to complete implementation of the NamedBean interface. |
String |
getTurnoutsAlignedSensor()
Method to get turnouts aligned sensor |
boolean |
isOutputSensorIncluded(String systemName)
Method to inquire if a Sensor is included in this Route |
boolean |
isOutputTurnoutIncluded(String turnoutName)
Method to inquire if a Turnout is included in this Route. |
boolean |
isRouteBusy()
Method to query if Route is busy (returns true if commands are being issued to Route turnouts) |
void |
setControlTurnout(String turnoutSystemName)
Method to set the SystemName of a control Turnout for this Route |
void |
setControlTurnoutState(int turnoutState)
Method to set the State of control Turnout that fires this Route |
void |
setEnabled(boolean v)
Set enabled status. |
void |
setLockControlTurnout(String turnoutSystemName)
Method to set the SystemName of a lock control Turnout for this Route |
void |
setLockControlTurnoutState(int turnoutState)
Method to set the State of lock control Turnout |
void |
setLocked(boolean v)
Set locked status. |
void |
setOutputScriptName(String filename)
Set name of script file to be run when Route is fired |
void |
setOutputSoundName(String filename)
Set name of sound file to be played when Route is fired |
void |
setRoute()
Method to set the Route Sets all Route Turnouts to the state shown in the Route definition This call is ignored if the Route is 'busy', i.e., if there is a thread currently sending commands to this Route's turnouts. |
void |
setRouteBusy()
Method to set Route busy when commands are being issued to Route turnouts |
void |
setRouteCommandDelay(int delay)
Method to set delay (milliseconds) between issuing Turnout commands |
void |
setRouteNotBusy()
Method to set Route not busy when all commands have been issued to Route turnouts |
void |
setState(int state)
Not needed for Routes - included to complete implementation of the NamedBean interface. |
void |
setTurnoutsAlignedSensor(String sensorSystemName)
Method to set turnouts aligned sensor |
| Methods inherited from class jmri.implementation.AbstractNamedBean |
|---|
addPropertyChangeListener, dispose, firePropertyChange, getComment, getDisplayName, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setUserName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface jmri.NamedBean |
|---|
addPropertyChangeListener, dispose, getComment, getDisplayName, getNumPropertyChangeListeners, getProperty, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setUserName |
| Field Detail |
|---|
protected String mControlTurnout
protected int mControlTurnoutState
protected int mDelay
protected String mLockControlTurnout
protected int mLockControlTurnoutState
protected String mTurnoutsAlignedSensor
protected String soundFilename
protected String scriptFilename
protected Turnout mTurnout
protected PropertyChangeListener mTurnoutListener
protected Turnout mLockTurnout
protected PropertyChangeListener mLockTurnoutListener
| Constructor Detail |
|---|
public DefaultRoute(String systemName,
String userName)
public DefaultRoute(String systemName)
| Method Detail |
|---|
public boolean getEnabled()
Route
getEnabled in interface Routepublic void setEnabled(boolean v)
Route
setEnabled in interface Routepublic boolean getLocked()
Route
getLocked in interface Routepublic void setLocked(boolean v)
Route
setLocked in interface Routepublic boolean canLock()
canLock in interface Route
public boolean addOutputTurnout(String turnoutSystemName,
int turnoutState)
addOutputTurnout in interface RouteturnoutSystemName - The turnout system nameturnoutState - must be Turnout.CLOSED, Turnout.THROWN, or Route.TOGGLE,
which determines how the Turnout is to be switched when this Route is setpublic void clearOutputTurnouts()
clearOutputTurnouts in interface Routepublic int getNumOutputTurnouts()
getNumOutputTurnouts in interface Routepublic String getOutputTurnoutByIndex(int index)
getOutputTurnoutByIndex in interface Routepublic boolean isOutputTurnoutIncluded(String turnoutName)
Complicated by the fact that either the argument or the internal names might be user or system names
isOutputTurnoutIncluded in interface Routepublic int getOutputTurnoutSetState(String name)
Noth the input and internal names can be either a user or system name
getOutputTurnoutSetState in interface Routepublic Turnout getOutputTurnout(int k)
getOutputTurnout in interface Routepublic int getOutputTurnoutState(int k)
getOutputTurnoutState in interface Route
public boolean addOutputSensor(String systemName,
int state)
addOutputSensor in interface RoutesystemName - The sensor system namestate - must be Sensor.ACTIVE, Sensor.INACTIVE, or Route.TOGGLE,
which determines how the Sensor is to be set when this Route is setpublic void clearOutputSensors()
clearOutputSensors in interface Routepublic int getNumOutputSensors()
getNumOutputSensors in interface Routepublic String getOutputSensorByIndex(int index)
getOutputSensorByIndex in interface Routepublic boolean isOutputSensorIncluded(String systemName)
isOutputSensorIncluded in interface Routepublic int getOutputSensorSetState(String name)
Both the input or internal names can be either system or user names
getOutputSensorSetState in interface Routepublic Sensor getOutputSensor(int k)
getOutputSensor in interface Routepublic int getOutputSensorState(int k)
getOutputSensorState in interface Routepublic void setOutputScriptName(String filename)
setOutputScriptName in interface Routepublic String getOutputScriptName()
getOutputScriptName in interface Routepublic void setOutputSoundName(String filename)
setOutputSoundName in interface Routepublic String getOutputSoundName()
getOutputSoundName in interface Routepublic void setTurnoutsAlignedSensor(String sensorSystemName)
setTurnoutsAlignedSensor in interface Routepublic String getTurnoutsAlignedSensor()
getTurnoutsAlignedSensor in interface Routepublic void clearRouteSensors()
clearRouteSensors in interface Route
public boolean addSensorToRoute(String sensorSystemName,
int mode)
addSensorToRoute in interface RoutesensorSystemName - nominally a system name, we'll try to
convert this to a system name if it's not already onepublic String getRouteSensorName(int index)
getRouteSensorName in interface Routeindex - The index in the Sensor array of the requested
Sensor.
public Sensor getRouteSensor(int index)
public int getRouteSensorMode(int index)
getRouteSensorMode in interface Routeindex - The index in the Sensor array of the requested
Sensor.
public void setControlTurnout(String turnoutSystemName)
setControlTurnout in interface Routepublic String getControlTurnout()
getControlTurnout in interface Routepublic void setLockControlTurnout(String turnoutSystemName)
setLockControlTurnout in interface Routepublic String getLockControlTurnout()
getLockControlTurnout in interface Routepublic void setRouteCommandDelay(int delay)
setRouteCommandDelay in interface Routepublic int getRouteCommandDelay()
getRouteCommandDelay in interface Routepublic void setControlTurnoutState(int turnoutState)
setControlTurnoutState in interface Routepublic int getControlTurnoutState()
getControlTurnoutState in interface Routepublic void setLockControlTurnoutState(int turnoutState)
setLockControlTurnoutState in interface Routepublic int getLockControlTurnoutState()
getLockControlTurnoutState in interface Routepublic void setRoute()
setRoute in interface Route
protected void checkSensor(int newState,
int oldState,
Sensor sensor)
Called when a "KnownState" event is received, it assumes that only one sensor is changing right now, so can use state calls for everything other than this sensor.
This will fire the route if the conditions are correct
Returns noting explicitly, but has the side effect of firing route
public void checkTurnoutAlignment()
public void activateRoute()
activateRoute in interface Routepublic void deActivateRoute()
deActivateRoute in interface Routepublic void setRouteBusy()
public void setRouteNotBusy()
public boolean isRouteBusy()
public int getState()
getState in interface NamedBeanpublic void setState(int state)
setState in interface NamedBean
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||