Triveni

triveni
Class Expr

java.lang.Object
  |
  +--triveni.Communicator
        |
        +--triveni.Expr
Direct Known Subclasses:
Act, Await, AwaitOne, Building, CarryCounter, Controllable, CounterExpr, Done, Emit, Init, Local, Loop, Nil, Office, Parallel, Rename, Sequence, SuspendResume, Switch, Watching

public abstract class Expr
extends Communicator

The Expr class is the abstract superclass of all Triveni expression classes. A Triveni expression is a software component that has event-driven reactive behavior. A Triveni expression may or may not have a graphical user interface or any other subcomponents.

A class for a custom Triveni expression is usually declared by subclassing from Expr and providing any necessary instance variables for the object-oriented aspects of the expression. The event-driven aspects of the expression are then provided, usually in the constructor, by using the method become with a Triveni expression that describes the desired behavior. Code that interacts with the object-oriented aspects of a Triveni expression may be embedded in the event-driven behavior in the form of actions, emitters, predicates, and valuators.

Users should override clone if cloning capabilities are required.

See Also:
Activity, Action, Emitter, LabeledEvent, Predicate, Valuator

Constructor Summary
Expr()
           
 
Method Summary
protected  void addNewActExpressions(Expr e)
          Reserved for future use.
protected  void become(Expr e)
          Assume the event-driven behavior of the given expression.
 java.lang.Object clone()
           
 void printFSM()
          Reserved for debugging purposes.
 void setOnQuiescence(java.lang.Runnable onQuiescence)
          This method is used to provide code in the form of a Runnable to be executed each time this expression becomes quiescent after the occurrence of an event.
 void setTracer(LabeledListener v)
          Sets a listener to trace all non-internal events occuring in this Triveni expression.
 void spawn()
          Starts the Triveni expression in a non-blocking form in a new thread.
 void start()
          Starts the Triveni expression with a default initial event and blocks until the expression terminates.
protected  void start(LabeledEvent evt)
          Starts the Triveni expression with the given initial event and blocks until the expression terminates.
 void update(LabeledEvent evt)
          Invoked when an event occurs.
 
Methods inherited from class triveni.Communicator
addLabeledListener, addRelevantLabel, addRelevantLabels, fireEvent, getRelevantLabels, removeLabeledListener, removeRelevantLabel, setRelevantLabels, setRelevantLabels
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Expr

public Expr()
Method Detail

setOnQuiescence

public final void setOnQuiescence(java.lang.Runnable onQuiescence)
This method is used to provide code in the form of a Runnable to be executed each time this expression becomes quiescent after the occurrence of an event. To turn off quiescence detection, this method is invoked with a null argument.
Parameters:
onQuiescence - the Runnable to be invoked on each quiescence.

become

protected void become(Expr e)
Assume the event-driven behavior of the given expression. Subclasses should override this method if they add instance variables.

addNewActExpressions

protected void addNewActExpressions(Expr e)
Reserved for future use.

printFSM

public final void printFSM()
Reserved for debugging purposes.

start

public final void start()
                 throws java.lang.InterruptedException
Starts the Triveni expression with a default initial event and blocks until the expression terminates.
Throws:
java.lang.InterruptedException - if the current thread is interrupted.

spawn

public final void spawn()
Starts the Triveni expression in a non-blocking form in a new thread.

update

public void update(LabeledEvent evt)
            throws java.lang.InterruptedException
Invoked when an event occurs.
Throws:
java.lang.InterruptedException - if the current thread is interrupted.

start

protected final void start(LabeledEvent evt)
                    throws java.lang.InterruptedException
Starts the Triveni expression with the given initial event and blocks until the expression terminates.
Parameters:
evt - the initial event.
Throws:
java.lang.InterruptedException - if the current thread is interrupted.

setTracer

public void setTracer(LabeledListener v)
Sets a listener to trace all non-internal events occuring in this Triveni expression. To turn off tracing, a null listener is used.

clone

public java.lang.Object clone()
Overrides:
clone in class Communicator

Triveni

http://www.cs.luc.edu/triveni/