public abstract class Declarator extends java.lang.Object implements java.lang.Cloneable, Traversable
| Modifier and Type | Method and Description |
|---|---|
abstract void |
addParameter(Declaration decl)
Inserts a new child declaration to the parameter list.
|
abstract void |
addParameterAfter(Declaration ref,
Declaration decl)
Inserts a new child declaration to the parameter list after the given
reference declaration.
|
abstract void |
addParameterBefore(Declaration ref,
Declaration decl)
Inserts a new child declaration to the parameter list before the given
reference declaration.
|
void |
addTrailingSpecifier(Specifier spec)
Appends a new specifier to the list of trailing specifiers.
|
Declarator |
clone() |
static void |
defaultPrint(Declarator d,
java.io.PrintWriter o)
Prints a declarator to a stream.
|
boolean |
equals(java.lang.Object o)
Checks if the given object is equal to the declarator.
|
java.util.List<Specifier> |
getArraySpecifiers()
Returns the list of specifiers trailing the declarator.
|
java.util.List<Traversable> |
getChildren()
Provides access to the children of this object as a list.
|
abstract IDExpression |
getID()
Returns the symbol declared by this declarator.
|
Initializer |
getInitializer()
Returns the variable initializer of the declarator if one exists.
|
Declaration |
getParameter(int index)
Returns the parameter at specified index.
|
abstract java.util.List<Declaration> |
getParameters()
Returns a List of Function Parameter
|
Traversable |
getParent()
Provides access to the parent of this object.
|
java.util.List<Specifier> |
getSpecifiers()
Returns the list of specifiers leading the declarator.
|
int |
hashCode()
Returns the hash code of the declarator.
|
void |
print(java.io.PrintWriter o)
Prints the declarator to the specified print writer.
|
void |
removeChild(Traversable child)
This traversable interface is not supported for declarators.
|
void |
setChild(int index,
Traversable t)
This traversable interface is not supported for declarators.
|
void |
setInitializer(Initializer init)
Sets the initial value of the variable.
|
void |
setParent(Traversable t)
Sets the parent of this object.
|
java.lang.String |
toString()
Converts the declarator to a string by calling the default print method.
|
public abstract void addParameter(Declaration decl)
decl - the new parameter declaration to be inserted.NotAnOrphanException - if decl has a parent object.public abstract void addParameterBefore(Declaration ref, Declaration decl)
ref - the reference parameter declaration.decl - the new parameter declaration to be inserted.java.lang.IllegalArgumentException - if ref is not found.NotAnOrphanException - if decl has a parent object.public abstract void addParameterAfter(Declaration ref, Declaration decl)
ref - the reference parameter declaration.decl - the new parameter declaration to be inserted.java.lang.IllegalArgumentException - if ref is not found.NotAnOrphanException - if decl has a parent object.public void addTrailingSpecifier(Specifier spec)
spec - the new specifier to be appended.public Declarator 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.public int hashCode()
hashCode in class java.lang.Objectpublic static void defaultPrint(Declarator d, java.io.PrintWriter o)
d - The declarator to print.o - The writer on which to print the declarator.public java.lang.String toString()
toString in class java.lang.Objectpublic java.util.List<Traversable> getChildren()
TraversablegetChildren in interface Traversablepublic Initializer getInitializer()
public abstract java.util.List<Declaration> getParameters()
public Declaration getParameter(int index)
index - - zero-based index of the required parameterpublic Traversable getParent()
TraversablegetParent in interface Traversablepublic java.util.List<Specifier> getArraySpecifiers()
public java.util.List<Specifier> getSpecifiers()
public abstract IDExpression getID()
public void print(java.io.PrintWriter o)
public void removeChild(Traversable child)
removeChild in interface Traversablechild - a reference to a child object that must match with ==.java.lang.UnsupportedOperationException - always.public void setChild(int index,
Traversable t)
setChild in interface Traversablejava.lang.UnsupportedOperationException - always.public void setInitializer(Initializer init)
init - An initial value for the variable.public void setParent(Traversable t)
TraversablesetParent in interface Traversable