ptolemy.caltrop.ddi
Class Dataflow

java.lang.Object
  extended byptolemy.caltrop.ddi.AbstractDDI
      extended byptolemy.caltrop.ddi.Dataflow
All Implemented Interfaces:
DDI, Executable

public class Dataflow
extends AbstractDDI
implements DDI

Since:
Ptolemy II 4.0
Version:
$Id: Dataflow.java,v 1.19 2004/04/13 16:45:55 cxh Exp $
Author:
Jörn W. Janneck
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (cxh)

Field Summary
 
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
 
Constructor Summary
Dataflow(CalInterpreter ptActor, caltrop.interpreter.ast.Actor actor, caltrop.interpreter.Context context, caltrop.interpreter.environment.Environment env)
           
 
Method Summary
 void fire()
          Executes the selected action on the first fire() call.
 java.lang.String getName()
          Get the name of the domain that this DDI implements.
 void initialize()
          Begin execution of the actor.
 boolean isLegalActor()
          Perform static checking on the actor, ensuring its validity in a given domain.
 boolean postfire()
          This method should be invoked once per iteration, after the last invocation of fire() in that iteration.
 boolean prefire()
          Select a firable action among the actions of the actor, if possible.
 void preinitialize()
          This method should be invoked exactly once per execution of a model, before any of these other methods are invoked.
 void setupActor()
          Perform any domain dependent setup.
 
Methods inherited from class ptolemy.caltrop.ddi.AbstractDDI
iterate, stop, stopFire, terminate, wrapup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ptolemy.actor.Executable
iterate, stop, stopFire, terminate, wrapup
 

Constructor Detail

Dataflow

public Dataflow(CalInterpreter ptActor,
                caltrop.interpreter.ast.Actor actor,
                caltrop.interpreter.Context context,
                caltrop.interpreter.environment.Environment env)
Method Detail

isLegalActor

public boolean isLegalActor()
Description copied from interface: DDI
Perform static checking on the actor, ensuring its validity in a given domain.

Specified by:
isLegalActor in interface DDI
Returns:
True, if the actor is legal.

setupActor

public void setupActor()
Description copied from interface: DDI
Perform any domain dependent setup. This can include hanging various attributes off of the actor, for example, the rate of the input and output ports.

Specified by:
setupActor in interface DDI

getName

public java.lang.String getName()
Description copied from interface: DDI
Get the name of the domain that this DDI implements.

Specified by:
getName in interface DDI
Returns:
The name of the domain that this DDI implements.

fire

public void fire()
          throws IllegalActionException
Executes the selected action on the first fire() call. On successive calls, it rolls back previous state changes, selects a new action and executes it.

Note: Is this correct behavior? What is the contract between the result of prefire() and successive calls to fire()?

Specified by:
fire in interface Executable
Throws:
IllegalActionException - If an error occurs during the interpretation of the action.

initialize

public void initialize()
                throws IllegalActionException
Description copied from interface: Executable
Begin execution of the actor. This is invoked exactly once after the preinitialization phase. Since type resolution is done in the preinitialization phase, along with topology changes that may be requested by higher-order function actors, an actor can produce output data and schedule events in the initialize() method.

Specified by:
initialize in interface Executable
Throws:
IllegalActionException - If execution is not permitted.

postfire

public boolean postfire()
                 throws IllegalActionException
Description copied from interface: Executable
This method should be invoked once per iteration, after the last invocation of fire() in that iteration. It may produce output data. It returns true if the execution can proceed into the next iteration, false if the actor does not wish to be fired again. This method typically wraps up an iteration, which may involve updating local state. In an opaque, non-atomic entity, it may also transfer output data. The execution of this method is bounded.

Specified by:
postfire in interface Executable
Returns:
True if the execution can continue.
Throws:
IllegalActionException - If postfiring is not permitted.

prefire

public boolean prefire()
                throws IllegalActionException
Select a firable action among the actions of the actor, if possible.

Specified by:
prefire in interface Executable
Returns:
True, if an action could be selected.
Throws:
IllegalActionException - If an error occurred during the action selection.

preinitialize

public void preinitialize()
                   throws IllegalActionException
Description copied from interface: Executable
This method should be invoked exactly once per execution of a model, before any of these other methods are invoked. For actors, this is invoked prior to type resolution and may trigger changes in the topology, changes in the type constraints.

Specified by:
preinitialize in interface Executable
Throws:
IllegalActionException - If initializing is not permitted.