ptolemy.caltrop.ddi
Class DDF

java.lang.Object
  extended by ptolemy.caltrop.ddi.AbstractDDI
      extended by ptolemy.caltrop.ddi.Dataflow
          extended by ptolemy.caltrop.ddi.DataflowWithRates
              extended by ptolemy.caltrop.ddi.DDF
All Implemented Interfaces:
Executable, Initializable, DDI

public class DDF
extends DataflowWithRates

A plugin for the DDF domain. In DDF, a CAL actor is valid if:

  1. The guards of each action do not depend on the inputs.
  2. The rates of each action do not depend on the inputs.
This plugin also adds attributes containing rate information to the ports of the actor.

Since:
Ptolemy II 5.2
Version:
$Id: DDF.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Steve Neuendorffer
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (cxh)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.caltrop.ddi.DataflowWithRates
DataflowWithRates.ActionRateSignature
 
Field Summary
private  DataflowWithRates.ActionRateSignature _currentSignature
           
private static DataflowWithRates.ActionRateSignature _zeroRateSignature
           
 
Fields inherited from class ptolemy.caltrop.ddi.Dataflow
_actions, _actor, _actorInterpreter, _context, _currentStateSet, _currentTransitions, _env, _inputPorts, _lastFiredAction, _outputPorts, _ptActor
 
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
 
Constructor Summary
DDF(TypedAtomicActor ptActor, caltrop.interpreter.ast.Actor actor, caltrop.interpreter.Context context, caltrop.interpreter.environment.Environment env)
          Create an new DDF DDI.
 
Method Summary
protected  boolean _hasInputDependentGuard()
           
 java.lang.String getName()
          Get the name of this DDI.
 void initialize()
          Initialize the actor and select the first action to fire.
 boolean isLegalActor()
          In DDF, an actor is legal if: The guards of each action do not depend on the inputs.
 boolean postfire()
          Postfire this actor.
 boolean prefire()
          Select a firable action among the actions of the actor, if possible.
 void setupActor()
          Setup the actor associated with this DDI.
 
Methods inherited from class ptolemy.caltrop.ddi.DataflowWithRates
_allEqual, _annotatePortsWithRates, _atLeastOneUnguardedAction, _checkInitializerGuards, _computeActionRates, _computeActionRates, _isBoundByPortVar
 
Methods inherited from class ptolemy.caltrop.ddi.Dataflow
_selectAction, _selectInitializer, fire, preinitialize
 
Methods inherited from class ptolemy.caltrop.ddi.AbstractDDI
addInitializable, isFireFunctional, isStrict, iterate, removeInitializable, stop, stopFire, terminate, wrapup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_currentSignature

private DataflowWithRates.ActionRateSignature _currentSignature

_zeroRateSignature

private static DataflowWithRates.ActionRateSignature _zeroRateSignature
Constructor Detail

DDF

public DDF(TypedAtomicActor ptActor,
           caltrop.interpreter.ast.Actor actor,
           caltrop.interpreter.Context context,
           caltrop.interpreter.environment.Environment env)
Create an new DDF DDI.

Parameters:
ptActor - The instance of ptolemy.actor.Actor that the plugin will be associated with.
actor - The abstract syntax tree of the CAL source.
context - The context that the plugin will use.
env - The environment that the plugin will use.
Method Detail

initialize

public void initialize()
                throws IllegalActionException
Initialize the actor and select the first action to fire. Publish rate information for this actor according to the action.

Specified by:
initialize in interface Initializable
Overrides:
initialize in class Dataflow
Throws:
IllegalActionException

isLegalActor

public boolean isLegalActor()
In DDF, an actor is legal if:
  1. The guards of each action do not depend on the inputs.
  2. The rates of each action do not depend on the inputs.

Specified by:
isLegalActor in interface DDI
Overrides:
isLegalActor in class Dataflow
Returns:
True if the actor associated with this DDI is a legal DDF actor.

getName

public java.lang.String getName()
Get the name of this DDI.

Specified by:
getName in interface DDI
Overrides:
getName in class Dataflow
Returns:
"DDF".

postfire

public boolean postfire()
                 throws IllegalActionException
Postfire this actor.

Specified by:
postfire in interface Executable
Overrides:
postfire in class Dataflow
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
Overrides:
prefire in class Dataflow
Returns:
True, if an action could be selected.
Throws:
IllegalActionException - If an error occurred during the action selection.

setupActor

public void setupActor()
Setup the actor associated with this DDI. Assumes that isLegalActor() is called first.

Setup involves attaching attributes with token consumption/production rates to the input and output ports of the actor associated with this DDI.

Specified by:
setupActor in interface DDI
Overrides:
setupActor in class Dataflow

_hasInputDependentGuard

protected boolean _hasInputDependentGuard()