ptolemy.caltrop.ddi
Class DataflowWithRates

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

public class DataflowWithRates
extends Dataflow

A base class that provides support for dataflow models that publish external rate information. This includes SDF (where the rates are constant) and DDF (where the rates are published once an action is selected.

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

Nested Class Summary
protected static class DataflowWithRates.ActionRateSignature
           
 
Field Summary
private  caltrop.interpreter.ExprEvaluator _eval
           
 
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
DataflowWithRates(TypedAtomicActor ptActor, caltrop.interpreter.ast.Actor actor, caltrop.interpreter.Context context, caltrop.interpreter.environment.Environment env)
          Create an new DataflowWithRates DDI.
 
Method Summary
protected static boolean _allEqual(java.lang.Object[] objs)
           
protected  void _annotatePortsWithRates(java.util.List ports, java.util.Map rateMap, java.lang.String varName)
          Annotate the given list of TypedIOPorts with rate parameters according to the given map.
protected  boolean _atLeastOneUnguardedAction()
           
protected  boolean _checkInitializerGuards()
           
protected  DataflowWithRates.ActionRateSignature _computeActionRates(caltrop.interpreter.ast.Action action)
           
protected  DataflowWithRates.ActionRateSignature[] _computeActionRates(caltrop.interpreter.ast.Action[] actions)
           
private  int _computeRepeatExpression(caltrop.interpreter.ast.Expression repeatExpr, caltrop.interpreter.ast.Action action)
           
protected static boolean _isBoundByPortVar(java.lang.String name, caltrop.interpreter.ast.Action action)
           
private static boolean _isIn(java.lang.String name, caltrop.interpreter.ast.Decl[] decls)
           
private static boolean _isIn(java.lang.String name, java.lang.String[] names)
           
private  boolean _isStaticallyComputable(caltrop.interpreter.ast.Expression expr, caltrop.interpreter.ast.Action action)
           
 
Methods inherited from class ptolemy.caltrop.ddi.Dataflow
_selectAction, _selectInitializer, fire, getName, initialize, isLegalActor, postfire, prefire, preinitialize, setupActor
 
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

_eval

private caltrop.interpreter.ExprEvaluator _eval
Constructor Detail

DataflowWithRates

public DataflowWithRates(TypedAtomicActor ptActor,
                         caltrop.interpreter.ast.Actor actor,
                         caltrop.interpreter.Context context,
                         caltrop.interpreter.environment.Environment env)
Create an new DataflowWithRates 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

_annotatePortsWithRates

protected void _annotatePortsWithRates(java.util.List ports,
                                       java.util.Map rateMap,
                                       java.lang.String varName)
Annotate the given list of TypedIOPorts with rate parameters according to the given map.


_atLeastOneUnguardedAction

protected boolean _atLeastOneUnguardedAction()

_checkInitializerGuards

protected boolean _checkInitializerGuards()

_computeActionRates

protected DataflowWithRates.ActionRateSignature[] _computeActionRates(caltrop.interpreter.ast.Action[] actions)
                                                               throws java.lang.Exception
Throws:
java.lang.Exception

_computeActionRates

protected DataflowWithRates.ActionRateSignature _computeActionRates(caltrop.interpreter.ast.Action action)
                                                             throws java.lang.Exception
Throws:
java.lang.Exception

_computeRepeatExpression

private int _computeRepeatExpression(caltrop.interpreter.ast.Expression repeatExpr,
                                     caltrop.interpreter.ast.Action action)
                              throws java.lang.Exception
Throws:
java.lang.Exception

_isStaticallyComputable

private boolean _isStaticallyComputable(caltrop.interpreter.ast.Expression expr,
                                        caltrop.interpreter.ast.Action action)

_isBoundByPortVar

protected static boolean _isBoundByPortVar(java.lang.String name,
                                           caltrop.interpreter.ast.Action action)

_isIn

private static boolean _isIn(java.lang.String name,
                             java.lang.String[] names)

_isIn

private static boolean _isIn(java.lang.String name,
                             caltrop.interpreter.ast.Decl[] decls)

_allEqual

protected static boolean _allEqual(java.lang.Object[] objs)