|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcetus.hir.Statement
public abstract class Statement
Base class for all statements. Statement is the base class of numerous specific statement classes. Use the Java instanceof operator to determine the specific type of a Statement.
| Field Summary | |
|---|---|
protected java.util.List<Annotation> |
annotations
|
protected java.util.LinkedList<Traversable> |
children
|
protected int |
line_number
|
protected java.lang.reflect.Method |
object_print_method
|
protected Traversable |
parent
|
| Constructor Summary | |
|---|---|
protected |
Statement()
Constructor for derived classes. |
protected |
Statement(int size)
Constructor for derived classes that preallocates space for multiple children. |
| Method Summary | ||
|---|---|---|
void |
annotate(Annotation annotation)
Annotates with the given annotation. |
|
void |
annotateAfter(Annotation annotation)
|
|
void |
annotateBefore(Annotation annotation)
|
|
java.lang.String |
annotationToString(int position)
Returns the string representation of the annotations with the given relative position. |
|
java.lang.Object |
clone()
|
|
boolean |
containsAnnotation(java.lang.Class<? extends Annotation> type,
java.lang.String key)
Checks if this annotatable contains the specified annotation type and key. |
|
void |
detach()
Detaches this statement from it's parent, if it has one. |
|
|
getAnnotation(java.lang.Class<T> type,
java.lang.String key)
Returns the annotation with the specified type and key. |
|
java.util.List<Annotation> |
getAnnotations()
Returns the list of annotations. |
|
|
getAnnotations(java.lang.Class<T> type)
Returns the list of annotations with the given type. |
|
java.util.List<Annotation> |
getAnnotations(int position)
Returns the list of annotations with the given relative position. |
|
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. |
|
void |
print(java.io.OutputStream stream)
Print the code for the IR represented by the object. |
|
void |
removeAnnotations()
Remove all annotations. |
|
void |
removeAnnotations(java.lang.Class<?> type)
Remove all annotations of the given 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 |
toAnnotatedString()
Returns the string representation of the object with annotations being printed as well. |
|
abstract java.lang.String |
toString()
Returns a string representation of this statement; every child class should implement this method. |
|
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. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.reflect.Method object_print_method
protected Traversable parent
protected java.util.LinkedList<Traversable> children
protected int line_number
protected java.util.List<Annotation> annotations
| Constructor Detail |
|---|
protected Statement()
protected Statement(int size)
size - The expected number of children for this statement.| Method Detail |
|---|
public java.lang.Object clone()
clone in class java.lang.Objectpublic void detach()
public java.util.List<Traversable> getChildren()
Traversable
getChildren in interface Traversablepublic Traversable getParent()
Traversable
getParent in interface Traversablepublic Procedure getProcedure()
DeclarationStatement to be
located somewhere other than a procedure.public void print(java.io.OutputStream stream)
Printable
print in interface Printablestream - The stream on which to print the data.public void removeChild(Traversable child)
removeChild in interface Traversablechild - The child to remove.
public void setChild(int index,
Traversable t)
Traversable
setChild in interface Traversablepublic void setParent(Traversable t)
Traversable
setParent 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 abstract 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)
Annotatable
annotate in interface Annotatablepublic void annotateAfter(Annotation annotation)
annotateAfter in interface Annotatablepublic void annotateBefore(Annotation annotation)
annotateBefore in interface Annotatablepublic java.util.List<Annotation> getAnnotations()
Annotatable
getAnnotations in interface Annotatablepublic <T extends Annotation> java.util.List<T> getAnnotations(java.lang.Class<T> type)
Annotatable
getAnnotations in interface Annotatable
public boolean containsAnnotation(java.lang.Class<? extends Annotation> type,
java.lang.String key)
Annotatable
containsAnnotation in interface Annotatable
public <T extends Annotation> T getAnnotation(java.lang.Class<T> type,
java.lang.String key)
Annotatable
getAnnotation in interface Annotatablepublic java.util.List<Annotation> getAnnotations(int position)
Annotatable
getAnnotations in interface Annotatablepublic void removeAnnotations()
Annotatable
removeAnnotations in interface Annotatablepublic void removeAnnotations(java.lang.Class<?> type)
Annotatable
removeAnnotations in interface Annotatablepublic java.lang.String annotationToString(int position)
Annotatable
annotationToString in interface Annotatablepublic java.lang.String toAnnotatedString()
Annotatable
toAnnotatedString in interface Annotatable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||