|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.actor.util.DefaultCausalityInterface
public class DefaultCausalityInterface
This class provides causality interfaces for actor networks as described
in the paper "Causality Interfaces for Actor Networks" by Ye Zhou and
Edward A. Lee, ACM Transactions on Embedded Computing Systems (TECS),
April 2008, as available as
Technical Report No. UCB/EECS-2006-148,
November 16, 2006. Specifically, this class represents a simple
default causality interface where every output port depends on every
input port, unless removeDependency(IOPort, IOPort)
has
been called to prune the dependencies. In the latter case, the dependencies
are pruned to not include the ones that were specified in that call.
In all cases, if there is any PortParameter in the actor, then all
input ports become members of the same equivalence class, regardless
of what dependencies have been pruned using
removeDependency(IOPort, IOPort)
. The reason for this is
that any output, present or future, may depend on the values at
such port parameters. In particular, it is necessary for inputs
on these port parameters to be present when any other input is
processed because it affects the parameters of the actor.
Causality interfaces represent dependencies between input and output ports of an actor and can be used to perform scheduling or static analysis on actor models.
Red (eal) |
Yellow (eal) |
Field Summary | |
---|---|
protected Actor |
_actor
The associated actor. |
protected java.util.Map<IOPort,java.util.Set<IOPort>> |
_backwardPrunedDependencies
A record of removed dependencies from output to input, if any. |
protected Dependency |
_defaultDependency
The default dependency of an output port on an input port. |
protected java.util.Map<IOPort,java.util.Map<IOPort,Dependency>> |
_delayDependencies
A record of delay dependencies from input to output, if any. |
protected static java.util.Collection<IOPort> |
_EMPTY_COLLECTION
Empty collection for use by dependentPort(). |
protected java.util.Map<IOPort,java.util.Set<IOPort>> |
_forwardPrunedDependencies
A record of removed dependencies from input to output, if any. |
Constructor Summary | |
---|---|
DefaultCausalityInterface(Actor actor,
Dependency defaultDependency)
Construct a causality interface for the specified actor. |
Method Summary | |
---|---|
protected void |
_growDependencies(IOPort input,
java.util.Set<IOPort> inputs,
java.util.Set<IOPort> outputs)
If the input port is already in the inputs set, do nothing and return. |
private void |
_removeDependency(IOPort inputPort,
IOPort outputPort)
For the benefit of the dependentPorts() and equivalentPorts() methods, remove the dependency that the input has on the output. |
void |
declareDelayDependency(IOPort input,
IOPort output,
double timeDelay,
int index)
Set the dependency that the specified output port has on the specified input port to represent a time delay with the specified value and superdense time index. |
java.util.Collection<IOPort> |
dependentPorts(IOPort port)
Return a collection of the ports in this actor that depend on or are depended on by the specified port. |
java.util.Collection<IOPort> |
equivalentPorts(IOPort input)
Return a collection of the input ports in this actor that are in the same equivalence class with the specified input port. |
Actor |
getActor()
Return the actor for which this is a dependency. |
Dependency |
getDefaultDependency()
Return the default dependency specified in the constructor. |
Dependency |
getDependency(IOPort input,
IOPort output)
Return the dependency between the specified input port and the specified output port. |
void |
removeDependency(IOPort inputPort,
IOPort outputPort)
Remove the dependency that the specified output port has on the specified input port. |
java.lang.String |
toString()
Return a description of the causality interfaces. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Actor _actor
protected java.util.Map<IOPort,java.util.Set<IOPort>> _backwardPrunedDependencies
protected static final java.util.Collection<IOPort> _EMPTY_COLLECTION
protected Dependency _defaultDependency
protected java.util.Map<IOPort,java.util.Map<IOPort,Dependency>> _delayDependencies
protected java.util.Map<IOPort,java.util.Set<IOPort>> _forwardPrunedDependencies
Constructor Detail |
---|
public DefaultCausalityInterface(Actor actor, Dependency defaultDependency)
actor
- The actor for which this is a causality interface.defaultDependency
- The default dependency of an output
port on an input port.Method Detail |
---|
public void declareDelayDependency(IOPort input, IOPort output, double timeDelay, int index)
declareDelayDependency
in interface CausalityInterface
input
- The input port.output
- The output port with a time delay dependency on the
input port.timeDelay
- The time delay.index
- The superdense time index.public java.util.Collection<IOPort> dependentPorts(IOPort port) throws IllegalActionException
This base class presumes (but does not check) that the argument is a port contained by the associated actor. If the actor is an input, then it returns a collection of all the outputs. If the actor is output, then it returns a collection of all the inputs.
Derived classes may override this, but they may need to
also override getDependency(IOPort, IOPort)
and equivalentPorts(IOPort)
to be consistent.
dependentPorts
in interface CausalityInterface
port
- The port to find the dependents of.
IllegalActionException
- Not thrown in this base class.public java.util.Collection<IOPort> equivalentPorts(IOPort input) throws IllegalActionException
If derived classes override this, they may also
need to override getDependency(IOPort,IOPort)
and dependentPorts(IOPort)
to be consistent.
The returned result should always include the specified input port.
An equivalence class is defined as follows. If input ports X and Y each have a dependency on any common port or on two equivalent ports, or they each can affect the state of the associated actor, then they are in an equivalence class. That is, there is a causal dependency. They are also in the same equivalence class if there is a port Z in an equivalence class with X and in an equivalence class with Y. If the actor has any instance of ParameterPort, then all input ports are in the same equivalence class. Otherwise, they are not in the same equivalence class.
equivalentPorts
in interface CausalityInterface
input
- The port to find the equivalence class of.
java.lang.IllegalArgumentException
- If the argument is not
contained by the associated actor.
IllegalActionException
- Not thrown in this base class.public Actor getActor()
getActor
in interface CausalityInterface
public Dependency getDefaultDependency()
getDefaultDependency
in interface CausalityInterface
public Dependency getDependency(IOPort input, IOPort output) throws IllegalActionException
removeDependency(IOPort, IOPort)
has been
called with the same two specified ports, then
this method will return the additive identity.
Derived classes should override this method to provide
actor-specific dependency information. If they do so,
then they may also need to override equivalentPorts(IOPort)
and dependentPorts(IOPort)
to be consistent.
getDependency
in interface CausalityInterface
input
- The input port.output
- The output port.
IllegalActionException
- Not thrown in this base class.public java.lang.String toString()
toString
in class java.lang.Object
public void removeDependency(IOPort inputPort, IOPort outputPort)
equivalentPorts(IOPort)
and
dependentPorts(IOPort)
.
removeDependency
in interface CausalityInterface
inputPort
- The input port.outputPort
- The output port that does not depend on the
input port.getDependency(IOPort, IOPort)
protected void _growDependencies(IOPort input, java.util.Set<IOPort> inputs, java.util.Set<IOPort> outputs) throws IllegalActionException
input
- The input port.inputs
- The set of inputs to which input is added if
it is not already present.outputs
- The set of output dependents to which the output
dependents are added if input was not in the inputs set.
IllegalActionException
- Not thrown in this base class.private void _removeDependency(IOPort inputPort, IOPort outputPort)
inputPort
- The input.outputPort
- The output.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |