jmri.jmrit.automat
Class SampleAutomaton
java.lang.Object
jmri.jmrit.automat.AbstractAutomaton
jmri.jmrit.automat.SampleAutomaton
- All Implemented Interfaces:
- Runnable
public class SampleAutomaton
- extends AbstractAutomaton
This sample Automaton watches a Sensor, and adjusts the
state of a Turnout so that it matches the Sensor's state.
The sensor and turnout id's are hardcoded, as this is
an example of just the Automaton function. Adding a GUI
to configure these would be straight-forward. The values
could be passed via the constructor, or the constructor
(which can run in any required thread) could invoke
a dialog.
For test purposes, one of these objects can be
created and invoked by a SampleAutomatonAction.
- Author:
- Bob Jacobsen Copyright (C) 2003
- See Also:
SampleAutomatonAction
|
Method Summary |
protected boolean |
handle()
Watch "sensor", and when it changes adjust "turnout" to match. |
protected void |
init()
This also sets the turnout to the current (initial) state
to make sure everything is consistent at the start. |
| Methods inherited from class jmri.jmrit.automat.AbstractAutomaton |
getCount, getName, getThrottle, readServiceModeCV, run, setName, setTurnouts, start, stop, wait, waitChange, waitMsec, waitSensorActive, waitSensorActive, waitSensorChange, waitSensorChange, waitSensorInactive, waitSensorInactive, waitSensorState, waitSensorState, waitTurnoutConsistent, writeOpsModeCV, writeServiceModeCV |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SampleAutomaton
public SampleAutomaton()
init
protected void init()
This also sets the turnout to the current (initial) state
to make sure everything is consistent at the start.
- Overrides:
init in class AbstractAutomaton
handle
protected boolean handle()
- Watch "sensor", and when it changes adjust "turnout" to match.
- Overrides:
handle in class AbstractAutomaton
- Returns:
- Always returns true to continue operation
Copyright © 1997 - 2009 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: