org.eclipse.datatools.sqltools.sql.parser.ast
Interface Node

All Known Subinterfaces:
IASTDeclareComma, IASTDeclareKeyword, IASTDeployable, IASTRoutine, IASTSQLStatement, IASTSQLStatementElement, IASTStart, IASTTrigger, Node
All Known Implementing Classes:
ASTDeclareComma, ASTDeclareKeyword, ASTExpression, ASTSQLDataType, ASTSQLDelimiter, ASTSQLParam, ASTSQLStatement, ASTStart, SimpleNode, SimpleNode

public interface Node

All AST nodes must implement this interface. It provides basic machinery for constructing the parent and child relationships between nodes.

Note: some methods defined in the interface begin with "jjt", which is a common convention of JavaCC, since we use it as the default parser generator.


Method Summary
 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)
           
 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)
           
 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)
           
 

Method Detail

jjtOpen

void jjtOpen()
This method is called after the node has been made the current node. It indicates that child nodes can now be added to it.


jjtClose

void jjtClose()
This method is called after all the child nodes have been added.


jjtSetParent

void jjtSetParent(Node n)
This pair of methods are used to inform the node of its parent.


jjtGetParent

Node jjtGetParent()

jjtAddChild

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


jjtGetChild

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


jjtGetNumChildren

int jjtGetNumChildren()
Return the number of children the node has.


getLastToken

Token getLastToken()

setLastToken

void setLastToken(Token token)

getFirstToken

Token getFirstToken()

setFirstToken

void setFirstToken(Token token)

getStartOffset

int getStartOffset(org.eclipse.jface.text.IDocument document)
Parameters:
viewer - where the node is displayed
See Also:
getStartOffset()

getEndOffset

int getEndOffset(org.eclipse.jface.text.IDocument document)
Parameters:
viewer - where the node is displayed
See Also:
getGreatestEndOffset, getEndOffset()

getGreatestEndOffset

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

Parameters:
viewer - where the node is displayed
See Also:
getGreatestEndOffset()

setDocument

void setDocument(org.eclipse.jface.text.IDocument document)
Associate this Node with the IDocument

Parameters:
input -

getDocument

org.eclipse.jface.text.IDocument getDocument()

getStartOffset

int getStartOffset()
Before you call this method, make sure setDocument has been called.

Returns:

getEndOffset

int getEndOffset()
Before you call this method, make sure setDocument has been called.

Returns:
See Also:
getGreatestEndOffset

getGreatestEndOffset

int getGreatestEndOffset()
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.

Returns:

getSQLText

java.lang.String getSQLText()
Before you call this method, make sure setDocument has been called.

Returns:
the text representation of this Node

getNextTokenOffset

int getNextTokenOffset()

getNextTokenOffset

int getNextTokenOffset(org.eclipse.jface.text.IDocument document)

getPreviousNode

Node getPreviousNode()
Gets previous node

Parameters:
document -
Returns:

jjtAccept

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

Parameters:
visitor - the visitor to be accepted
data - accessorial data
Returns:
accessorial data for subsequent visiting

exists

boolean exists()