protected class AbstractPtalonEvaluator.IfTree extends NamedTree<AbstractPtalonEvaluator.IfTree>
Modifier and Type | Field and Description |
---|---|
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.
|
Constructor and Description |
---|
IfTree(AbstractPtalonEvaluator.IfTree parent,
java.lang.String name)
Create a new if tree.
|
Modifier and Type | Method and Description |
---|---|
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.
|
getChild, getChildren, getName, getParent, getProperAncestors
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
public 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.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