lab7
Class AbstractNode

java.lang.Object
  extended by lab7.AbstractNode
All Implemented Interfaces:
NodeDumpable, ReflectiveVisitable
Direct Known Subclasses:
CastNode

public abstract class AbstractNode
extends java.lang.Object
implements ReflectiveVisitable, NodeDumpable

All AST nodes are subclasses of this node. This node knows how to link itself with other siblings and adopt children. Each node gets a node number to help identify it distinctly in an AST.


Constructor Summary
AbstractNode()
           
 
Method Summary
 AbstractNode abandonChildren()
           
 void accept(ReflectiveVisitor v)
          Reflective visitor pattern
 AbstractNode adoptChildren(AbstractNode n)
          Adopt the supplied node and all of its siblings under this node
 java.lang.String dump()
           
 AbstractNode getChild()
           
 AbstractNode getFirst()
           
 java.lang.String getName()
           
 int getNodeNum()
           
 Type getNodeType()
           
 AbstractNode getParent()
           
 AbstractNode getSib()
           
 AbstractNode makeSibling(AbstractNode sib)
          Join the end of this sibling's list with the supplied sibling's list
 AbstractNode orphan()
           
 void setNodeType(Type type)
           
 java.lang.String toString()
           
 void walkTree(Visitable v)
          Obsolete, do not use!
 java.lang.String whatAmI()
          Reflectively indicate the class of "this" node
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractNode

public AbstractNode()
Method Detail

makeSibling

public AbstractNode makeSibling(AbstractNode sib)
Join the end of this sibling's list with the supplied sibling's list


adoptChildren

public AbstractNode adoptChildren(AbstractNode n)
Adopt the supplied node and all of its siblings under this node


orphan

public AbstractNode orphan()

abandonChildren

public AbstractNode abandonChildren()

getParent

public AbstractNode getParent()

getSib

public AbstractNode getSib()

getChild

public AbstractNode getChild()

getFirst

public AbstractNode getFirst()

getNodeType

public Type getNodeType()

setNodeType

public void setNodeType(Type type)

getName

public java.lang.String getName()

toString

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

dump

public java.lang.String dump()
Specified by:
dump in interface NodeDumpable

getNodeNum

public int getNodeNum()

whatAmI

public java.lang.String whatAmI()
Reflectively indicate the class of "this" node


accept

public final void accept(ReflectiveVisitor v)
Reflective visitor pattern

Specified by:
accept in interface ReflectiveVisitable

walkTree

public void walkTree(Visitable v)
Obsolete, do not use!