ptolemy.caltrop.ddi
Class CSP

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

public class CSP
extends AbstractDDI
implements DDI

Since:
Ptolemy II 4.0
Version:
$Id: CSP.java,v 1.15 2004/04/13 18:37:32 cxh Exp $
Author:
Christopher Chang
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (cxh)

Field Summary
 
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
 
Constructor Summary
CSP(CalInterpreter ptActor, caltrop.interpreter.ast.Actor actor, caltrop.interpreter.Context context, caltrop.interpreter.environment.Environment env)
           
 
Method Summary
 void fire()
          Fire the actor.
 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()
          This method should be invoked once per iteration, before the first invocation of fire() in that iteration.
 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

CSP

public CSP(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
Description copied from interface: Executable
Fire the actor. This may be invoked several times between invocations of prefire() and postfire(). Output data may (and normally will) be produced. Typically, the fire() method performs the computation associated with an actor. This method is not required to have bounded execution. However, after endFire() is called, this method should return in bounded time.

Specified by:
fire in interface Executable
Throws:
IllegalActionException - If firing is not permitted.

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
Description copied from interface: Executable
This method should be invoked once per iteration, before the first invocation of fire() in that iteration. It returns true if the iteration can proceed (the fire() method can be invoked). Thus this method will typically check preconditions for an iteration, if there are any. In an opaque, non-atomic entity, it may move data into an inner subsystem. The execution of this method is bounded.

Specified by:
prefire in interface Executable
Returns:
True if the iteration can proceed.
Throws:
IllegalActionException - If prefiring is not permitted.

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.