scale.clef
Class Node

java.lang.Object
  |
  +--scale.common.Root
        |
        +--scale.clef.Node
All Implemented Interfaces:
AnnotationInterface, DisplayNode, java.io.Serializable
Direct Known Subclasses:
AggregationElementOp, AltCase, Bound, Declaration, ExceptionKey, Expression, Initializer, PositionOp, Raise, Statement, SuperType, Type, TypecaseAlt, TypecaseKey

public abstract class Node
extends Root
implements java.io.Serializable

The base class for the Clef representation.

$Id: Node.java,v 1.64 2002/01/03 21:42:34 burrill Exp $

Copyright 2002 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.

See Also:
Serialized Form

Fields inherited from interface scale.common.DisplayNode
ANNO, CLEF, DD, DEFUSE, DOM, EXPR, MAYUSE, TYPE
 
Constructor Summary
Node()
          Constructor for a Clef node object.
 
Method Summary
protected  Vector createChildren()
          Create the list of children for the node - each node that has children must implement this method.
 Vector getChildren()
          Return a list containing the node's children.
 Type getCoreType()
          Return the actual Type associated with this Node.
 Declaration getDecl()
          Retun any Declaration associated with this Node.
 Node getParent()
          Return the parent in the AST of this node.
 Type getType()
          Return the Type associated with this Node.
static void setAnnotationLevel(int level)
          Set the depth to which a node displays it's annotations.
 void setParent(Node n)
          Not all nodes have parents in the CLEF AST since it is really a DAG and not a tree structure.
static void setReportLevel(int level)
          Set the depth to which a node displays it's children.
 java.lang.String toString()
           
 java.lang.String toString(java.lang.String del1, java.lang.String del2)
           
 java.lang.String toStringChildren()
          Convert children of this node to a string representation.
 java.lang.String toStringSpecial()
          Return any special information of a node that is not a child or annotation.
abstract  void visit(Predicate p)
          The visit() method is used to implement a visit 'pattern'.
 
Methods inherited from class scale.common.Root
addAnnotation, allAnnotations, allMatchingAnnotations, getAnnotation, getDisplayColorHint, getDisplayName, getDisplayShapeHint, getDisplayString, getDisplayText, getNodeCount, getNodeID, hasAnnotation, hasEqualAnnotation, hashCode, removeAnnotation, removeAnnotations, toStringAnnotations, toStringClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Node

public Node()
Constructor for a Clef node object.
Method Detail

getParent

public Node getParent()
Return the parent in the AST of this node. This is only meaningful for statements, expressions, and declarations. Types do not have parents.
Returns:
my parent in the Clef tree if any

setParent

public void setParent(Node n)
Not all nodes have parents in the CLEF AST since it is really a DAG and not a tree structure. Generate an error unless this method is defined for the derived class.

visit

public abstract void visit(Predicate p)
The visit() method is used to implement a visit 'pattern'.

getType

public Type getType()
Return the Type associated with this Node.

getCoreType

public Type getCoreType()
Return the actual Type associated with this Node. Note - getType() should always be used when the Type is not examined or when the attributes are needed.
See Also:
getType(), RefType

getDecl

public Declaration getDecl()
Retun any Declaration associated with this Node.

createChildren

protected Vector createChildren()
Create the list of children for the node - each node that has children must implement this method. However, use getChildren() to actually get the children.
Returns:
the list of children

getChildren

public final Vector getChildren()
Return a list containing the node's children. We expect that at some point we will optimize this so we have separated the functionality that must be changed by each node (createChildren). To optimize this function we will probably just have to change this one routine.
Returns:
the list of children

toStringChildren

public final java.lang.String toStringChildren()
Convert children of this node to a string representation.

setReportLevel

public static void setReportLevel(int level)
Set the depth to which a node displays it's children.

setAnnotationLevel

public static void setAnnotationLevel(int level)
Set the depth to which a node displays it's annotations.

toString

public java.lang.String toString()
Overrides:
toString in class Root

toString

public final java.lang.String toString(java.lang.String del1,
                                       java.lang.String del2)

toStringSpecial

public java.lang.String toStringSpecial()
Description copied from class: Root
Return any special information of a node that is not a child or annotation. This method is meant to be overridden by nodes that need to provide special output.
Overrides:
toStringSpecial in class Root