ptolemy.actor.ptalon
Class PtalonEvaluator.ActorTree

java.lang.Object
  extended by ptolemy.actor.ptalon.NamedTree<PtalonEvaluator.ActorTree>
      extended by ptolemy.actor.ptalon.PtalonEvaluator.ActorTree
Enclosing class:
PtalonEvaluator

private class PtalonEvaluator.ActorTree
extends NamedTree<PtalonEvaluator.ActorTree>

This class is a tree whose structure mimics that of a nested actor declaration. For instance, Foo(a := Foo(a: = Bar(), b := Bar()), b := Bar()) might have a tree that looks something like:


                Foo_0
               /     \
             Foo_1  Bar_0
             /   \
          Bar_1  Bar_2
  


Field Summary
private  java.lang.String _actorParameter
          The left hand side in the Ptalon expression param := ...
private  java.util.Map<java.lang.String,java.lang.String> _parameters
          Each key is a parameter in this actor declaration, and each value is an expression to be passed to the parameter.
private  java.util.Map<java.lang.String,java.lang.String> _ports
          Each key is a port in this actor declaration, and each value is a port in its container to be connected to at runtime.
private  java.util.Map<java.lang.String,java.lang.String> _relations
          Each key is a port in this actor declaration, and each value is a relation in its container to be connected to at runtime.
private  java.lang.String _symbol
          This is the symbol stored with the AbstractPtalonEvaluator that this actor declaration refers to.
private  java.util.Map<java.lang.String,java.lang.String> _transparencies
          Each key is a port in this actor declaration, and each value is a transparent relation in its container to be connected to at runtime.
private  java.util.Map<java.lang.String,java.lang.String> _transparentLeftHandSides
          Each member of this set is a transparent relation assigned a value in a this statement, like this(transparentRelation := someOtherRelation);
private  java.util.Map<java.lang.String,java.lang.String> _unknownExpressions
          The _unknownPrefixes maps port names in this actor declaration instance to prefixes of unknown connection points, and _unknownExpressions maps the same keys to the expressions for these unknown connection points.
private  java.util.Map<java.lang.String,java.lang.String> _unknownLeftSides
          Each key is a prefix and value is an expression corresponding to a left hand side of an assignment which may change dynamically.
private  java.util.Map<java.lang.String,java.lang.String> _unknownPrefixes
          The _unknownPrefixes maps port names in this actor declaration instance to prefixes of unknown connection points, and _unknownExpressions maps the same keys to the expressions for these unknown connection points.
 boolean created
          This becomes true after the this actor declaration has been created.
 int createdIteration
          This takes a nonzero value in the iteration it gets set.
 
Fields inherited from class ptolemy.actor.ptalon.NamedTree
_children, _name, _parent
 
Constructor Summary
PtalonEvaluator.ActorTree(PtalonEvaluator.ActorTree parent, java.lang.String name)
           
 
Method Summary
 PtalonEvaluator.ActorTree addChild(java.lang.String name)
          Create a new child tree to this tree with the specified name and return it.
 void addParameterAssign(java.lang.String parameterName, java.lang.String expression)
          Add an assignment of the specified port of this actor declaration to the containing Ptalon actor connection point, which is either a port or a relation.
 void addPortAssign(java.lang.String portName, java.lang.String connectPoint)
          Add an assignment of the specified port of this actor declaration to the containing Ptalon actor connection point, which is either a port or a relation.
 void addPortAssign(java.lang.String portName, java.lang.String connectPointPrefix, java.lang.String connectPointExpression)
          Add an assignment of the specified port of this actor declaration to the containing Ptalon actor connection point, which is either a port or a relation.
 void addUnknownLeftSide(java.lang.String prefix, java.lang.String expression)
          Add the unknown left side to this actor declaration.
 void assignNonPtalonParameters(ComponentEntity actor)
          Assign all non-Ptalon parameters of the specified non-Ptalon actor their corresponding value.
 void assignPtalonParameters(PtalonActor actor)
          Assign all Ptalon paramters of the specified actor their corresponding value.
 java.lang.String getActorParameter()
          Get the name of the actor parameter, or throw an exception if there is none.
 java.lang.String getExpression()
          Get an expression representing this actor tree, like a := b(c := d())(n := <2/>)
 java.lang.String getSymbol()
          Get the AbstractPtalonEvaluator symbol.
 boolean isReady()
          Return true if this nested actor is ready to be created.
 void makeConnections(ComponentEntity actor)
          Make all connections for this nested actor.
 void makeThisConnections()
          Make all connections for this nested actor.
 void removeDynamicLeftHandSides()
          Clean up any dynamic left hand sides added.
 void setActorParameter(java.lang.String paramName)
          Set the parameter name for the current actor declaration, if any, to the given parameter name.
 void setSymbol(java.lang.String symbol)
          Set the symbol in the AbstractPtalonEvaluator this actor declaration refers to.
 
