public class VariableSpecification extends JavaNonTerminalProgramElement implements NamedProgramElement, ExpressionContainer, Variable
VariableDeclaration
and does not
contain a type reference or own modifiers. Note that calls to modifiers
are delegated to the enclosing variable declaration and are therefore
discouraged. This was necessary to subtype Declaration as analyses are
interested in the exact location of a variable name.Modifier and Type | Field and Description |
---|---|
protected int |
dimensions
Dimensions.
|
protected Expression |
initializer
Initializer.
|
protected Type |
type
the type
|
protected IProgramVariable |
var |
Constructor and Description |
---|
VariableSpecification() |
VariableSpecification(ExtList children,
IProgramVariable var,
int dim,
Type type)
Constructor for the transformation of RECODER ASTs to KeY.
|
VariableSpecification(IProgramVariable var) |
VariableSpecification(IProgramVariable var,
Expression init,
Type type) |
VariableSpecification(IProgramVariable var,
int dim,
Expression init,
Type type) |
VariableSpecification(IProgramVariable var,
int dim,
Expression init,
Type type,
PositionInfo pi) |
VariableSpecification(IProgramVariable var,
Type type) |
Modifier and Type | Method and Description |
---|---|
protected int |
computeHashCode() |
boolean |
equals(java.lang.Object o) |
boolean |
equalsModRenaming(SourceElement se,
NameAbstractionTable nat)
equals modulo renaming is described in the corresponding
comment in class SourceElement.
|
ProgramElement |
getChildAt(int index)
Returns the child at the specified index in this node's "virtual"
child array
|
int |
getChildCount()
Returns the number of children of this node.
|
int |
getDimensions()
Get dimensions.
|
Expression |
getExpressionAt(int index) |
int |
getExpressionCount()
Get the number of expressions in this container.
|
SourceElement |
getFirstElement()
Finds the source element that occurs first in the source.
|
java.lang.String |
getFullName()
Returns the maximal expanded name including all applicable
qualifiers.
|
Expression |
getInitializer()
Get initializer.
|
SourceElement |
getLastElement()
Finds the source element that occurs last in the source.
|
java.lang.String |
getName()
Get name.
|
ProgramElementName |
getProgramElementName()
Get name.
|
IProgramVariable |
getProgramVariable()
Get program variable
|
Type |
getType()
Returns the type of this variable.
|
boolean |
hasInitializer() |
boolean |
isFinal()
Checks if this variable is final.
|
MatchConditions |
match(SourceData source,
MatchConditions matchCond)
matches the source "text" (@link SourceData#getSource()) against the pattern represented
by this object.
|
void |
prettyPrint(PrettyPrinter p)
Pretty printing the source element.
|
void |
visit(Visitor v)
calls the corresponding method of a visitor in order to
perform some action/transformation on this element
|
compatibleBlockSize, getArrayPos, matchChildren
getComments, hashCode, prettyPrintMain, reuseSignature
getEndPosition, getFirstElementIncludingBlocks, getParentClass, getPositionInfo, getRelativePosition, getStartPosition, setParentClass, toSource, toString, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getComments
getEndPosition, getFirstElementIncludingBlocks, getPositionInfo, getRelativePosition, getStartPosition
protected final Expression initializer
protected final int dimensions
protected final Type type
protected final IProgramVariable var
public VariableSpecification()
public VariableSpecification(IProgramVariable var)
public VariableSpecification(IProgramVariable var, Type type)
public VariableSpecification(IProgramVariable var, Expression init, Type type)
public VariableSpecification(IProgramVariable var, int dim, Expression init, Type type)
public VariableSpecification(IProgramVariable var, int dim, Expression init, Type type, PositionInfo pi)
public VariableSpecification(ExtList children, IProgramVariable var, int dim, Type type)
children
- the children of this AST element as KeY classes.
May contain:
an Expression (as initializer of the variable)
a Commentdim
- the dimension of this typepublic int getChildCount()
getChildCount
in interface NonTerminalProgramElement
public ProgramElement getChildAt(int index)
getChildAt
in interface NonTerminalProgramElement
index
- an index into this node's "virtual" child arrayjava.lang.ArrayIndexOutOfBoundsException
- if index is out
of boundsprotected int computeHashCode()
computeHashCode
in class JavaNonTerminalProgramElement
public int getExpressionCount()
getExpressionCount
in interface ExpressionContainer
public Expression getExpressionAt(int index)
getExpressionAt
in interface ExpressionContainer
public final java.lang.String getName()
getName
in interface NamedModelElement
public ProgramElementName getProgramElementName()
getProgramElementName
in interface NamedProgramElement
public IProgramVariable getProgramVariable()
public int getDimensions()
public Expression getInitializer()
public boolean hasInitializer()
public boolean isFinal()
Variable
public Type getType()
Variable
public java.lang.String getFullName()
ProgramModelElement
getFullName
in interface ProgramModelElement
public SourceElement getFirstElement()
JavaSourceElement
getFirstElement
in interface SourceElement
getFirstElement
in class JavaSourceElement
JavaSourceElement.toSource()
,
JavaSourceElement.getStartPosition()
public SourceElement getLastElement()
JavaSourceElement
getLastElement
in interface SourceElement
getLastElement
in class JavaSourceElement
JavaSourceElement.toSource()
,
JavaSourceElement.getEndPosition()
public void visit(Visitor v)
visit
in interface SourceElement
v
- the Visitorpublic void prettyPrint(PrettyPrinter p) throws java.io.IOException
JavaSourceElement
prettyPrint
in interface SourceElement
prettyPrint
in class JavaProgramElement
p
- a pretty printer.java.io.IOException
- occasionally thrown.public boolean equalsModRenaming(SourceElement se, NameAbstractionTable nat)
equalsModRenaming
in interface SourceElement
equalsModRenaming
in class JavaNonTerminalProgramElement
public boolean equals(java.lang.Object o)
equals
in class JavaNonTerminalProgramElement
public MatchConditions match(SourceData source, MatchConditions matchCond)
ProgramElement
MatchConditions
with
the found instantiations of the schemavariables. If the match
failed, null is returned instead.match
in interface ProgramElement
match
in class JavaNonTerminalProgramElement
source
- the SourceData with the program element to matchmatchCond
- the MatchConditions found up to this point