public class NewArray extends TypeOperator implements Reference, ReferencePrefix
NewArray has either a list of dimension length expressions, or a single ArrayInitializer.
Modifier and Type | Field and Description |
---|---|
protected ArrayInitializer |
arrayInitializer
Array initializer.
|
protected int |
dimensions
Dimensions.
|
private KeYJavaType |
keyJavaType
the key java type of this array
|
typeReference
Constructor and Description |
---|
NewArray(Expression[] arguments,
TypeReference typeRef,
KeYJavaType keyJavaType,
ArrayInitializer init,
int dimensions)
New array.
|
NewArray(ExtList children,
KeYJavaType keyJavaType,
ArrayInitializer init,
int dimensions)
New array.
|
Modifier and Type | Method and Description |
---|---|
int |
getArity()
Get arity.
|
ArrayInitializer |
getArrayInitializer()
Get array initializer.
|
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.
|
KeYJavaType |
getKeYJavaType() |
KeYJavaType |
getKeYJavaType(Services javaServ)
same as getKeYJavaType()
|
SourceElement |
getLastElement()
Finds the source element that occurs last in the source.
|
int |
getNotation()
Get notation.
|
int |
getPrecedence()
Get precedence.
|
ReferencePrefix |
getReferencePrefix()
We do not have a prefix, so fake it!
|
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
|
getKeYJavaType, getTypeReference, getTypeReferenceAt, getTypeReferenceCount
getArguments, getFirstElement, getFirstElementIncludingBlocks, isLeftAssociative, isToBeParenthesized, precedes, reuseSignature
compatibleBlockSize, computeHashCode, equals, equalsModRenaming, getArrayPos, match, matchChildren
getComments, hashCode, prettyPrintMain
getEndPosition, getParentClass, getPositionInfo, getRelativePosition, getStartPosition, setParentClass, toSource, toString, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getComments, match
equalsModRenaming, getEndPosition, getFirstElement, getFirstElementIncludingBlocks, getPositionInfo, getRelativePosition, getStartPosition
protected final int dimensions
protected final ArrayInitializer arrayInitializer
private final KeYJavaType keyJavaType
public NewArray(ExtList children, KeYJavaType keyJavaType, ArrayInitializer init, int dimensions)
children
- an ExtList with the children of this node
(remove the ArrayInitializer out of the list).init
- the arrayInitializerdimensions
- an int value.public NewArray(Expression[] arguments, TypeReference typeRef, KeYJavaType keyJavaType, ArrayInitializer init, int dimensions)
arguments
- an array of expressions describing the
dimensionstypeRef
- a reference to the arraytypeinit
- the arrayInitializerdimensions
- an int value.public SourceElement getLastElement()
JavaSourceElement
getLastElement
in interface SourceElement
getLastElement
in class Operator
JavaSourceElement.toSource()
,
JavaSourceElement.getEndPosition()
public int getArity()
public int getPrecedence()
getPrecedence
in class Operator
public int getNotation()
getNotation
in class Operator
public int getDimensions()
public ArrayInitializer getArrayInitializer()
public int getChildCount()
getChildCount
in interface NonTerminalProgramElement
getChildCount
in class Operator
public ProgramElement getChildAt(int index)
getChildAt
in interface NonTerminalProgramElement
getChildAt
in class Operator
index
- an index into this node's "virtual" child arrayjava.lang.ArrayIndexOutOfBoundsException
- if index is out
of boundspublic int getExpressionCount()
getExpressionCount
in interface ExpressionContainer
getExpressionCount
in class Operator
public Expression getExpressionAt(int index)
getExpressionAt
in interface ExpressionContainer
getExpressionAt
in class Operator
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 ReferencePrefix getReferencePrefix()
getReferencePrefix
in interface ReferencePrefix
public KeYJavaType getKeYJavaType(Services javaServ)
getKeYJavaType
in class TypeOperator
public KeYJavaType getKeYJavaType()