org.openrdf.query.parser.sparql.ast
Class SimpleNode

java.lang.Object
  extended by org.openrdf.query.parser.sparql.ast.SimpleNode
All Implemented Interfaces:
Node
Direct Known Subclasses:
ASTAnd, ASTBaseDecl, ASTBasicGraphPattern, ASTBlankNode, ASTBlankNodePropertyList, ASTBound, ASTCollection, ASTCompare, ASTConstraint, ASTConstruct, ASTDatasetClause, ASTDatatype, ASTDescribe, ASTFalse, ASTFunctionCall, ASTGraphGraphPattern, ASTGraphPatternGroup, ASTIRI, ASTIsBlank, ASTIsIRI, ASTIsLiteral, ASTLang, ASTLangMatches, ASTLimit, ASTMath, ASTNot, ASTNumericLiteral, ASTObjectList, ASTOffset, ASTOptionalGraphPattern, ASTOr, ASTOrderClause, ASTOrderCondition, ASTPrefixDecl, ASTPropertyList, ASTQName, ASTQuery, ASTQueryContainer, ASTRDFLiteral, ASTRegexExpression, ASTSameTerm, ASTSelect, ASTStr, ASTString, ASTTriplesSameSubject, ASTTrue, ASTUnionGraphPattern, ASTVar, ASTWhereClause

public class SimpleNode
extends Object
implements Node


Field Summary
protected  List<Node> children
           
protected  int id
           
protected  Node parent
           
protected  SyntaxTreeBuilder parser
           
 
Constructor Summary
SimpleNode(int id)
           
SimpleNode(SyntaxTreeBuilder parser, int id)
           
 
Method Summary
 Object childrenAccept(SyntaxTreeBuilderVisitor visitor, Object data)
          Accept the visitor.
 String dump(String prefix)
          Writes a tree-like representation of this node and all of its subnodes (recursively) and returns it as a string.
 void dump(String prefix, Appendable out)
          Writes a tree-like representation of this node and all of its subnodes (recursively) to the supplied Appendable.
 Object jjtAccept(SyntaxTreeBuilderVisitor visitor, Object data)
          Accept the visitor.
 void jjtAddChild(Node n, int i)
          This method tells the node to add its argument to the node's list of children.
 void jjtAppendChild(Node n)
          Adds the supplied node as the last child node to this node.
 void jjtClose()
          This method is called after all the child nodes have been added.
<T extends Node>
T
jjtGetChild(Class<T> type)
          Gets the (first) child of this node that is of the specific type.
 Node jjtGetChild(int i)
          This method returns a child node.
 List<Node> jjtGetChildren()
           
<T extends Node>
List<T>
jjtGetChildren(Class<T> type)
           
 int jjtGetNumChildren()
          Return the number of children the node has.
 Node jjtGetParent()
           
 void jjtInsertChild(Node n, int i)
          Adds the supplied node as the i'th child node to this node.
 void jjtOpen()
          This method is called after the node has been made the current node.
 void jjtReplaceChild(Node oldNode, Node newNode)
          Replaces a child node with a new node.
 void jjtReplaceWith(Node newNode)
          Replaces this node with the supplied one in the AST.
 void jjtSetParent(Node n)
          This pair of methods are used to inform the node of its parent.
 String toString()
           
 String toString(String prefix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parent

protected Node parent

children

protected List<Node> children

id

protected int id

parser

protected SyntaxTreeBuilder parser
Constructor Detail

SimpleNode

public SimpleNode(int id)

SimpleNode

public SimpleNode(SyntaxTreeBuilder parser,
                  int id)
Method Detail

jjtOpen

public void jjtOpen()
Description copied from interface: Node
This method is called after the node has been made the current node. It indicates that child nodes can now be added to it.

Specified by:
jjtOpen in interface Node

jjtClose

public void jjtClose()
Description copied from interface: Node
This method is called after all the child nodes have been added.

Specified by:
jjtClose in interface Node

jjtSetParent

public void jjtSetParent(Node n)
Description copied from interface: Node
This pair of methods are used to inform the node of its parent.

Specified by:
jjtSetParent in interface Node

jjtGetParent

public Node jjtGetParent()
Specified by:
jjtGetParent in interface Node

jjtAddChild

public void jjtAddChild(Node n,
                        int i)
Description copied from interface: Node
This method tells the node to add its argument to the node's list of children.

Specified by:
jjtAddChild in interface Node

jjtAppendChild

public void jjtAppendChild(Node n)
Description copied from interface: Node
Adds the supplied node as the last child node to this node.

Specified by:
jjtAppendChild in interface Node

jjtInsertChild

public void jjtInsertChild(Node n,
                           int i)
Description copied from interface: Node
Adds the supplied node as the i'th child node to this node.

Specified by:
jjtInsertChild in interface Node

jjtReplaceChild

public void jjtReplaceChild(Node oldNode,
                            Node newNode)
Description copied from interface: Node
Replaces a child node with a new node.

Specified by:
jjtReplaceChild in interface Node

jjtReplaceWith

public void jjtReplaceWith(Node newNode)
Replaces this node with the supplied one in the AST.

Parameters:
newNode - The replacement node.

jjtGetChildren

public List<Node> jjtGetChildren()

jjtGetChild

public Node jjtGetChild(int i)
Description copied from interface: Node
This method returns a child node. The children are numbered from zero, left to right.

Specified by:
jjtGetChild in interface Node

jjtGetChild

public <T extends Node> T jjtGetChild(Class<T> type)
Gets the (first) child of this node that is of the specific type.

Parameters:
type - The type of the child node that should be returned.
Returns:
The (first) child node of the specified type, or null if no such child node was found.

jjtGetChildren

public <T extends Node> List<T> jjtGetChildren(Class<T> type)

jjtGetNumChildren

public int jjtGetNumChildren()
Description copied from interface: Node
Return the number of children the node has.

Specified by:
jjtGetNumChildren in interface Node

jjtAccept

public Object jjtAccept(SyntaxTreeBuilderVisitor visitor,
                        Object data)
                 throws VisitorException
Description copied from interface: Node
Accept the visitor.

Specified by:
jjtAccept in interface Node
Throws:
VisitorException

childrenAccept

public Object childrenAccept(SyntaxTreeBuilderVisitor visitor,
                             Object data)
                      throws VisitorException
Accept the visitor.

Throws:
VisitorException

toString

public String toString()
Overrides:
toString in class Object

toString

public String toString(String prefix)

dump

public void dump(String prefix,
                 Appendable out)
          throws IOException
Writes a tree-like representation of this node and all of its subnodes (recursively) to the supplied Appendable.

Throws:
IOException

dump

public String dump(String prefix)
Writes a tree-like representation of this node and all of its subnodes (recursively) and returns it as a string.



Copyright © 2001-2008 Aduna. All Rights Reserved.