public final class VariableTracker<T>
extends java.lang.Object
Constructor and Description |
---|
VariableTracker() |
Modifier and Type | Method and Description |
---|---|
T |
get(java.lang.String name)
Get the data associated with the given variable.
|
java.util.List<T> |
getAll(java.lang.String name)
Get an immutable view of all the data items associated with the specified variable.
|
int |
getOccurrenceCount(java.lang.String name)
Get how many times a variable was declared in the current scope.
|
boolean |
isDeclared(java.lang.String name)
Checks if the variable identified by
name is tracked by this tracker or not. |
boolean |
isEmpty()
Checks if the declaration stack is empty.
|
boolean |
isInScope(java.lang.String name)
Check whether a variable was declared and is visible in the current scope.
|
java.util.Map.Entry<java.lang.String,T> |
peek()
Peeks at the top of the declaration stack.
|
java.lang.String |
popVariable()
Pops a variable from this tracker.
|
void |
pushVariable(java.lang.String name,
T data)
Pushes a variable to this tracker.
|
public boolean isDeclared(java.lang.String name)
name
is tracked by this tracker or not.name
- the name of the variabletrue
if the variable is declared, false
otherwisepublic void pushVariable(java.lang.String name, T data)
name
- the name of the variabledata
- the data associated with the variablepublic java.lang.String popVariable()
java.util.NoSuchElementException
- if there are no declared variables in the scopepublic java.util.Map.Entry<java.lang.String,T> peek()
java.util.NoSuchElementException
- if there are no variables in scopepublic boolean isEmpty()
true
if the stack is empty, false
otherwisepublic T get(java.lang.String name)
name
- the name of the variablenull
if that variable is not in scopepublic boolean isInScope(java.lang.String name)
name
- the name of the variabletrue
if the variable is visible in the current scope, false
otherwisepublic java.util.List<T> getAll(java.lang.String name)
name
- the name of the variablepublic int getOccurrenceCount(java.lang.String name)
name
- the name of the variable"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"