org.archive.util
Class PrefixSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.TreeSet<java.lang.String>
              extended by org.archive.util.PrefixSet
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.lang.String>, java.util.Collection<java.lang.String>, java.util.NavigableSet<java.lang.String>, java.util.Set<java.lang.String>, java.util.SortedSet<java.lang.String>
Direct Known Subclasses:
SurtPrefixSet

public class PrefixSet
extends java.util.TreeSet<java.lang.String>

Utility class for maintaining sorted set of string prefixes. Redundant prefixes are coalesced into the shorter prefix.

See Also:
Serialized Form

Constructor Summary
PrefixSet()
           
 
Method Summary
 boolean add(java.lang.String s)
          Maintains additional invariant: if one entry is a prefix of another, keep only the prefix.
 boolean containsPrefixOf(java.lang.String s)
          Test whether the given String is prefixed by one of this set's entries.
 
Methods inherited from class java.util.TreeSet
addAll, ceiling, clear, clone, comparator, contains, descendingIterator, descendingSet, first, floor, headSet, headSet, higher, isEmpty, iterator, last, lower, pollFirst, pollLast, remove, size, subSet, subSet, tailSet, tailSet
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
containsAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

Constructor Detail

PrefixSet

public PrefixSet()
Method Detail

containsPrefixOf

public boolean containsPrefixOf(java.lang.String s)
Test whether the given String is prefixed by one of this set's entries.

Parameters:
s -
Returns:
True if contains prefix.

add

public boolean add(java.lang.String s)
Maintains additional invariant: if one entry is a prefix of another, keep only the prefix.

Specified by:
add in interface java.util.Collection<java.lang.String>
Specified by:
add in interface java.util.Set<java.lang.String>
Overrides:
add in class java.util.TreeSet<java.lang.String>
See Also:
Collection.add(java.lang.Object)


Copyright © 2003-2011 Internet Archive. All Rights Reserved.