public abstract class JavaSourceElement extends java.lang.Object implements SourceElement
SourceElement
.
taken from COMPOST and changed to achieve an immutable structureModifier and Type | Field and Description |
---|---|
private PositionInfo |
posInfo |
Constructor and Description |
---|
JavaSourceElement()
Java source element.
|
JavaSourceElement(ExtList children)
Java source element.
|
JavaSourceElement(ExtList children,
PositionInfo pos) |
JavaSourceElement(PositionInfo pi)
Java source element.
|
Modifier and Type | Method and Description |
---|---|
Position |
getEndPosition()
Returns the end position of the primary token of this element.
|
SourceElement |
getFirstElement()
Finds the source element that occurs first in the source.
|
SourceElement |
getFirstElementIncludingBlocks()
Finds the source element that occurs first in the source.
|
SourceElement |
getLastElement()
Finds the source element that occurs last in the source.
|
java.lang.String |
getParentClass()
get the class the statement originates from
|
private PositionInfo |
getPosInfo(PositionInfo p)
internal method use to guarantee the position info object is
always not the null reference
|
PositionInfo |
getPositionInfo()
complete position information
|
Position |
getRelativePosition()
Returns the relative position (number of blank heading lines and
columns) of the primary token of this element.
|
Position |
getStartPosition()
Returns the start position of the primary token of this element.
|
abstract void |
prettyPrint(PrettyPrinter w)
Pretty printing the source element.
|
protected void |
setParentClass(java.lang.String s)
this violates immutability, but the method is only called
right after the object is created...
|
java.lang.String |
toSource()
Creates a syntactical representation of the source element using
the
prettyPrint(de.uka.ilkd.key.java.PrettyPrinter) method. |
java.lang.String |
toString()
toString
|
java.lang.String |
toString(PrettyPrinter pp,
java.io.StringWriter sw) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equalsModRenaming, visit
private final PositionInfo posInfo
public JavaSourceElement()
public JavaSourceElement(PositionInfo pi)
pi
- PositionInfo the PositionInfo of the elementpublic JavaSourceElement(ExtList children)
children
- a list of the children of this element. May contain:
PositionInfopublic JavaSourceElement(ExtList children, PositionInfo pos)
private PositionInfo getPosInfo(PositionInfo p)
p
- a PositionInfoPositionInfo.UNDEFINED
) is returned otherwise
ppublic SourceElement getFirstElement()
getFirstElement
in interface SourceElement
toSource()
,
getStartPosition()
public SourceElement getFirstElementIncludingBlocks()
SourceElement
getFirstElementIncludingBlocks
in interface SourceElement
SourceElement.getStartPosition()
public SourceElement getLastElement()
getLastElement
in interface SourceElement
toSource()
,
getEndPosition()
public abstract void prettyPrint(PrettyPrinter w) throws java.io.IOException
prettyPrint
in interface SourceElement
w
- a pretty printer.java.io.IOException
- occasionally thrown.public java.lang.String toSource()
prettyPrint(de.uka.ilkd.key.java.PrettyPrinter)
method.public Position getStartPosition()
getFirstElement()
.getStartPosition
in interface SourceElement
public Position getEndPosition()
getLastElement()
.getEndPosition
in interface SourceElement
public Position getRelativePosition()
getFirstElement()
.getRelativePosition
in interface SourceElement
public PositionInfo getPositionInfo()
SourceElement
getPositionInfo
in interface SourceElement
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(PrettyPrinter pp, java.io.StringWriter sw)
protected void setParentClass(java.lang.String s)
public java.lang.String getParentClass()