jmri.jmrit.automat
Class SampleAutomaton3
java.lang.Object
jmri.jmrit.automat.AbstractAutomaton
jmri.jmrit.automat.SampleAutomaton3
- All Implemented Interfaces:
- Runnable
public class SampleAutomaton3
- extends AbstractAutomaton
This sample Automaton runs a locomotive back and forth
on a piece of track by watching two sensors.
The sensors and locomotive 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 SampleAutomaton3Action.
- Author:
- Bob Jacobsen Copyright (C) 2003
- See Also:
SampleAutomaton3Action
|
Method Summary |
protected boolean |
handle()
Watch the sensors, and change direction to match. |
protected void |
init()
User-provided initialization routine. |
| 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 |
SampleAutomaton3
public SampleAutomaton3()
init
protected void init()
- Description copied from class:
AbstractAutomaton
- User-provided initialization routine.
This is called exactly once for each object created.
This is where you put all the code that needs to be
run when your object starts up: Finding sensors and turnouts,
getting a throttle, etc.
- Overrides:
init in class AbstractAutomaton
handle
protected boolean handle()
- Watch the sensors, and change direction 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: