public class UndeclaredProgramVariableCollector extends ProgramVariableCollector
This class is a specialization of ProgramVariableCollector
which
returns as result (result()
) used LocationVariable
which
are undeclared, but used in the given ProgramElement.
Declared {@link LocationVariable}s are:
Modifier and Type | Field and Description |
---|---|
private LinkedHashSet<LocationVariable> |
allVariables
Contains the super result.
|
private LinkedHashSet<IProgramVariable> |
declaredVariables
Contains the found declared
IProgramVariable s. |
private LinkedHashSet<LocationVariable> |
undeclaredVariables
Contains the undeclared variables as result.
|
services
Constructor and Description |
---|
UndeclaredProgramVariableCollector(ProgramElement root,
Services services)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
collectHeapVariables() |
LinkedHashSet<LocationVariable> |
getAllVariables()
Returns all used variables.
|
Set<IProgramVariable> |
getDeclaredVariables()
Returns the found declared variables.
|
void |
performActionOnExecutionContext(ExecutionContext x) |
void |
performActionOnLocalVariableDeclaration(LocalVariableDeclaration x) |
void |
performActionOnMethodFrame(MethodFrame x) |
LinkedHashSet<LocationVariable> |
result()
Returns the undeclared variables as result.
|
doDefaultAction, performActionOnBlockContract, performActionOnLocationVariable, performActionOnLoopInvariant, start, toString
doAction, performActionOnAbstractProgramElement, performActionOnAllFields, performActionOnAllObjects, performActionOnArrayDeclaration, performActionOnArrayInitializer, performActionOnArrayLengthReference, performActionOnArrayReference, performActionOnAssert, performActionOnBinaryAnd, performActionOnBinaryAndAssignment, performActionOnBinaryNot, performActionOnBinaryOr, performActionOnBinaryOrAssignment, performActionOnBinaryXOr, performActionOnBinaryXOrAssignment, 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, performActionOnExtends, performActionOnFieldDeclaration, performActionOnFieldReference, performActionOnFieldSpecification, performActionOnFinally, performActionOnFloatLiteral, performActionOnFor, performActionOnForUpdates, performActionOnGreaterOrEquals, performActionOnGreaterThan, performActionOnGuard, performActionOnIf, performActionOnImplements, performActionOnImplicitFieldSpecification, performActionOnImport, performActionOnInstanceof, performActionOnInterfaceDeclaration, performActionOnIntersect, performActionOnIntLiteral, performActionOnIProgramVariable, performActionOnLabeledStatement, performActionOnLessOrEquals, performActionOnLessThan, performActionOnLogicalAnd, performActionOnLogicalNot, performActionOnLogicalOr, performActionOnLongLiteral, performActionOnLoopInit, performActionOnMetaClassReference, performActionOnMethod, performActionOnMethodBodyStatement, performActionOnMethodDeclaration, performActionOnMethodReference, performActionOnMinus, performActionOnMinusAssignment, performActionOnModifier, performActionOnModulo, performActionOnModuloAssignment, performActionOnNegative, performActionOnNew, performActionOnNewArray, performActionOnNotEquals, performActionOnNullLiteral, performActionOnPackageReference, performActionOnPackageSpecification, performActionOnParameterDeclaration, performActionOnParenthesizedExpression, performActionOnPassiveExpression, performActionOnPlus, performActionOnPlusAssignment, performActionOnPositive, performActionOnPostDecrement, performActionOnPostIncrement, performActionOnPreDecrement, performActionOnPreIncrement, performActionOnProgramConstant, 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, performActionOnVariableSpecification, performActionOnWhile, walk
depth, root
private LinkedHashSet<IProgramVariable> declaredVariables
IProgramVariable
s.private LinkedHashSet<LocationVariable> allVariables
private LinkedHashSet<LocationVariable> undeclaredVariables
public UndeclaredProgramVariableCollector(ProgramElement root, Services services)
root
- The ProgramElement
to collect undeclared variables in.services
- The Services
to use.protected void collectHeapVariables()
collectHeapVariables
in class ProgramVariableCollector
public void performActionOnLocalVariableDeclaration(LocalVariableDeclaration x)
performActionOnLocalVariableDeclaration
in interface Visitor
performActionOnLocalVariableDeclaration
in class JavaASTVisitor
public void performActionOnMethodFrame(MethodFrame x)
performActionOnMethodFrame
in interface Visitor
performActionOnMethodFrame
in class JavaASTVisitor
public void performActionOnExecutionContext(ExecutionContext x)
performActionOnExecutionContext
in interface Visitor
performActionOnExecutionContext
in class JavaASTVisitor
public Set<IProgramVariable> getDeclaredVariables()
public LinkedHashSet<LocationVariable> getAllVariables()
public LinkedHashSet<LocationVariable> result()
result
in class ProgramVariableCollector