org.eclipse.datatools.sqltools.sql.parser.ast
Class SimpleNode

java.lang.Object
  extended by org.eclipse.datatools.sqltools.sql.parser.ast.SimpleNode
All Implemented Interfaces:
Node
Direct Known Subclasses:
SimpleNode

public class SimpleNode
extends java.lang.Object
implements Node

Base implementation of Node.

Author:
Hui Cao

Constructor Summary
SimpleNode(int i)
           
SimpleNode(SQLParser p, int i)
           
 
Method Summary
 java.lang.Object acceptChildren(ISQLParserVisitor visitor, java.lang.Object data)
          Accepts the visitor for all children.
 void dump(java.lang.String prefix)
           
 boolean equals(java.lang.Object obj)
           
 boolean exists()
           
 org.eclipse.jface.text.IDocument getDocument()
           
 int getEndOffset()
          Before you call this method, make sure setDocument has been called.
 int getEndOffset(org.eclipse.jface.text.IDocument document)
           
 Token getFirstToken()
           
 int getGreatestEndOffset()
          this method differs with getEndOffset in that it takes the trailing spaces into account.
 int getGreatestEndOffset(org.eclipse.jface.text.IDocument document)
          this method differs with getEndOffset in that it takes the trailing spaces into account
 Token getLastToken()
           
 int getNextTokenOffset()
           
 int getNextTokenOffset(org.eclipse.jface.text.IDocument document)
          Get the next token offset
 Node getPreviousNode()
          Gets previous node
 java.lang.String getSQLText()
          Before you call this method, make sure setDocument has been called.
 int getStartOffset()
          Before you call this method, make sure setDocument has been called.
 int getStartOffset(org.eclipse.jface.text.IDocument document)
          The concrete implementation for this method has be removed into Thoken.java.
 java.lang.String getText()
          Returns the node text by concatenate tokens with white spaces.
 java.lang.Object jjtAccept(ISQLParserVisitor visitor, java.lang.Object data)
          Accepts 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 jjtClose()
          This method is called after all the child nodes have been added.
 Node jjtGetChild(int i)
          This method returns a child node.
 int jjtGetNumChildren()
          Return the number of children the node has.
 Node jjtGetParent()
           
 void jjtOpen()
          This method is called after the node has been made the current node.
 void jjtSetParent(Node n)
          This pair of methods are used to inform the node of its parent.
 void setDocument(org.eclipse.jface.text.IDocument document)
          Associate this Node with the IDocument
 void setFirstToken(Token token)
           
 void setLastToken(Token token)
           
 java.lang.String toString()
           
 java.lang.String toString(java.lang.String prefix)
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleNode

public SimpleNode(int i)

SimpleNode

public SimpleNode(SQLParser p,
                  int i)
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

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

jjtGetNumChildren

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

Specified by:
jjtGetNumChildren in interface Node

toString

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

toString

public java.lang.String toString(java.lang.String prefix)

dump

public void dump(java.lang.String prefix)

getLastToken

public Token getLastToken()
Specified by:
getLastToken in interface Node

setLastToken

public void setLastToken(Token token)
Specified by:
setLastToken in interface Node

getFirstToken

public Token getFirstToken()
Specified by:
getFirstToken in interface Node

setFirstToken

public void setFirstToken(Token token)
Specified by:
setFirstToken in interface Node

getStartOffset

public int getStartOffset(org.eclipse.jface.text.IDocument document)
The concrete implementation for this method has be removed into Thoken.java. By stephen

Specified by:
getStartOffset in interface Node
Parameters:
viewer - where the node is displayed
Returns:
See Also:
Node.getStartOffset()

getEndOffset

public int getEndOffset(org.eclipse.jface.text.IDocument document)
Specified by:
getEndOffset in interface Node
Parameters:
viewer - where the node is displayed
See Also:
getGreatestEndOffset

getGreatestEndOffset

public int getGreatestEndOffset(org.eclipse.jface.text.IDocument document)
this method differs with getEndOffset in that it takes the trailing spaces into account

Specified by:
getGreatestEndOffset in interface Node
Parameters:
viewer - where the node is displayed
Returns:
See Also:
Node.getGreatestEndOffset()

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

setDocument

public void setDocument(org.eclipse.jface.text.IDocument document)
Description copied from interface: Node
Associate this Node with the IDocument

Specified by:
setDocument in interface Node

getDocument

public org.eclipse.jface.text.IDocument getDocument()
Specified by:
getDocument in interface Node

getStartOffset

public int getStartOffset()
Description copied from interface: Node
Before you call this method, make sure setDocument has been called.

Specified by:
getStartOffset in interface Node
Returns:

getEndOffset

public int getEndOffset()
Description copied from interface: Node
Before you call this method, make sure setDocument has been called.

Specified by:
getEndOffset in interface Node
Returns:
See Also:
getGreatestEndOffset

getGreatestEndOffset

public int getGreatestEndOffset()
Description copied from interface: Node
this method differs with getEndOffset in that it takes the trailing spaces into account. Before you call this method, make sure setDocument has been called.

Specified by:
getGreatestEndOffset in interface Node
Returns:

getSQLText

public java.lang.String getSQLText()
Description copied from interface: Node
Before you call this method, make sure setDocument has been called.

Specified by:
getSQLText in interface Node
Returns:
the text representation of this Node

getNextTokenOffset

public int getNextTokenOffset()
Specified by:
getNextTokenOffset in interface Node

getNextTokenOffset

public int getNextTokenOffset(org.eclipse.jface.text.IDocument document)
Get the next token offset

Specified by:
getNextTokenOffset in interface Node
Parameters:
viewer - where the node is displayed
See Also:
getGreatestEndOffset

getPreviousNode

public Node getPreviousNode()
Description copied from interface: Node
Gets previous node

Specified by:
getPreviousNode in interface Node
Returns:

getText

public java.lang.String getText()
Returns the node text by concatenate tokens with white spaces.

Returns:
node text

jjtAccept

public java.lang.Object jjtAccept(ISQLParserVisitor visitor,
                                  java.lang.Object data)
Accepts the visitor.

Specified by:
jjtAccept in interface Node
Parameters:
visitor - the visitor to be accepted
data - accessorial data
Returns:
accessorial data for subsequent visiting

acceptChildren

public java.lang.Object acceptChildren(ISQLParserVisitor visitor,
                                       java.lang.Object data)
Accepts the visitor for all children.


exists

public boolean exists()
Specified by:
exists in interface Node