Methods inherited from class ptolemy.actor.ptalon.NamedTree
getChild, getChildren, getName, getParent, getProperAncestors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

created

public boolean created
This becomes true after the this actor declaration has been created.


createdIteration

public int createdIteration
This takes a nonzero value in the iteration it gets set.


_actorParameter

private java.lang.String _actorParameter
The left hand side in the Ptalon expression param := ...


_parameters

private java.util.Map<java.lang.String,java.lang.String> _parameters
Each key is a parameter in this actor declaration, and each value is an expression to be passed to the parameter.


_ports

private java.util.Map<java.lang.String,java.lang.String> _ports
Each key is a port in this actor declaration, and each value is a port in its container to be connected to at runtime.


_relations

private java.util.Map<java.lang.String,java.lang.String> _relations
Each key is a port in this actor declaration, and each value is a relation in its container to be connected to at runtime.


_symbol

private java.lang.String _symbol
This is the symbol stored with the AbstractPtalonEvaluator that this actor declaration refers to. It's either a "actorparameter", "import", or "this" symbol.


_transparencies

private java.util.Map<java.lang.String,java.lang.String> _transparencies
Each key is a port in this actor declaration, and each value is a transparent relation in its container to be connected to at runtime.


_transparentLeftHandSides

private java.util.Map<java.lang.String,java.lang.String> _transparentLeftHandSides
Each member of this set is a transparent relation assigned a value in a this statement, like this(transparentRelation := someOtherRelation);


_unknownExpressions

private java.util.Map<java.lang.String,java.lang.String> _unknownExpressions
The _unknownPrefixes maps port names in this actor declaration instance to prefixes of unknown connection points, and _unknownExpressions maps the same keys to the expressions for these unknown connection points.


_unknownLeftSides

private java.util.Map<java.lang.String,java.lang.String> _unknownLeftSides
Each key is a prefix and value is an expression corresponding to a left hand side of an assignment which may change dynamically.


_unknownPrefixes

private java.util.Map<java.lang.String,java.lang.String> _unknownPrefixes
The _unknownPrefixes maps port names in this actor declaration instance to prefixes of unknown connection points, and _unknownExpressions maps the same keys to the expressions for these unknown connection points.

Constructor Detail

PtalonEvaluator.ActorTree

public PtalonEvaluator.ActorTree(PtalonEvaluator.ActorTree parent,
                                 java.lang.String name)
Method Detail

addChild

public PtalonEvaluator.ActorTree addChild(java.lang.String name)
Create a new child tree to this tree with the specified name and return it.

Specified by:
addChild in class NamedTree<PtalonEvaluator.ActorTree>
Parameters:
name - The name of the child.
Returns:
The child ActorTree.

addParameterAssign

public void addParameterAssign(java.lang.String parameterName,
                               java.lang.String expression)
Add an assignment of the specified port of this actor declaration to the containing Ptalon actor connection point, which is either a port or a relation. This is not allowed in nested actor declarations, only top-level declarations. For instance, Foo(port := containing) port is okay, but not Bar(a := Foo(port := containing))

Parameters:
parameterName - The name of the parameter.
expression - The expression to assign to the parameter.

addPortAssign

public void addPortAssign(java.lang.String portName,
                          java.lang.String connectPoint)
                   throws PtalonScopeException
