|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.actor.ptalon.NamedTree<AbstractPtalonEvaluator.IfTree>
ptolemy.actor.ptalon.AbstractPtalonEvaluator.IfTree
protected class AbstractPtalonEvaluator.IfTree
This is a representation of an if/else construct in Ptalon. The true branch and/or the false branch can point to a set of IfTrees. This class is used when the keyword "if" apears in the Ptalon source code. There are no dangling "if"s in Ptalon, so this class always knows when to use the true or false branch in the representation.
Field Summary | |
---|---|
private java.lang.Boolean |
_activeBranch
This is true when the active branch for this if statement is true, false when it is false, and null when it is unknown. |
private java.util.Hashtable<java.lang.String,java.lang.Integer> |
_createdIteration
The number of iterations (number of times the if/for block has been entered) for each symbol created. |
private boolean |
_currentBranch
This is true if we are in the main scope or the true part of a true branch. |
private java.util.Hashtable<java.lang.String,java.lang.String> |
_falseNameMappings
Each symbol gets mapped to its unique name in the Ptalon Actor. |
private java.util.Hashtable<java.lang.String,java.lang.Boolean> |
_falseSetStatus
A symbol maps to false if it has been set to some value or false otherwise. |
private java.util.Hashtable<java.lang.String,java.lang.String> |
_falseSymbols
The symbol table for this level of the if hierarchy. |
private boolean |
_inNewWhileIteration
This is true if in a new iteration of a while block. |
private java.util.Hashtable<java.lang.String,java.lang.String> |
_trueNameMappings
Each symbol gets mapped to its unique name in the Ptalon Actor. |
private java.util.Hashtable<java.lang.String,java.lang.Boolean> |
_trueSetStatus
A symbol maps to true if it has been set to some value or false otherwise. |
private java.util.Hashtable<java.lang.String,java.lang.String> |
_trueSymbols
The symbol table for this level of the if hierarchy. |
int |
entered
The number of times the if/for tree has been entered. |
PtalonAST |
forBlock
This is the AST for this for block, if this is a for block. |
java.lang.String |
initExpr
This is the initially expression for the for statement, if this is a for statement. |
boolean |
isForStatement
This is true if this if statement is actually used to represent a for statement. |
java.lang.String |
nextExpr
This is the next expression for the for statement, if this is a for statement. |
PtalonPopulator |
populator
This is the PtalonPopulator that accesses this for statement, if this is a for statement. |
java.lang.String |
satExpr
This is the satisfies expression for the for statement, if this is a for statement. |
java.lang.String |
variable
This is the variable for the for statement, if this is a for statement. |
Fields inherited from class ptolemy.actor.ptalon.NamedTree |
---|
_children, _name, _parent |
Constructor Summary | |
---|---|
AbstractPtalonEvaluator.IfTree(AbstractPtalonEvaluator.IfTree parent,
java.lang.String name)
Create a new if tree. |
Method Summary | |
---|---|
AbstractPtalonEvaluator.IfTree |
addChild(java.lang.String name)
Create a new child tree to this tree with the specified name and return it. |
void |
addSymbol(java.lang.String symbol,
java.lang.String type)
Add a symbol to the scope of this if statement. |
void |
addSymbol(java.lang.String symbol,
java.lang.String type,
boolean status,
java.lang.String uniqueName)
Add a symbol to the scope of this if statement. |
void |
evaluateForScope()
Evaluate this for block, assuming this is a for block. |
java.lang.Boolean |
getActiveBranch()
Return the active branch, which may be null if it has not yet been set. |
java.util.List<AbstractPtalonEvaluator.IfTree> |
getAncestors()
Return the ancestors of this tree, including this tree. |
boolean |
getCurrentBranch()
Return true if we are in the main scope or the true part of a true branch. |
java.lang.String |
getDeepMappedName(java.lang.String symbol)
Get the unique name for the symbol in the PtalonActor, looking deep into for loops for potential matches. |
java.lang.String |
getDeepType(java.lang.String symbol)
Return the type associated with the given symbol, looking deep into for loops that might add symbols to this scope. |
int |
getEnteredIteration(java.lang.String symbol)
Get the iteration (number of times this if/for block has been entered) in which this symbol is created. |
java.lang.String |
getMappedName(java.lang.String symbol)
Get the unique name for the symbol in the PtalonActor. |
java.util.Set<java.lang.String> |
getSymbols()
Return a set of strings representing all symbols in the scope of the if-block. |
java.lang.String |
getType(java.lang.String symbol)
Return the type associated with the given symbol. |
boolean |
inDeepScope(java.lang.String symbol)
Return true if the given symbol is in this scope, or deeply in this scope through some for loop. |
boolean |
inNewWhileIteration()
Return true if in a new iteration of a while block. |
boolean |
isCreated(java.lang.String symbol)
Return true if an entity was created in PtalonActor for the given symbol. |
boolean |
isFullyAssigned()
Return true if all the symbols in this if block have been assigned a value. |
void |
mapName(java.lang.String symbol,
java.lang.String uniqueName)
Map a name of a symbol from a Ptalon program to a name in the PtalonActor which creates it. |
void |
setActiveBranch(boolean branch)
Set the active branch to true or false. |
void |
setCurrentBranch(boolean branch)
Set the current branch that's being walked. |
void |
setEnteredIteration(java.lang.String symbol,
int iteration)
Set the iteration (number of times this if/for block has been entered) in which this symbol is created. |
void |
setStatus(java.lang.String symbol,
boolean status)
Set the status of the symbol to true, if the symbol is ready, and false otherwise. |
java.lang.String |
toString()
Enumerate the info from this scope. |
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, wait, wait, wait |
Field Detail |
---|
public int entered
public PtalonAST forBlock
public java.lang.String initExpr
public boolean isForStatement
public java.lang.String nextExpr
public PtalonPopulator populator
public java.lang.String satExpr
public java.lang.String variable
private java.lang.Boolean _activeBranch
private java.util.Hashtable<java.lang.String,java.lang.Integer> _createdIteration
private boolean _currentBranch
private java.util.Hashtable<java.lang.String,java.lang.String> _falseNameMappings
private java.util.Hashtable<java.lang.String,java.lang.Boolean> _falseSetStatus
private java.util.Hashtable<java.lang.String,java.lang.String> _falseSymbols
private boolean _inNewWhileIteration
private java.util.Hashtable<java.lang.String,java.lang.String> _trueNameMappings
private java.util.Hashtable<java.lang.String,java.lang.Boolean> _trueSetStatus
private java.util.Hashtable<java.lang.String,java.lang.String> _trueSymbols
Constructor Detail |
---|
public AbstractPtalonEvaluator.IfTree(AbstractPtalonEvaluator.IfTree parent, java.lang.String name)
name
- The name to give this if tree.parent
- The parent to this tree, which may be null
if this is the root of a tree.Method Detail |
---|
public AbstractPtalonEvaluator.IfTree addChild(java.lang.String name)
addChild
in class NamedTree<AbstractPtalonEvaluator.IfTree>
name
- The name of the child.
public void addSymbol(java.lang.String symbol, java.lang.String type)
symbol
- The symbol to add.type
- Its corresponding type.public void addSymbol(java.lang.String symbol, java.lang.String type, boolean status, java.lang.String uniqueName)
symbol
- The symbol to add.type
- Its corresponding type.status
- Whether the if statement has been loaded or not.uniqueName
- The unique name of this if statement.public void evaluateForScope() throws PtalonRuntimeException
PtalonRuntimeException
- If there is any trouble
evaluating this for block.public java.lang.Boolean getActiveBranch()
setActiveBranch(boolean)
public java.util.List<AbstractPtalonEvaluator.IfTree> getAncestors()
public boolean getCurrentBranch()
setCurrentBranch(boolean)
public java.lang.String getDeepMappedName(java.lang.String symbol) throws PtalonRuntimeException
symbol
- The symbol to test.
PtalonRuntimeException
- If no such symbol exists.public java.lang.String getDeepType(java.lang.String symbol) throws PtalonScopeException
symbol
- The symbol under test.
PtalonScopeException
- If the symbol is not in
the scope of the if statement associated with this IfTree.public int getEnteredIteration(java.lang.String symbol)
symbol
- The symbol created.
setEnteredIteration(java.lang.String, int)
public java.lang.String getMappedName(java.lang.String symbol) throws PtalonRuntimeException
symbol
- The symbol to test.
PtalonRuntimeException
- If no such symbol exists.public java.util.Set<java.lang.String> getSymbols()
public java.lang.String getType(java.lang.String symbol) throws PtalonScopeException
symbol
- The symbol under test.
PtalonScopeException
- If the symbol is not in
the scope of the if statement associated with this IfTree.public boolean inDeepScope(java.lang.String symbol)
symbol
- The symbol to test.
public boolean inNewWhileIteration()
public boolean isCreated(java.lang.String symbol) throws PtalonRuntimeException
symbol
- The symbol to test.
PtalonRuntimeException
- If the symbol is not in
the current scope.public boolean isFullyAssigned() throws PtalonRuntimeException
PtalonRuntimeException
- If there is any problem
accessing a parameter.public void mapName(java.lang.String symbol, java.lang.String uniqueName) throws PtalonRuntimeException
symbol
- The name for the symbol in the Ptalon program.uniqueName
- The unique name for the symbol in the
PtalonActor.
PtalonRuntimeException
- If the symbol does not
exist.public void setActiveBranch(boolean branch)
branch
- The branch to set it to.getActiveBranch()
public void setCurrentBranch(boolean branch)
branch
- True if the true branch is being walked.getCurrentBranch()
public void setEnteredIteration(java.lang.String symbol, int iteration)
symbol
- The symbol created.iteration
- The iteration of the symbol.getEnteredIteration(java.lang.String)
public void setStatus(java.lang.String symbol, boolean status)
symbol
- The symbol.status
- The status.public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |