ptolemy.domains.fsm.modal
Class MirrorCausalityInterface

java.lang.Object
  extended by ptolemy.actor.util.DefaultCausalityInterface
      extended by ptolemy.actor.util.CausalityInterfaceForComposites
          extended by ptolemy.domains.fsm.modal.MirrorCausalityInterface
All Implemented Interfaces:
CausalityInterface

public class MirrorCausalityInterface
extends CausalityInterfaceForComposites

This class infers a causality interface from causality interfaces provided in the constructor and in the composeWith(ptolemy.actor.util.CausalityInterface) method. For each of these interfaces, this interface finds ports in its own actor that match the names of those for the specified interfaces, and constructs dependencies that are oPlus compositions of the dependencies in the specified interfaces for ports with the same names. For equivalence classes, it merges the equivalence classes so that if two ports are equivalent in any of the provided causality interfaces, then the corresponding (same named) ports in the actor are also equivalent.

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

Field Summary
private  java.util.Set<CausalityInterface> _composedInterfaces
          The set of causality interfaces that this one composes.
 
Fields inherited from class ptolemy.actor.util.CausalityInterfaceForComposites
_actorDepthVersion, _actorToDepth, _dependencyVersion, _equivalenceClasses, _forwardDependencies, _reverseDependencies
 
Fields inherited from class ptolemy.actor.util.DefaultCausalityInterface
_actor, _backwardPrunedDependencies, _defaultDependency, _delayDependencies, _EMPTY_COLLECTION, _forwardPrunedDependencies
 
Constructor Summary
MirrorCausalityInterface(Actor actor, CausalityInterface causality)
          Construct a causality interface that mirrors the specified causality interface.
 
Method Summary
private  java.util.Collection<IOPort> _localMirrors(java.util.Collection<IOPort> ports)
          Return the local ports whose names match the ports in the specified collection.
 void composeWith(CausalityInterface causality)
          Add the specified causality interface for the specified actor.
 Dependency getDependency(IOPort input, IOPort output)
          Return the dependency between the specified input port and the specified output port.
 
Methods inherited from class ptolemy.actor.util.CausalityInterfaceForComposites
_computeActorDepth, checkForCycles, dependentPorts, describeDepths, equivalentPorts, getDepthOfActor, getDepthOfPort, invalidate, removeDependency, topologicalSort
 
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
 

Field Detail

_composedInterfaces

private java.util.Set<CausalityInterface> _composedInterfaces
The set of causality interfaces that this one composes.

Constructor Detail

MirrorCausalityInterface

public MirrorCausalityInterface(Actor actor,
                                CausalityInterface causality)
                         throws java.lang.IllegalArgumentException
Construct a causality interface that mirrors the specified causality interface.

Parameters:
actor - The actor for which this is an interface.
causality - The interface to mirror.
Throws:
java.lang.IllegalArgumentException - If the actor parameter is not an instance of CompositeEntity.
Method Detail

composeWith

public void composeWith(CausalityInterface causality)
Add the specified causality interface for the specified actor.

Parameters:
causality - The interface to compose with the one specified in the constructor.

getDependency

public Dependency getDependency(IOPort input,
                                IOPort output)
                         throws IllegalActionException
Return the dependency between the specified input port and the specified output port. This is done by checking the guards and actions of all the transitions. When called for the first time since a change in the model structure, this method performs the complete analysis of the FSM and caches the result. Subsequent calls just look up the result.

Specified by:
getDependency in interface CausalityInterface
Overrides:
getDependency in class CausalityInterfaceForComposites
Parameters:
input - The input port.
output - The output port, or null to update the dependencies (and record equivalence classes) without requiring there to be an output port.
Returns:
The dependency between the specified input port and the specified output port, or null if a null output is port specified.
Throws:
IllegalActionException - If a guard expression cannot be parsed.

_localMirrors

private java.util.Collection<IOPort> _localMirrors(java.util.Collection<IOPort> ports)
                                            throws IllegalActionException
Return the local ports whose names match the ports in the specified collection.

Parameters:
ports - A collection of ports.
Throws:
IllegalActionException - If no matching port is found.