javatools.datatypes
Class Trie

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<java.lang.CharSequence>
          extended by javatools.datatypes.Trie
All Implemented Interfaces:
java.lang.Iterable<java.lang.CharSequence>, java.util.Collection<java.lang.CharSequence>, java.util.Set<java.lang.CharSequence>

public class Trie
extends java.util.AbstractSet<java.lang.CharSequence>

This class is part of the Java Tools (see http://mpii.de/yago-naga/javatools). It is licensed under the Creative Commons Attribution License (see http://creativecommons.org/licenses/by/3.0) by the YAGO-NAGA team (see http://mpii.de/yago-naga). The class implements the Trie data type.


Constructor Summary
Trie()
          Constructs a Trie
 
Method Summary
 boolean add(java.lang.CharSequence s)
           
 void clear()
           
 int containedLength(java.lang.CharSequence s, int startPos)
          Returns the length of the longest contained subsequence, starting from start position
 boolean contains(java.lang.Object s)
           
 boolean isEmpty()
           
 PeekIterator<java.lang.CharSequence> iterator()
           
static void main(java.lang.String[] args)
          Test method
 int size()
           
 java.util.Iterator<java.lang.String> stringIterator()
           
 java.lang.Iterable<java.lang.String> strings()
           
 java.lang.String toString()
           
 PeekIterator<java.lang.CharSequence> wordsIn(java.lang.CharSequence text)
          Returns all words found
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, remove, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, remove, retainAll, toArray, toArray
 

Constructor Detail

Trie

public Trie()
Constructs a Trie

Method Detail

add

public boolean add(java.lang.CharSequence s)
Specified by:
add in interface java.util.Collection<java.lang.CharSequence>
Specified by:
add in interface java.util.Set<java.lang.CharSequence>
Overrides:
add in class java.util.AbstractCollection<java.lang.CharSequence>

clear

public void clear()
Specified by:
clear in interface java.util.Collection<java.lang.CharSequence>
Specified by:
clear in interface java.util.Set<java.lang.CharSequence>
Overrides:
clear in class java.util.AbstractCollection<java.lang.CharSequence>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<java.lang.CharSequence>
Specified by:
isEmpty in interface java.util.Set<java.lang.CharSequence>
Overrides:
isEmpty in class java.util.AbstractCollection<java.lang.CharSequence>

contains

public boolean contains(java.lang.Object s)
Specified by:
contains in interface java.util.Collection<java.lang.CharSequence>
Specified by:
contains in interface java.util.Set<java.lang.CharSequence>
Overrides:
contains in class java.util.AbstractCollection<java.lang.CharSequence>

iterator

public PeekIterator<java.lang.CharSequence> iterator()
Specified by:
iterator in interface java.lang.Iterable<java.lang.CharSequence>
Specified by:
iterator in interface java.util.Collection<java.lang.CharSequence>
Specified by:
iterator in interface java.util.Set<java.lang.CharSequence>
Specified by:
iterator in class java.util.AbstractCollection<java.lang.CharSequence>

toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractCollection<java.lang.CharSequence>

size

public int size()
Specified by:
size in interface java.util.Collection<java.lang.CharSequence>
Specified by:
size in interface java.util.Set<java.lang.CharSequence>
Specified by:
size in class java.util.AbstractCollection<java.lang.CharSequence>

containedLength

public int containedLength(java.lang.CharSequence s,
                           int startPos)
Returns the length of the longest contained subsequence, starting from start position


wordsIn

public PeekIterator<java.lang.CharSequence> wordsIn(java.lang.CharSequence text)
Returns all words found


main

public static void main(java.lang.String[] args)
Test method


stringIterator

public java.util.Iterator<java.lang.String> stringIterator()

strings

public java.lang.Iterable<java.lang.String> strings()