Class SuffixTree

java.lang.Object
  extended bySuffixTree

public final class SuffixTree
extends java.lang.Object


Field Summary
private  java.lang.String alphabet
          permitted characters in the strings
private  int noNodes
          total number of nodes in the tree
private  InternalNode root
          the root of the tree
private  ListOfTokens tokens
          the strings in the tree
 
Constructor Summary
SuffixTree(java.lang.String alphabet)
          Alphabet specifies what characters are allowed in the strings added to the suffix tree.
 
Method Summary
(package private)  int addToken(java.lang.String token)
          adds a new string to the suffix tree
(package private)  int getIndex(int position)
          Returns the index of the token that contains position.
(package private)  int getLCE(java.lang.String pattern, int pos, NodeInterface node)
          Returns the length of the Longest Common Extension (LCE), starting at position pos of the pattern, and leftIndex from the string collection.
 int getNoNodes()
          returns the total no of nodes in the tree
(package private)  InternalNode getRoot()
          returns the root of the tree
(package private)  int getStart(int indexToken)
          returns the starting index of the token at indexToken
(package private)  java.lang.String getSubstring(int leftIndex)
          returns the suffix starting at leftIndex
(package private)  java.lang.String getSubstring(int leftIndex, int length)
          returns the substring starting at leftIndex and having length length from the string collection
(package private)  int getTotalLength()
          returns the total length of the strings in the tree
(package private)  void updateNoNodes(int value)
          updates the total no of nodes in the tree, after a new string was inserted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

private InternalNode root
the root of the tree


alphabet

private java.lang.String alphabet
permitted characters in the strings


tokens

private ListOfTokens tokens
the strings in the tree


noNodes

private int noNodes
total number of nodes in the tree

Constructor Detail

SuffixTree

public SuffixTree(java.lang.String alphabet)
Alphabet specifies what characters are allowed in the strings added to the suffix tree.

Method Detail

addToken

final int addToken(java.lang.String token)
adds a new string to the suffix tree


getRoot

final InternalNode getRoot()
returns the root of the tree


getSubstring

final java.lang.String getSubstring(int leftIndex,
                                    int length)
returns the substring starting at leftIndex and having length length from the string collection


getLCE

final int getLCE(java.lang.String pattern,
                 int pos,
                 NodeInterface node)
Returns the length of the Longest Common Extension (LCE), starting at position pos of the pattern, and leftIndex from the string collection.

Returns:
the length of the longest common extension from position i of the pattern and the starting position of the label of this node.

getSubstring

final java.lang.String getSubstring(int leftIndex)
returns the suffix starting at leftIndex


getStart

final int getStart(int indexToken)
returns the starting index of the token at indexToken


getIndex

final int getIndex(int position)
Returns the index of the token that contains position.


getTotalLength

final int getTotalLength()
returns the total length of the strings in the tree


getNoNodes

public final int getNoNodes()
returns the total no of nodes in the tree


updateNoNodes

final void updateNoNodes(int value)
updates the total no of nodes in the tree, after a new string was inserted