|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.common.Root scale.clef.Node
public abstract class Node
The base class for the Clef representation.
$Id: Node.java,v 1.83 2007-03-21 13:31:49 burrill Exp $
Copyright 2007 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
Constructor Summary | |
---|---|
Node()
Constructor for a Clef node object. |
Method Summary | |
---|---|
Node |
getChild(int i)
Return the specified AST child of this node. |
Type |
getCoreType()
Return the actual Type associated with this Node. |
Declaration |
getDecl()
Return any Declaration associated with this Node. |
int |
getSourceLineNumber()
Return the source line number associated with this node or -1 if not known. |
Type |
getType()
Return the Type associated with this Node. |
int |
numChildren()
Return the number of AST children of this node. |
static void |
setAnnotationLevel(int level)
Set the depth to which a node displays it's annotations. |
static void |
setReportLevel(int level)
Set the depth to which a node displays it's children. |
void |
setSourceLineNumber(int lineNumber)
Set the source line number associated with this node or -1 if not known. |
java.lang.String |
toString()
|
java.lang.String |
toString(java.lang.String del1,
java.lang.String del2)
The toString() method with begin and end delimiters specified. |
java.lang.String |
toStringChildren()
Convert children of this node to a string representation. |
java.lang.String |
toStringSpecial()
This method allows sub-classes to provide class specific stuff to the string. |
abstract void |
visit(Predicate p)
Process a node by calling its associated routine. |
Methods inherited from class scale.common.Root |
---|
addAnnotation, allAnnotations, allMatchingAnnotations, getAnnotation, getDisplayColorHint, getDisplayLabel, getDisplayName, getDisplayShapeHint, getDisplayString, getNodeCount, getNodeID, hasAnnotation, hasEqualAnnotation, hashCode, removeAnnotation, removeAnnotations, toStringAnnotations, toStringClass, trace, trace, trace |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Node()
Method Detail |
---|
public abstract void visit(Predicate p)
Each class has a visit(Predicate p)
method. For
example, in class ABC
:
public void visit(Predicate p) { p.visitABC(this); }and the class that implements
Predicate
has a method
public void visitABC(Node n) { ABC a = (ABC) n; ... }Thus, the class that implements
Predicate
can call
n.visit(this);where
n
is a Node
sub-class without
determining which specific sub-class n
is.
The visit pattern basically avoids implementing a large
switch
statement or defining different methods
in each class for some purpose.
Predicate
public Type getType()
public Type getCoreType()
getType()
,
RefType
public Declaration getDecl()
public int numChildren()
public Node getChild(int i)
public java.lang.String toStringChildren()
public static void setReportLevel(int level)
public static void setAnnotationLevel(int level)
public java.lang.String toString()
toString
in class Root
public final java.lang.String toString(java.lang.String del1, java.lang.String del2)
toString()
method with begin and end delimiters specified.
public java.lang.String toStringSpecial()
toStringSpecial
in class Root
public int getSourceLineNumber()
public void setSourceLineNumber(int lineNumber)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |