ptolemy.actor.util
Class BreakCausalityInterface

java.lang.Object
  extended by ptolemy.actor.util.DefaultCausalityInterface
      extended by ptolemy.actor.util.BreakCausalityInterface
All Implemented Interfaces:
CausalityInterface

public class BreakCausalityInterface
extends DefaultCausalityInterface

This class provides a causality interface where no output port depends on any input port. That is, the dependency of any output port on any input port is the oPlusIdentity() of the specified default dependency.

The equivalentPorts(IOPort) normally returns list containing only the specified port. If, however, the actor has any instance of PortParameter in its input port list, then it returns a list of all input ports. 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. It is more efficient to use this class than to use the base class and call removeDependency() to remove all the dependencies.

Since:
Ptolemy II 8.0
Version:
$Id: BreakCausalityInterface.java 57044 2010-01-27 22:41:05Z cxh $
Author:
Edward A. Lee
See Also:
Dependency
Accepted Rating:
Red (eal)
Proposed Rating:
Yellow (eal)

Field Summary
 
Fields inherited from class ptolemy.actor.util.DefaultCausalityInterface
_actor, _backwardPrunedDependencies, _defaultDependency, _delayDependencies, _EMPTY_COLLECTION, _forwardPrunedDependencies
 
Constructor Summary
BreakCausalityInterface(Actor actor, Dependency defaultDependency)
          Construct a causality interface for the specified actor.
 
Method Summary
 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 ports in this actor that are in the same equivalence class.
 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.
 
Methods inherited from class ptolemy.actor.util.DefaultCausalityInterface
_growDependencies, declareDelayDependency, getActor, getDefaultDependency, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BreakCausalityInterface

public BreakCausalityInterface(Actor actor,
                               Dependency defaultDependency)
Construct a causality interface for the specified actor.

Parameters:
actor - The actor for which this is a causality interface.
defaultDependency - The default dependency of an output port on an input port.
Method Detail

dependentPorts

public 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. This method returns an empty collection.

Derived classes may override this, but they may need to also override getDependency(IOPort, IOPort) and equivalentPorts(IOPort) to be consistent.

Specified by:
dependentPorts in interface CausalityInterface
Overrides:
dependentPorts in class DefaultCausalityInterface
Parameters:
port - The port to find the dependents of.
Returns:
a collection of ports, this method returns an empty collection of ports

equivalentPorts

public java.util.Collection<IOPort> equivalentPorts(IOPort input)
Return a collection of the ports in this actor that are in the same equivalence class. This method returns a collection containing only the specified port, unless there is a PortParameter, in which case it returns all the input ports.

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.

Specified by:
equivalentPorts in interface CausalityInterface
Overrides:
equivalentPorts in class DefaultCausalityInterface
Parameters:
input - The port to find the equivalence class of.
Returns:
a collection of ports that are in the same equivalence class. This method returns a collection containing only the specified port.

getDependency

public Dependency getDependency(IOPort input,
                                IOPort output)
Return the dependency between the specified input port and the specified output port. This method returns the oPlusIdentity() of the default dependency given in the constructor.

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.

Specified by:
getDependency in interface CausalityInterface
Overrides:
getDependency in class DefaultCausalityInterface
Parameters:
input - The specified input port.
output - The specified output port.
Returns:
The dependency between the specified input port and the specified output port.

removeDependency

public void removeDependency(IOPort inputPort,
                             IOPort outputPort)
Remove the dependency that the specified output port has on the specified input port. This method does nothing since in this class, all dependencies have already been removed.

Specified by:
removeDependency in interface CausalityInterface
Overrides:
removeDependency in class DefaultCausalityInterface
Parameters:
inputPort - The input port.
outputPort - The output port that does not depend on the input port.
See Also:
getDependency(IOPort, IOPort)