jmri
Interface Route

All Superinterfaces:
NamedBean
All Known Implementing Classes:
DefaultRoute

public interface Route
extends NamedBean

Routes represent a collection of Turnouts that may be set at the same time.

When a user adds a Turnout to a Route, the user specifies whether the Turnout state is to be set to CLOSED or THROWN when the Route is invoked (set).

Initially, Routes will have a fixed maximum number of sensors for simplicity of implementation. We can revise this later to use Java Collections if this becomes a problem.

To allow control via fascia panel pushbuttons, Routes may optionally be invoked by one or more Sensors (up to the maximum allowed).

A route can be enabled or not. By default it is enabled, and will act when it's specified input conditions become satisfied. When not enabled (the enabled parameter is false), the route will not act even if the specified input conditions are satisfied. When the route transitions from disabled to enabled, it may act, depending on the conditions: Edge triggered conditions will not be satisfied, but level-conditions may be.


This file is part of JMRI.

JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.

JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Author:
Dave Duchamp Copyright (C) 2004, Bob Jacobsen Copyright (C) 2007, Simon Reader Copyright (C) 2008

Field Summary
static int MAX_CONTROL_SENSORS
           
static int ONACTIVE
           
static int ONCHANGE
           
static int ONCLOSED
           
static int ONINACTIVE
           
static int ONTHROWN
           
static int TOGGLE
           
static int VETOACTIVE
           
static int VETOCLOSED
           
static int VETOINACTIVE
           
static int VETOTHROWN
           
 
Fields inherited from interface jmri.NamedBean
INCONSISTENT, UNKNOWN
 
Method Summary
 void activateRoute()
          Activate the Route.
 boolean addOutputSensor(String systemName, int state)
          Add an output Sensor to this Route.
 boolean addOutputTurnout(String systemName, int state)
          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()
          Has at least one lockable turnout.
 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()
          Deactivate the Route.
 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 the lock control Turnout that locks this Route.
 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)
          Get the 'k'th output Sensor of the Route.
 String getOutputSensorByIndex(int index)
          Get an output Sensor system name by Index.
 int getOutputSensorSetState(String systemName)
          Method to get the Set State of an output Sensor.
 int getOutputSensorState(int k)
          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 get the 'k'th output Turnout of the Route.
 String getOutputTurnoutByIndex(int index)
          Get an output Turnout system name by Index.
 int getOutputTurnoutSetState(String systemName)
          Method to get the Set State of an output Turnout.
 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.
 int getRouteSensorMode(int index)
          Method to get the mode of a particular Sensor in this Route.
 String getRouteSensorName(int index)
          Method to get the SystemName of a control Sensor in this Route.
 String getTurnoutsAlignedSensor()
          Method to get system name of turnouts aligned sensor.
 boolean isOutputSensorIncluded(String systemName)
          Inquire if a Sensor is included in this Route as an output.
 boolean isOutputTurnoutIncluded(String systemName)
          Inquire if a Turnout is included in this Route as an output.
 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 state)
          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 the lock control Turnout that locks this Route.
 void setLocked(boolean state)
          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.
 void setRouteCommandDelay(int delay)
          Method to set delay (milliseconds) between issuing Turnout commands.
 void setTurnoutsAlignedSensor(String sensorSystemName)
          Method to set turnouts aligned sensor
 
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, dispose, getComment, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyKeys, getState, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setState, setUserName, updateListenerRef
 

Field Detail

TOGGLE

static final int TOGGLE
See Also:
Constant Field Values

MAX_CONTROL_SENSORS

static final int MAX_CONTROL_SENSORS
See Also:
Constant Field Values

ONACTIVE

static final int ONACTIVE
See Also:
Constant Field Values

ONINACTIVE

static final int ONINACTIVE
See Also:
Constant Field Values

VETOACTIVE

static final int VETOACTIVE
See Also:
Constant Field Values

VETOINACTIVE

static final int VETOINACTIVE
See Also:
Constant Field Values

ONCHANGE

static final int ONCHANGE
See Also:
Constant Field Values

ONCLOSED

static final int ONCLOSED
See Also:
Constant Field Values

ONTHROWN

static final int ONTHROWN
See Also:
Constant Field Values

VETOCLOSED

static final int VETOCLOSED
See Also:
Constant Field Values

VETOTHROWN

static final int VETOTHROWN
See Also:
Constant Field Values
Method Detail

setEnabled

void setEnabled(boolean state)
Set enabled status.


getEnabled

boolean getEnabled()
Get enabled status


setLocked

void setLocked(boolean state)
Set locked status.


getLocked

boolean getLocked()
Get locked status.


canLock

boolean canLock()
Has at least one lockable turnout.


addOutputTurnout

boolean addOutputTurnout(String systemName,
                         int state)
Add an output Turnout to this Route.

Parameters:
systemName - The turnout system name
state - must be Turnout.CLOSED, Turnout.THROWN, or Route.TOGGLE, which determines how the Turnout is to be switched when this Route is set

clearOutputTurnouts

void clearOutputTurnouts()
Delete all output Turnouts from this Route.


getNumOutputTurnouts

int getNumOutputTurnouts()

isOutputTurnoutIncluded

boolean isOutputTurnoutIncluded(String systemName)
Inquire if a Turnout is included in this Route as an output.


getOutputTurnoutSetState

int getOutputTurnoutSetState(String systemName)
Method to get the Set State of an output Turnout.

Returns:
-1 if the Turnout is not found

getOutputTurnoutByIndex

String getOutputTurnoutByIndex(int index)
Get an output Turnout system name by Index.

Returns:
null if there is no turnout with that index

getOutputTurnout

Turnout getOutputTurnout(int k)
Method to get the 'k'th output Turnout of the Route.

Returns:
null if there are less than 'k' Turnouts defined

getOutputTurnoutState

int getOutputTurnoutState(int k)
Method to get the desired state of 'k'th Turnout of the Route.

Returns:
-1 if there are less than 'k' Turnouts defined

addOutputSensor

boolean addOutputSensor(String systemName,
                        int state)
Add an output Sensor to this Route.

Parameters:
systemName - The sensor system name
state - must be Sensor.ACTIVE, Sensor.INACTIVE, or Route.TOGGLE, which determines how the Sensor is to be switched when this Route is set

clearOutputSensors

void clearOutputSensors()
Delete all output Sensors from this Route.


getNumOutputSensors

int getNumOutputSensors()

isOutputSensorIncluded

boolean isOutputSensorIncluded(String systemName)
Inquire if a Sensor is included in this Route as an output.


getOutputSensorSetState

int getOutputSensorSetState(String systemName)
Method to get the Set State of an output Sensor.

Returns:
-1 if the Sensor is not found

getOutputSensorByIndex

String getOutputSensorByIndex(int index)
Get an output Sensor system name by Index.

Returns:
null if there is no sensor with that index

getOutputSensor

Sensor getOutputSensor(int k)
Get the 'k'th output Sensor of the Route.

Returns:
null if there are less than 'k' Sensor defined

getOutputSensorState

int getOutputSensorState(int k)
Get the desired state of 'k'th Sensor of the Route.

Returns:
-1 if there are less than 'k' Sensors defined

setOutputScriptName

void setOutputScriptName(String filename)
Set name of script file to be run when Route is fired.


getOutputScriptName

String getOutputScriptName()
Get name of script file to be run when Route is fired.


setOutputSoundName

void setOutputSoundName(String filename)
Set name of sound file to be played when Route is fired.


getOutputSoundName

String getOutputSoundName()
Get name of sound file to be played when Route is fired.


setTurnoutsAlignedSensor

void setTurnoutsAlignedSensor(String sensorSystemName)
Method to set turnouts aligned sensor


getTurnoutsAlignedSensor

String getTurnoutsAlignedSensor()
Method to get system name of turnouts aligned sensor.


addSensorToRoute

boolean addSensorToRoute(String sensorSystemName,
                         int mode)
Method to add a Sensor to the list of control Sensors for this Route.


clearRouteSensors

void clearRouteSensors()
Method to delete all control Sensors from this Route.


getRouteSensorName

String getRouteSensorName(int index)
Method to get the SystemName of a control Sensor in this Route.

Parameters:
index - The index in the Sensor array of the requested Sensor.
Returns:
null If there is no Sensor with that 'index', or if 'index' is not in the range 0 thru MAX_SENSORS-1.

getRouteSensorMode

int getRouteSensorMode(int index)
Method to get the mode of a particular Sensor in this Route.

Parameters:
index - The index in the Sensor array of the requested Sensor.
Returns:
ONACTIVE if there is no Sensor with that 'index', or if 'index' is not in the range 0 thru MAX_SENSORS-1

setControlTurnout

void setControlTurnout(String turnoutSystemName)
Method to set the SystemName of a control Turnout for this Route.


getControlTurnout

String getControlTurnout()
Method to get the SystemName of a control Turnout for this Route.


setControlTurnoutState

void setControlTurnoutState(int turnoutState)
Method to set the State of control Turnout that fires this Route.


getControlTurnoutState

int getControlTurnoutState()
Method to get the State of control Turnout that fires this Route.


setLockControlTurnout

void setLockControlTurnout(String turnoutSystemName)
Method to set the SystemName of a lock control Turnout for this Route.


getLockControlTurnout

String getLockControlTurnout()
Method to get the SystemName of a lock control Turnout for this Route.


setLockControlTurnoutState

void setLockControlTurnoutState(int turnoutState)
Method to set the State of the lock control Turnout that locks this Route.


getLockControlTurnoutState

int getLockControlTurnoutState()
Method to get the State of the lock control Turnout that locks this Route.


setRouteCommandDelay

void setRouteCommandDelay(int delay)
Method to set delay (milliseconds) between issuing Turnout commands.


getRouteCommandDelay

int getRouteCommandDelay()
Method to get delay (milliseconds) between issuing Turnout commands.


setRoute

void setRoute()
Method to set the Route.

Sets all Route Turnouts to the state shown in the Route definition.


activateRoute

void activateRoute()
Activate the Route.

This starts route processing by connecting to inputs, etc. A Route must be activated before it will fire.


deActivateRoute

void deActivateRoute()
Deactivate the Route.

This disconnects the Route from all other objects and stops it from processing. A Route must be deactivated before it's input and output definitions are changed.



Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads