public abstract class Statement extends java.lang.Object implements java.lang.Cloneable, Traversable, Annotatable
| Modifier and Type | Method and Description |
|---|---|
void |
annotate(Annotation annotation)
Inserts the given annotation to this statement.
|
void |
annotateAfter(Annotation annotation)
Inserts the given annotation after this statement.
|
void |
annotateBefore(Annotation annotation)
Inserts the given annotation before this statement.
|
Statement |
clone()
Returns a clone of the statement
|
boolean |
containsAnnotation(java.lang.Class<? extends Annotation> type,
java.lang.String key)
Checks if this statement contains any annotation with the specified type
and the string key.
|
void |
detach()
Detaches this statement from it's parent, if it has one.
|
boolean |
equals(java.lang.Object o)
Compares the statement with the specified object for equality.
|
<T extends Annotation> |
getAnnotation(java.lang.Class<T> type,
java.lang.String key)
Returns the first occurrence of the annotation with the specified type
and the string key.
|
java.util.List<Annotation> |
getAnnotations()
Returns the list of annotations attached to this statement.
|
<T extends Annotation> |
getAnnotations(java.lang.Class<T> type)
Returns the list of annotations with the specified type, attached to this
statement.
|
java.util.List<Annotation> |
getAnnotations(int position)
Returns the list of annotations attached at the specified position of this
statement.
|
java.util.List<Traversable> |
getChildren()
Provides access to the children of this object as a list.
|
Traversable |
getParent()
Provides access to the parent of this object.
|
Procedure |
getProcedure()
Returns the procedure in which this statement is located.
|
int |
hashCode()
Returns the hash code of the statement.
|
void |
print(java.io.PrintWriter o)
Prints the statement on the specified print writer.
|
void |
removeAnnotations()
Removes all annotations attached to this statement.
|
void |
removeAnnotations(java.lang.Class<? extends Annotation> type)
Removes all annotations with the specified type.
|
void |
removeChild(Traversable child)
Removes a specific child of this statement;
some statements do not support this method.
|
void |
setChild(int index,
Traversable t)
Sets the indexth child of this object to t.
|
void |
setLineNumber(int line)
Sets the line number of this statement
This function is to be used only for parser development
|
void |
setParent(Traversable t)
Sets the parent of this object.
|
void |
setPrintMethod(java.lang.reflect.Method m)
Overrides the print method for this object only.
|
void |
swapWith(Statement stmt)
Swaps two statements on the IR tree.
|
java.lang.String |
toString()
Returns a string representation of the statement
|
void |
verify()
Verifies three properties of this object:
(1) All children are not null, (2) the parent object has this
object as a child, (3) all children have this object as the parent.
|
int |
where()
Returns the line number of this statement if the
statement was present in the original source file.
|
public Statement clone()
clone in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - the object to be compared.(o == this), false otherwise.public int hashCode()
hashCode in class java.lang.Objectpublic void detach()
public java.util.List<Traversable> getChildren()
TraversablegetChildren in interface Traversablepublic Traversable getParent()
TraversablegetParent in interface Traversablepublic Procedure getProcedure()
public void print(java.io.PrintWriter o)
public void removeChild(Traversable child)
removeChild in interface Traversablechild - The child to remove.public void setChild(int index,
Traversable t)
TraversablesetChild in interface Traversablepublic void setParent(Traversable t)
TraversablesetParent in interface Traversablepublic void setPrintMethod(java.lang.reflect.Method m)
m - The new print method.public void swapWith(Statement stmt)
stmt - The statement with which to swap this statement.java.lang.IllegalArgumentException - if stmt is null.java.lang.IllegalStateException - if the types of the statements
are such that they would create inconsistent IR when swapped.public void setLineNumber(int line)
line - The line numberpublic java.lang.String toString()
toString in class java.lang.Objectpublic int where()
public void verify()
throws java.lang.IllegalStateException
java.lang.IllegalStateException - if any of the properties are not true.public void annotate(Annotation annotation)
annotate in interface Annotatableannotation - the annotation to be inserted.public void annotateAfter(Annotation annotation)
annotateAfter in interface Annotatableannotation - the annotation to be inserted.public void annotateBefore(Annotation annotation)
annotateBefore in interface Annotatableannotation - the annotation to be inserted.public java.util.List<Annotation> getAnnotations()
getAnnotations in interface Annotatablepublic <T extends Annotation> java.util.List<T> getAnnotations(java.lang.Class<T> type)
getAnnotations in interface Annotatabletype - the annotation type of intereset.public boolean containsAnnotation(java.lang.Class<? extends Annotation> type, java.lang.String key)
containsAnnotation in interface Annotatabletype - the annotation type of interest.key - the key to be searched for.public <T extends Annotation> T getAnnotation(java.lang.Class<T> type, java.lang.String key)
getAnnotation in interface Annotatabletype - the annotation type of interest.key - the key to be searched for.public java.util.List<Annotation> getAnnotations(int position)
getAnnotations in interface Annotatableposition - the annotation position to be searched.public void removeAnnotations()
removeAnnotations in interface Annotatablepublic void removeAnnotations(java.lang.Class<? extends Annotation> type)
removeAnnotations in interface Annotatabletype - the annotation type to be removed.