jmri.jmrit.automat
Class SampleAutomaton2

java.lang.Object
  extended by jmri.jmrit.automat.AbstractAutomaton
      extended by jmri.jmrit.automat.SampleAutomaton2
All Implemented Interfaces:
Runnable

public class SampleAutomaton2
extends AbstractAutomaton

This sample Automaton watches a Sensor, and adjusts the momentum of a locomotive using ops-mode programming when the sensor state changes.

The sensor and decoder 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 SampleAutomaton2Action.

Author:
Bob Jacobsen Copyright (C) 2003
See Also:
SampleAutomaton2Action

Nested Class Summary
 
Nested classes/interfaces inherited from class jmri.jmrit.automat.AbstractAutomaton
AbstractAutomaton.MsgFrame
 
Field Summary
 
Fields inherited from class jmri.jmrit.automat.AbstractAutomaton
promptOnWait
 
Constructor Summary
SampleAutomaton2()
           
 
Method Summary
protected  boolean handle()
          Watch "sensor", and when it changes the momentum CV to match.
protected  void init()
          By default, monitors sensor "32" and controls locomotive 1234(long).
 
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
 

Constructor Detail

SampleAutomaton2

public SampleAutomaton2()
Method Detail

init

protected void init()
By default, monitors sensor "32" and controls locomotive 1234(long).

Overrides:
init in class AbstractAutomaton

handle

protected boolean handle()
Watch "sensor", and when it changes the momentum CV 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: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads