de.hunsicker.jalopy.language.antlr
Class Node

java.lang.Object
  |
  +--antlr.BaseAST
        |
        +--antlr.CommonAST
              |
              +--antlr.CommonASTWithHiddenTokens
                    |
                    +--de.hunsicker.jalopy.language.antlr.Node
All Implemented Interfaces:
antlr.collections.AST, java.lang.Comparable, java.io.Serializable
Direct Known Subclasses:
JavaNode

public abstract class Node
extends antlr.CommonASTWithHiddenTokens
implements java.lang.Comparable

A node which stores information about its span.

Version:
$Revision: 1.1.2.1 $
Author:
Marco Hunsicker
See Also:
Serialized Form

Field Summary
protected  int endColumn
          Column number where this node ends.
protected  int endLine
          Line number where this node ends.
 int nlAfter
           
protected  int startColumn
          Column number where this node starts.
protected  int startLine
          Line number where this node starts.
protected  java.lang.String text
          Node text.
protected  int type
          Node type.
 
Fields inherited from class antlr.CommonASTWithHiddenTokens
hiddenAfter, hiddenBefore
 
Fields inherited from class antlr.BaseAST
down, right
 
Constructor Summary
Node()
          Creates a new Node object.
Node(int startLine, int startColumn, int endLine, int endColumn)
          Creates a new Node object.
Node(int type, java.lang.String text)
          Creates a new Node object.
Node(int type, java.lang.String text, int startLine, int startColumn, int endLine, int endColumn)
          Creates a new Node object.
Node(java.lang.String text)
          Creates a new Node object.
Node(antlr.Token tok)
          Creates a new Node object from the given token.
 
Method Summary
 void clear()
          Method to prevent references from sticking around
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 boolean contains(int line, int column)
          Checks whether this node contains the given position.
 boolean contains(int aStartLine, int aStartColumn, int aEndLine, int aEndColumn)
          Checks whether this node contains the given position.
 boolean contains(Node node)
          Checks whether this node contains the given node.
 boolean endsAfter(Node other)
          Determines whether this node starts after another one.
 boolean equals(java.lang.Object o)
          Compares the specified object with this object for equality.
 int getEndColumn()
          Returns the column number where this node ends.
 int getEndLine()
          Returns the line number where this node ends.
 int getStartColumn()
          Returns the column number where this node starts.
 int getStartLine()
          Returns the line number where this node starts.
 java.lang.String getText()
          Get the token text for this node
 int getType()
          Get the token type for this node
 void initialize(antlr.collections.AST node)
          Initializes this node with information from the given node.
 void initialize(int newType, java.lang.String newText)
          Initializes this node with the given information.
 void initialize(antlr.Token tok)
          Initializes this node with information from the given token.
 boolean isPositionKnown()
          Indicates whether this node has its location information set.
 void setEndColumn(int column)
          Sets the end column value.
 void setEndLine(int line)
          Sets the end line value.
 void setHiddenAfter(antlr.CommonHiddenStreamToken token)
          Sets the first hidden token that appears after this node.
 void setHiddenBefore(antlr.CommonHiddenStreamToken token)
          Sets the first hidden token that appears before this node.
 void setStartColumn(int column)
          Sets the column where this node starts.
 void setStartLine(int line)
          Sets the line where this node starts.
 void setText(java.lang.String text)
          Sets the text of this node.
 void setType(int type)
          Sets the type of this node.
 boolean startsBefore(Node other)
          Determines whether this node starts before another one.
 java.lang.String toString()
          Returns a string representation of this node.
 
Methods inherited from class antlr.CommonASTWithHiddenTokens
getHiddenAfter, getHiddenBefore
 
Methods inherited from class antlr.BaseAST
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getColumn, getFirstChild, getLine, getNextSibling, getNumberOfChildren, getTokenNames, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

text

protected java.lang.String text
Node text.


nlAfter

public int nlAfter

endColumn

protected int endColumn
Column number where this node ends.


endLine

protected int endLine
Line number where this node ends.


startColumn

protected int startColumn
Column number where this node starts.


startLine

protected int startLine
Line number where this node starts.


type

protected int type
Node type.

Constructor Detail

Node

public Node()
Creates a new Node object.


Node

public Node(int type,
            java.lang.String text,
            int startLine,
            int startColumn,
            int endLine,
            int endColumn)
Creates a new Node object.

Parameters:
type - node type
text - node text.
startLine - line number where this node starts.
startColumn - column number where this node starts.
endLine - line number where this node ends.
endColumn - column number where this node ends.

Node

public Node(int startLine,
            int startColumn,
            int endLine,
            int endColumn)
Creates a new Node object.

Parameters:
startLine - line number where this node starts.
startColumn - column number where this node starts.
endLine - line number where this node ends.
endColumn - column number where this node ends.

Node

public Node(int type,
            java.lang.String text)
Creates a new Node object.

Parameters:
type - node type
text - node text.

Node

public Node(antlr.Token tok)
Creates a new Node object from the given token.

Parameters:
tok - token to initialize this node with.

Node

public Node(java.lang.String text)
Creates a new Node object.

Parameters:
text - text to add.
Method Detail

setEndColumn

public void setEndColumn(int column)
Sets the end column value.

Parameters:
column - new end column value.

getEndColumn

public int getEndColumn()
Returns the column number where this node ends.

Returns:
ending column number of this node.

setEndLine

public void setEndLine(int line)
Sets the end line value.

Parameters:
line - new end line value.

getEndLine

public int getEndLine()
Returns the line number where this node ends.

Returns:
ending line number of this node.

setHiddenAfter

public void setHiddenAfter(antlr.CommonHiddenStreamToken token)
Sets the first hidden token that appears after this node.

Parameters:
token - a hidden token.

setHiddenBefore

public void setHiddenBefore(antlr.CommonHiddenStreamToken token)
Sets the first hidden token that appears before this node.

Parameters:
token - a hidden token.

isPositionKnown

public boolean isPositionKnown()
Indicates whether this node has its location information set.

Returns:
true if this node has its location information set.

setStartColumn

public void setStartColumn(int column)
Sets the column where this node starts.

Parameters:
column - the column where this node starts.

getStartColumn

public int getStartColumn()
Returns the column number where this node starts.

Returns:
starting column number of this node.

setStartLine

public void setStartLine(int line)
Sets the line where this node starts.

Parameters:
line - the line where this node starts.

getStartLine

public int getStartLine()
Returns the line number where this node starts.

Returns:
starting line number of this node.

setText

public void setText(java.lang.String text)
Sets the text of this node.

Specified by:
setText in interface antlr.collections.AST
Overrides:
setText in class antlr.CommonAST
Parameters:
text - text to set.

getText

public java.lang.String getText()
Get the token text for this node

Specified by:
getText in interface antlr.collections.AST
Overrides:
getText in class antlr.CommonAST
Returns:
the text of this node.

setType

public void setType(int type)
Sets the type of this node.

Specified by:
setType in interface antlr.collections.AST
Overrides:
setType in class antlr.CommonAST
Parameters:
type - type to set.

getType

public int getType()
Get the token type for this node

Specified by:
getType in interface antlr.collections.AST
Overrides:
getType in class antlr.CommonAST
Returns:
the type of this node.

compareTo

public int compareTo(java.lang.Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - the Object to be compared
Returns:
a negative integer, zero, or a positive integer as this node's extent starts before, with or after the extent of the specified node.
Throws:
NullPointerException - if object == null
ClassCastException - if the specified object's type prevents it from being compared to this object.

contains

public boolean contains(Node node)
Checks whether this node contains the given node.

Parameters:
node - to check.
Returns:
true if the given node is contained in this node.

contains

public boolean contains(int aStartLine,
                        int aStartColumn,
                        int aEndLine,
                        int aEndColumn)
Checks whether this node contains the given position.

Parameters:
aStartLine - start line to check.
aStartColumn - start column to check.
aEndLine - end line to check.
aEndColumn - end column to check.
Returns:
true if the given position is contained in this span.

contains

public boolean contains(int line,
                        int column)
Checks whether this node contains the given position.

Parameters:
line - line to check.
column - column to check.
Returns:
true if the given position is contained in this span.

endsAfter

public boolean endsAfter(Node other)
Determines whether this node starts after another one.

Parameters:
other - node to check for.
Returns:
true if this node ends after the other node.

equals

public boolean equals(java.lang.Object o)
Compares the specified object with this object for equality. Returns true if and only if the specified object is also an Node and both nodes have the same text and type. So it does actually the same job as de.hunsicker.antlr.BaseAST#equals(AST).

Overrides:
equals in class java.lang.Object
Parameters:
o - the object to be compared for equality with this node.
Returns:
true if the specified object is equal to this object.

initialize

public void initialize(antlr.collections.AST node)
Initializes this node with information from the given node.

Specified by:
initialize in interface antlr.collections.AST
Overrides:
initialize in class antlr.CommonASTWithHiddenTokens
Parameters:
node - node to setup this node with.

initialize

public void initialize(int newType,
                       java.lang.String newText)
Initializes this node with the given information.

Specified by:
initialize in interface antlr.collections.AST
Overrides:
initialize in class antlr.CommonAST
Parameters:
newType - type to set.
newText - text to set.

initialize

public void initialize(antlr.Token tok)
Initializes this node with information from the given token.

Specified by:
initialize in interface antlr.collections.AST
Overrides:
initialize in class antlr.CommonASTWithHiddenTokens
Parameters:
tok - token to setup this node with.

startsBefore

public boolean startsBefore(Node other)
Determines whether this node starts before another one.

Parameters:
other - node to check for.
Returns:
true if this node starts before the other one.

toString

public java.lang.String toString()
Returns a string representation of this node.

Specified by:
toString in interface antlr.collections.AST
Overrides:
toString in class antlr.BaseAST
Returns:
a string representation of this node.

clear

public void clear()
Method to prevent references from sticking around



Copyright © 1997-2005 Jalopy. All Rights Reserved.