Add an assignment of the specified port of this actor declaration to the containing Ptalon actor connection point, which is either a port or a relation. This is not allowed in nested actor declarations, only top-level declarations. For instance, Foo(port := containing) port is okay, but not Bar(a := Foo(port := containing)) If the port on the left does not exist, it will be created and given a flow type if possible.

Parameters:
portName - The name of the port in the specified actor.
connectPoint - The name of the container's port or relation.
Throws:
PtalonScopeException - If this is not a top-level actor declaration with respect to the assignment, or if connectPoint is not a port or relation.

addPortAssign

public void addPortAssign(java.lang.String portName,
                          java.lang.String connectPointPrefix,
                          java.lang.String connectPointExpression)
                   throws PtalonScopeException
Add an assignment of the specified port of this actor declaration to the containing Ptalon actor connection point, which is either a port or a relation. Here

Parameters:
portName - The name of the port in this
connectPointPrefix - The name of the container's port or relation.
connectPointExpression - The name of the container's port or relation.
Throws:
PtalonScopeException - If this is not a top-level actor declaration with respect to the assignment, or if connectPoint is not a port or relation.

addUnknownLeftSide

public void addUnknownLeftSide(java.lang.String prefix,
                               java.lang.String expression)
Add the unknown left side to this actor declaration.

Parameters:
prefix - The prefix for the unknown left side.
expression - The suffix expression for the unknown left side.

assignNonPtalonParameters

public void assignNonPtalonParameters(ComponentEntity actor)
                               throws PtalonRuntimeException
Assign all non-Ptalon parameters of the specified non-Ptalon actor their corresponding value.

Parameters:
actor - The actor that contains these parameters.
Throws:
PtalonRuntimeException - If thrown trying to access the parameter, or if unable to set the token for the corresponding parameter.

assignPtalonParameters

public void assignPtalonParameters(PtalonActor actor)
                            throws PtalonRuntimeException
Assign all Ptalon paramters of the specified actor their corresponding value.

Parameters:
actor - The actor that contains these parameters.
Throws:
PtalonRuntimeException - If thrown trying to access the parameter, or if unable to set the token for the corresponding parameter.

getActorParameter

public java.lang.String getActorParameter()
                                   throws PtalonRuntimeException
Get the name of the actor parameter, or throw an exception if there is none.

Returns:
The name of the actor parameter.
Throws:
PtalonRuntimeException - If no parameter name has been assigned to this actor.

getExpression

public java.lang.String getExpression()
                               throws PtalonRuntimeException
Get an expression representing this actor tree, like a := b(c := d())(n := <2/>)

Returns:
A string containing the expression.
Throws:
PtalonRuntimeException - If no parameter name has been assigned to this actor.

getSymbol

public java.lang.String getSymbol()
Get the AbstractPtalonEvaluator symbol.

Returns:
The AbstractPtalonEvaluator symbol for this actor declaration.

isReady

public boolean isReady()
                throws PtalonRuntimeException
Return true if this nested actor is ready to be created.

Returns:
true If this nested actor is ready to be created.
Throws:
PtalonRuntimeException - If there is problem accessing any parameters.

makeConnections

public void makeConnections(ComponentEntity actor)
                     throws PtalonRuntimeException
Make all connections for this nested actor.

Parameters:
actor - The actor to connect to others.
Throws:
PtalonRuntimeException - If thrown trying to access the parameter, or if unable to set the token for the corresponding parameter.

makeThisConnections

public void makeThisConnections()
                         throws PtalonRuntimeException
Make all connections for this nested actor.

Throws:
PtalonRuntimeException - If thrown trying to access the parameter, or if unable to set the token for the corresponding parameter.

removeDynamicLeftHandSides

public void removeDynamicLeftHandSides()
Clean up any dynamic left hand sides added.


setActorParameter

public void setActorParameter(java.lang.String paramName)
                       throws PtalonScopeException
Set the parameter name for the current actor declaration, if any, to the given parameter name.

Parameters:
paramName - The name of the parameter.
Throws:
PtalonScopeException

setSymbol

public void setSymbol(java.lang.String symbol)
Set the symbol in the AbstractPtalonEvaluator this actor declaration refers to. It should have type "actorparameter" or "import".

Parameters:
symbol - The symbol to set.