public abstract class GoloElement extends java.lang.Object
Constructor and Description |
---|
GoloElement() |
Modifier and Type | Method and Description |
---|---|
abstract void |
accept(GoloIrVisitor visitor)
Accept the visitor.
|
protected static java.lang.RuntimeException |
cantConvert(java.lang.String expected,
java.lang.Object value) |
protected java.lang.RuntimeException |
cantReplace() |
protected java.lang.RuntimeException |
cantReplace(GoloElement original,
GoloElement replacement) |
protected java.lang.RuntimeException |
doesNotContain(GoloElement element) |
GoloASTNode |
getASTNode() |
java.lang.String |
getDocumentation() |
java.util.Optional<ReferenceTable> |
getLocalReferenceTable() |
java.util.Optional<GoloElement> |
getParentNode() |
PositionInSourceCode |
getPositionInSourceCode() |
boolean |
hasASTNode() |
void |
makeParentOf(GoloElement childElement) |
GoloElement |
ofAST(GoloASTNode node) |
protected abstract void |
replaceElement(GoloElement original,
GoloElement newElement)
Replace a child.
|
void |
replaceInParentBy(GoloElement newElement) |
void |
setASTNode(GoloASTNode node) |
protected void |
setParentNode(GoloElement parentElement) |
abstract void |
walk(GoloIrVisitor visitor)
Walk the visitor through this node children.
|
public GoloElement()
public void setASTNode(GoloASTNode node)
public GoloASTNode getASTNode()
public boolean hasASTNode()
public GoloElement ofAST(GoloASTNode node)
protected void setParentNode(GoloElement parentElement)
public java.util.Optional<GoloElement> getParentNode()
public void makeParentOf(GoloElement childElement)
protected java.lang.RuntimeException cantReplace()
protected java.lang.RuntimeException cantReplace(GoloElement original, GoloElement replacement)
protected java.lang.RuntimeException doesNotContain(GoloElement element)
protected static java.lang.RuntimeException cantConvert(java.lang.String expected, java.lang.Object value)
public void replaceInParentBy(GoloElement newElement)
public java.lang.String getDocumentation()
public PositionInSourceCode getPositionInSourceCode()
public java.util.Optional<ReferenceTable> getLocalReferenceTable()
public abstract void accept(GoloIrVisitor visitor)
This method should only call the visitor visitXXXX
method.
The children of this node will be visited by the
walk(GoloIrVisitor)
method.
public abstract void walk(GoloIrVisitor visitor)
protected abstract void replaceElement(GoloElement original, GoloElement newElement)
Replace original
with newElement
if original
is a child of this node
and type matches.
original
- the original value to replace. Must be a child of this nodenewElement
- the element to replace with. Type must match.java.lang.UnsupportedOperationException
- if this node does not support replacementjava.util.NoSuchElementException
- if original
is not a child of this nodejava.lang.ClassCastException
- if the type of newElement
does not matchcantReplace()
,
cantReplace(GoloElement, GoloElement)
,
doesNotContain(GoloElement)
,
cantConvert(String, Object)