public class DeclarationProgramVariableCollector extends JavaASTVisitor
{ int j; { int i; } { int h; } for (int k; ...) {} int h; }
the collector will return a set containg j, h
the
h
because of the second occurrence of h
Modifier and Type | Field and Description |
---|---|
private java.util.Set<IProgramVariable> |
result |
services
Constructor and Description |
---|
DeclarationProgramVariableCollector(ProgramElement root,
Services services)
creates a new declaration visitor
|
Modifier and Type | Method and Description |
---|---|
protected void |
addVariable(IProgramVariable var)
adds the given variable if we are currently at top level
|
protected void |
doDefaultAction(SourceElement x)
the action that is performed just before leaving the node the
last time
|
void |
performActionOnFieldSpecification(FieldSpecification x) |
void |
performActionOnImplicitFieldSpecification(ImplicitFieldSpecification x) |
void |
performActionOnLocationVariable(LocationVariable x) |
void |
performActionOnProgramConstant(ProgramConstant x) |
void |
performActionOnVariableSpecification(VariableSpecification x) |
java.util.Set<IProgramVariable> |
result() |
void |
start()
starts the walker
|
java.lang.String |
toString() |
doAction, performActionOnAbstractProgramElement, performActionOnAllFields, performActionOnAllObjects, performActionOnArrayDeclaration, performActionOnArrayInitializer, performActionOnArrayLengthReference, performActionOnArrayReference, performActionOnAssert, performActionOnBinaryAnd, performActionOnBinaryAndAssignment, performActionOnBinaryNot, performActionOnBinaryOr, performActionOnBinaryOrAssignment, performActionOnBinaryXOr, performActionOnBinaryXOrAssignment, performActionOnBlockContract, performActionOnBlockContract, performActionOnBooleanLiteral, performActionOnBreak, performActionOnCase, performActionOnCatch, performActionOnCatchAllStatement, performActionOnCharLiteral, performActionOnClassDeclaration, performActionOnClassInitializer, performActionOnComment, performActionOnCompilationUnit, performActionOnConditional, performActionOnConstructorDeclaration, performActionOnContextStatementBlock, performActionOnContinue, performActionOnCopyAssignment, performActionOnDefault, performActionOnDivide, performActionOnDivideAssignment, performActionOnDLEmbeddedExpression, performActionOnDo, performActionOnDoubleLiteral, performActionOnElse, performActionOnEmptyMapLiteral, performActionOnEmptySeqLiteral, performActionOnEmptySetLiteral, performActionOnEmptyStatement, performActionOnEnhancedFor, performActionOnEquals, performActionOnExactInstanceof, performActionOnExecutionContext, performActionOnExtends, performActionOnFieldDeclaration, performActionOnFieldReference, performActionOnFinally, performActionOnFloatLiteral, performActionOnFor, performActionOnForUpdates, performActionOnGreaterOrEquals, performActionOnGreaterThan, performActionOnGuard, performActionOnIf, performActionOnImplements, performActionOnImport, performActionOnInstanceof, performActionOnInterfaceDeclaration, performActionOnIntersect, performActionOnIntLiteral, performActionOnIProgramVariable, performActionOnLabeledStatement, performActionOnLessOrEquals, performActionOnLessThan, performActionOnLocalVariableDeclaration, performActionOnLogicalAnd, performActionOnLogicalNot, performActionOnLogicalOr, performActionOnLongLiteral, performActionOnLoopContract, performActionOnLoopContract, performActionOnLoopContract, performActionOnLoopInit, performActionOnLoopInvariant, performActionOnLoopScopeBlock, performActionOnMergeContract, performActionOnMergePointStatement, performActionOnMetaClassReference, performActionOnMethod, performActionOnMethodBodyStatement, performActionOnMethodDeclaration, performActionOnMethodFrame, performActionOnMethodReference, performActionOnMinus, performActionOnMinusAssignment, performActionOnModifier, performActionOnModulo, performActionOnModuloAssignment, performActionOnNegative, performActionOnNew, performActionOnNewArray, performActionOnNotEquals, performActionOnNullLiteral, performActionOnPackageReference, performActionOnPackageSpecification, performActionOnParameterDeclaration, performActionOnParenthesizedExpression, performActionOnPassiveExpression, performActionOnPlus, performActionOnPlusAssignment, performActionOnPositive, performActionOnPostDecrement, performActionOnPostIncrement, performActionOnPreDecrement, performActionOnPreIncrement, performActionOnProgramElementName, performActionOnProgramMetaConstruct, performActionOnProgramMethod, performActionOnProgramVariable, performActionOnReturn, performActionOnSchematicFieldReference, performActionOnSchemaVariable, performActionOnSeqConcat, performActionOnSeqGet, performActionOnSeqIndexOf, performActionOnSeqLength, performActionOnSeqReverse, performActionOnSeqSingleton, performActionOnSeqSub, performActionOnSetMinus, performActionOnSetUnion, performActionOnShiftLeft, performActionOnShiftLeftAssignment, performActionOnShiftRight, performActionOnShiftRightAssignment, performActionOnSingleton, performActionOnStatementBlock, performActionOnStringLiteral, performActionOnSuperArrayDeclaration, performActionOnSuperConstructorReference, performActionOnSuperReference, performActionOnSwitch, performActionOnSynchronizedBlock, performActionOnThen, performActionOnThisConstructorReference, performActionOnThisReference, performActionOnThrow, performActionOnThrows, performActionOnTimes, performActionOnTimesAssignment, performActionOnTransactionStatement, performActionOnTry, performActionOnTypeCast, performActionOnTypeReference, performActionOnUnsignedShiftRight, performActionOnUnsignedShiftRightAssignment, performActionOnVariableDeclaration, performActionOnVariableReference, performActionOnWhile, walk
depth, root
private java.util.Set<IProgramVariable> result
public DeclarationProgramVariableCollector(ProgramElement root, Services services)
public void start()
start
in class JavaASTWalker
public java.util.Set<IProgramVariable> result()
public java.lang.String toString()
toString
in class java.lang.Object
protected void addVariable(IProgramVariable var)
protected void doDefaultAction(SourceElement x)
JavaASTVisitor
doDefaultAction
in class JavaASTVisitor
x
- the node described abovepublic void performActionOnVariableSpecification(VariableSpecification x)
performActionOnVariableSpecification
in interface Visitor
performActionOnVariableSpecification
in class JavaASTVisitor
public void performActionOnFieldSpecification(FieldSpecification x)
performActionOnFieldSpecification
in interface Visitor
performActionOnFieldSpecification
in class JavaASTVisitor
public void performActionOnImplicitFieldSpecification(ImplicitFieldSpecification x)
performActionOnImplicitFieldSpecification
in interface Visitor
performActionOnImplicitFieldSpecification
in class JavaASTVisitor
public void performActionOnLocationVariable(LocationVariable x)
performActionOnLocationVariable
in interface Visitor
performActionOnLocationVariable
in class JavaASTVisitor
public void performActionOnProgramConstant(ProgramConstant x)
performActionOnProgramConstant
in interface Visitor
performActionOnProgramConstant
in class JavaASTVisitor