org.apache.jdo.impl.jdoql.tree
Class NodeImpl

java.lang.Object
  extended by antlr.BaseAST
      extended by antlr.CommonAST
          extended by org.apache.jdo.impl.jdoql.jdoqlc.JDOQLAST
              extended by org.apache.jdo.impl.jdoql.tree.NodeImpl
All Implemented Interfaces:
antlr.collections.AST, java.io.Serializable, java.lang.Cloneable, Node
Direct Known Subclasses:
CandidateClassImpl, Decl, Expr, OrderingExpr, Tree, TypeImpl

public class NodeImpl
extends JDOQLAST
implements Node

This is the base class of all nodes. Examples of nodes are , Declaration, Expression and OrderingExpression. This class is not defined abstract to allow the syntactical analysis to construct general nodes, which are replaced by the semantic analysis with their specialized counterparts.

Author:
Michael Watzek
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.jdo.impl.jdoql.jdoqlc.JDOQLAST
column, line, typeInfo
 
Fields inherited from class antlr.BaseAST
down, right
 
Constructor Summary
NodeImpl()
          The noarg constructor is needed for ANTLR support and deserialization.
NodeImpl(antlr.Token token)
          The noarg constructor is needed for ANTLR support.
 
Method Summary
 void arrive(NodeVisitor visitor)
          Implements a noop as a default implementation.
protected  java.lang.Object clone()
          Creates and returns a copy of this object nullifying fields parent, children and clazz.
 Node[] getChildren()
          Returns this node's children.
 java.lang.Class getJavaClass()
          Returns the Java type of this node.
 java.lang.Object getObject()
          Returns the user object.
 Node getParent()
          Returns this node's parent node.
 int getTokenType()
          Returns the token type of this node.
 java.lang.Object leave(NodeVisitor visitor, java.lang.Object[] results)
          Returns null as a default implementation.
 void setObject(java.lang.Object object)
          Sets the user object.
 void setParent(Node parent)
          Sets the parent of this node.
 java.lang.String toString()
          Returns a string representation of this JDOQLAST.
 boolean walkNextChild(NodeVisitor visitor, java.lang.Object resultOfPreviousChild, int indexOfNextChild)
          Returns true as a default implementation.
 
Methods inherited from class org.apache.jdo.impl.jdoql.jdoqlc.JDOQLAST
getColumn, getLine, getTypeInfo, initialize, initialize, initialize, setColumn, setLine, setTypeInfo, treeToString
 
Methods inherited from class antlr.CommonAST
getText, getType, initialize, setText, setType
 
Methods inherited from class antlr.BaseAST
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getFirstChild, getNextSibling, getNumberOfChildren, getTokenNames, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NodeImpl

public NodeImpl()
The noarg constructor is needed for ANTLR support and deserialization. The caller must make sure to set the ANTLR tree structure himself or, call setChildren optionally.


NodeImpl

public NodeImpl(antlr.Token token)
The noarg constructor is needed for ANTLR support. The caller must make sure to set the ANTLR tree structure himself or, call setChildren optionally.

Method Detail

clone

protected java.lang.Object clone()
                          throws java.lang.CloneNotSupportedException
Creates and returns a copy of this object nullifying fields parent, children and clazz.

Overrides:
clone in class JDOQLAST
Returns:
the copy
Throws:
java.lang.CloneNotSupportedException - thrown by super.clone()

toString

public java.lang.String toString()
Description copied from class: JDOQLAST
Returns a string representation of this JDOQLAST.

Specified by:
toString in interface antlr.collections.AST
Overrides:
toString in class JDOQLAST
Returns:
a string representation of the object.

getJavaClass

public java.lang.Class getJavaClass()
Returns the Java type of this node.

Specified by:
getJavaClass in interface Node
Returns:
the Java type

getTokenType

public int getTokenType()
Returns the token type of this node.

Specified by:
getTokenType in interface Node
Returns:
the token type

getObject

public java.lang.Object getObject()
Returns the user object.

Specified by:
getObject in interface Node
Returns:
the ouser object

setObject

public void setObject(java.lang.Object object)
Sets the user object.

Specified by:
setObject in interface Node
Parameters:
object - the user object

getParent

public Node getParent()
Returns this node's parent node.

Specified by:
getParent in interface Node
Returns:
the parent node

setParent

public void setParent(Node parent)
Sets the parent of this node.

Specified by:
setParent in interface Node
Parameters:
parent - the parent node

getChildren

public Node[] getChildren()
Returns this node's children. Ensures that this node's children corresponds with the underlying ANTLR tree structure.

Specified by:
getChildren in interface Node
Returns:
the children

arrive

public void arrive(NodeVisitor visitor)
Implements a noop as a default implementation.

Specified by:
arrive in interface Node
Parameters:
visitor - the node visitor

leave

public java.lang.Object leave(NodeVisitor visitor,
                              java.lang.Object[] results)
Returns null as a default implementation.

Specified by:
leave in interface Node
Parameters:
visitor - the node visitor
results - the result array containing result instances of this node's children
Returns:
the result instance of the delegation call of the argument visitor

walkNextChild

public boolean walkNextChild(NodeVisitor visitor,
                             java.lang.Object resultOfPreviousChild,
                             int indexOfNextChild)
Returns true as a default implementation.

Specified by:
walkNextChild in interface Node
Parameters:
visitor - the node visitor
resultOfPreviousChild - the result computed by leaving the previous child node
indexOfNextChild - the index in the children array of the next child to walk
Returns:
true


Copyright © 2005-2009 Apache Software Foundation. All Rights Reserved.