jmri.jmrit.automat
Class Siglet

java.lang.Object
  extended by jmri.jmrit.automat.AbstractAutomaton
      extended by jmri.jmrit.automat.Siglet
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
BlockBossLogic, JythonSiglet

public class Siglet
extends AbstractAutomaton

A Siglet is a "an embedded signal automation", like an "applet" an embedded application.

Subclasses must load the inputs and outputs arrays during the defineIO method. When any of these change, the Siglet must then recompute and apply the output signal settings.

You can't assume that Siglets run in their own thread; they should not use wait() in any of it's various forms.

Do not assume that Siglets will always inherit from AbstractAutomaton; that may be an implementation artifact.

Do not have any overlap between the items in the input and output lists; this will cause a recursive invocation when the output changes.

Author:
Bob Jacobsen Copyright (C) 2003

Nested Class Summary
 
Nested classes/interfaces inherited from class jmri.jmrit.automat.AbstractAutomaton
AbstractAutomaton.MsgFrame
 
Field Summary
 NamedBean[] inputs
           
 NamedBean[] outputs
           
 
Fields inherited from class jmri.jmrit.automat.AbstractAutomaton
promptOnWait
 
Constructor Summary
Siglet()
           
Siglet(String name)
           
 
Method Summary
 void defineIO()
          User-provided routine to define the input and output objects to be handled.
protected  boolean handle()
          Implements AbstractAutomaton method to wait for state changes and respond.
protected  void init()
          Implements AbstractAutomaton method to initialise connections to the layout.
 void setInputs(NamedBean[] in)
           
 void setOutput()
          User-provided routine to compute new output state and apply it.
 
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
 

Field Detail

inputs

public NamedBean[] inputs

outputs

public NamedBean[] outputs
Constructor Detail

Siglet

public Siglet()

Siglet

public Siglet(String name)
Method Detail

defineIO

public void defineIO()
User-provided routine to define the input and output objects to be handled.


setOutput

public void setOutput()
User-provided routine to compute new output state and apply it.


init

protected void init()
Implements AbstractAutomaton method to initialise connections to the layout.

Overrides:
init in class AbstractAutomaton

handle

protected boolean handle()
Implements AbstractAutomaton method to wait for state changes and respond.

Overrides:
handle in class AbstractAutomaton
Returns:
false to terminate the automaton, for example due to an error.

setInputs

public void setInputs(NamedBean[] in)


Copyright © 1997 - 2008 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: SourceForge_Logo