org.kit.furia.fragment
Class FragmentAST

java.lang.Object
  extended by antlr.BaseAST
      extended by org.kit.furia.fragment.FragmentAST
All Implemented Interfaces:
antlr.collections.AST, java.io.Serializable
Direct Known Subclasses:
MTDFragmentAST

public class FragmentAST
extends antlr.BaseAST

This class provides extra functionality required by tree edit distance algorithms and the like.

Since:
0
Author:
Arnoldo Jose Muller Molina
See Also:
Serialized Form

Field Summary
 int decendants
          Number of children this node has.
 java.lang.String text
          The text of this node.
 
Fields inherited from class antlr.BaseAST
down, right
 
Constructor Summary
FragmentAST()
          Default constructor.
FragmentAST(FragmentAST t)
          Clone the node with this constructor.
FragmentAST(int t, java.lang.String txt)
          Initialize the node.
FragmentAST(antlr.Token tok)
          Initialize the node from a token.
 
Method Summary
 java.util.List<FragmentAST> depthFirst()
           
protected  void depthFirstAux(java.util.LinkedList<FragmentAST> res)
          Auxiliary function for depthFirst().
 int getDescendants()
          Returns the number of decendants of this node.
 antlr.collections.AST getFirstChild()
          Get the first child of this node; null if not children
 FragmentAST getLeftmostChild()
          Get the leftmost child of this node.
 antlr.collections.AST getNextSibling()
          Get the next sibling in line after this one
 int getSize()
           
 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 t)
          Initialize the node from another node.
 void initialize(int t, java.lang.String txt)
          Initialize the node.
 void initialize(antlr.Token tok)
          Initialize from the given token.
 java.lang.String prettyPrint()
          Print out a child-sibling tree in LISP notation.
 void setText(java.lang.String text_)
          Set the token text for this node.
 void setType(int ttype_)
          Set the token type for this node.
 java.lang.String toFuriaChanTree()
           
 void updateDecendantInformation()
          Updates descendants information.
 int updateDecendantInformationAux()
          Updates descendants information.
 
Methods inherited from class antlr.BaseAST
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getColumn, getLine, getNumberOfChildren, getTokenNames, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toString, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

decendants

public int decendants
Number of children this node has.


text

public java.lang.String text
The text of this node.

Constructor Detail

FragmentAST

public FragmentAST()
Default constructor.


FragmentAST

public FragmentAST(int t,
                   java.lang.String txt)
Initialize the node.

Parameters:
t - Node type
txt - Node text

FragmentAST

public FragmentAST(antlr.Token tok)
Initialize the node from a token.

Parameters:
tok - The token to use as initializer.

FragmentAST

public FragmentAST(FragmentAST t)
Clone the node with this constructor.

Parameters:
t - Another SliceAST
Method Detail

updateDecendantInformationAux

public final int updateDecendantInformationAux()
Updates descendants information.

Returns:
An integer that represents the number of children of this node.

updateDecendantInformation

public final void updateDecendantInformation()
Updates descendants information.


getDescendants

public final int getDescendants()
Returns the number of decendants of this node.

Returns:
The number of children of this node.

getSize

public final int getSize()
Returns:
The size of the Tree (includes the root node)

getText

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

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

getType

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

Specified by:
getType in interface antlr.collections.AST
Overrides:
getType in class antlr.BaseAST
Returns:
The type of node

initialize

public final void initialize(int t,
                             java.lang.String txt)
Initialize the node.

Specified by:
initialize in interface antlr.collections.AST
Specified by:
initialize in class antlr.BaseAST
Parameters:
t - Node type
txt - Node tag

initialize

public final void initialize(antlr.collections.AST t)
Initialize the node from another node.

Specified by:
initialize in interface antlr.collections.AST
Specified by:
initialize in class antlr.BaseAST
Parameters:
t - Another node.

initialize

public final void initialize(antlr.Token tok)
Initialize from the given token.

Specified by:
initialize in interface antlr.collections.AST
Specified by:
initialize in class antlr.BaseAST
Parameters:
tok - A token.

setText

public final void setText(java.lang.String text_)
Set the token text for this node.

Specified by:
setText in interface antlr.collections.AST
Overrides:
setText in class antlr.BaseAST
Parameters:
text_ - The text to use.

setType

public final void setType(int ttype_)
Set the token type for this node. Currently ignored.

Specified by:
setType in interface antlr.collections.AST
Overrides:
setType in class antlr.BaseAST
Parameters:
ttype_ - Type to use

getLeftmostChild

public final FragmentAST getLeftmostChild()
Get the leftmost child of this node.

Returns:
The leftmost child of this node.

prettyPrint

public final java.lang.String prettyPrint()
Print out a child-sibling tree in LISP notation.

Returns:
A child-sibling tree in LISP notation

getFirstChild

public final antlr.collections.AST getFirstChild()
Get the first child of this node; null if not children

Specified by:
getFirstChild in interface antlr.collections.AST
Overrides:
getFirstChild in class antlr.BaseAST

getNextSibling

public final antlr.collections.AST getNextSibling()
Get the next sibling in line after this one

Specified by:
getNextSibling in interface antlr.collections.AST
Overrides:
getNextSibling in class antlr.BaseAST

depthFirst

public final java.util.List<FragmentAST> depthFirst()
Returns:
A list of the nodes in depth first order

depthFirstAux

protected final void depthFirstAux(java.util.LinkedList<FragmentAST> res)
Auxiliary function for depthFirst().

Parameters:
res - Where the result will be stored.

toFuriaChanTree

public final java.lang.String toFuriaChanTree()


Copyright © 2008 Arnoldo Jose Muller Molina. All Rights Reserved.