info.rolandkrueger.roklib.util
Class TernarySearchTreeMapCaseInsensitive<V>

java.lang.Object
  extended by info.rolandkrueger.roklib.util.TernarySearchTreeMapCaseInsensitive<V>
All Implemented Interfaces:
ITernarySearchTreeMap<V>, Map<CharSequence,V>, SortedMap<CharSequence,V>

public class TernarySearchTreeMapCaseInsensitive<V>
extends Object
implements ITernarySearchTreeMap<V>


Nested Class Summary
private  class TernarySearchTreeMapCaseInsensitive.TSTEntrySetCaseInsensitive
           
private  class TernarySearchTreeMapCaseInsensitive.TSTKeySetCaseInsensitive
           
private  class TernarySearchTreeMapCaseInsensitive.TSTSubMapCaseInsensitive
           
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
private  TernarySearchTreeMap<Map.Entry<CharSequence,V>> mData
           
private  Locale mLocale
           
private static long serialVersionUID
           
 
Constructor Summary
TernarySearchTreeMapCaseInsensitive()
           
TernarySearchTreeMapCaseInsensitive(Locale pLocale)
           
 
Method Summary
 void clear()
           
 Comparator<? super CharSequence> comparator()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object pValue)
           
 Set<Map.Entry<CharSequence,V>> entrySet()
           
 CharSequence firstKey()
           
 V get(Object key)
           
 Map.Entry<CharSequence,V> getEntry(Object key)
           
 CharSequence getKeyAt(int index)
           
 Iterable<CharSequence> getKeysForPrefix(CharSequence prefix)
           
 Iterator<Map.Entry<CharSequence,V>> getPrefixSubtreeIterator(String prefix)
           
 Iterator<Map.Entry<CharSequence,V>> getPrefixSubtreeIterator(String pPrefix, boolean inverseSearch)
           
 V getValueAt(int index)
           
 SortedMap<CharSequence,V> headMap(CharSequence toKey)
           
 int indexOf(CharSequence key)
          Returns the index of the specified key if it is stored in the map.
 boolean isEmpty()
           
 Set<CharSequence> keySet()
           
 CharSequence lastKey()
           
 SortedSet<CharSequence> matchAlmost(CharSequence key, int distance, int lengthTolerance)
          Generates an ordered list of keys that partially match the method's argument key.
 Map.Entry<CharSequence,V> predecessor(Object keyObject)
           
 V put(CharSequence key, V value)
           
 void putAll(Map<? extends CharSequence,? extends V> map)
           
 V remove(Object key)
           
 int size()
           
 SortedMap<CharSequence,V> subMap(CharSequence fromKey, CharSequence toKey)
           
 Map.Entry<CharSequence,V> successor(Object keyObject)
           
 SortedMap<CharSequence,V> tailMap(CharSequence fromKey)
           
 String toString()
           
 Collection<V> values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

mData

private TernarySearchTreeMap<Map.Entry<CharSequence,V>> mData

mLocale

private Locale mLocale
Constructor Detail

TernarySearchTreeMapCaseInsensitive

public TernarySearchTreeMapCaseInsensitive()

TernarySearchTreeMapCaseInsensitive

public TernarySearchTreeMapCaseInsensitive(Locale pLocale)
Method Detail

matchAlmost

public SortedSet<CharSequence> matchAlmost(CharSequence key,
                                           int distance,
                                           int lengthTolerance)
Description copied from interface: ITernarySearchTreeMap
Generates an ordered list of keys that partially match the method's argument key. This can be useful for spell checking or the like. The method's framework and its underlying algorithm is adopted from the above mentioned article on Javaworld by Wally Flint.

Specified by:
matchAlmost in interface ITernarySearchTreeMap<V>
Parameters:
key - The key's toString() method is used to generate a string representation of that key in order to find a set of partially matching keys differing only by a number of distance characters.
distance - The number of maximum characters that may be different from the characters of key.
lengthTolerance - specifies by how many characters the length of the resulting set's strings may differ from the length of the search key.

getEntry

public Map.Entry<CharSequence,V> getEntry(Object key)
Specified by:
getEntry in interface ITernarySearchTreeMap<V>

getValueAt

public V getValueAt(int index)
Specified by:
getValueAt in interface ITernarySearchTreeMap<V>

getKeyAt

public CharSequence getKeyAt(int index)
Specified by:
getKeyAt in interface ITernarySearchTreeMap<V>

indexOf

public int indexOf(CharSequence key)
Description copied from interface: ITernarySearchTreeMap
Returns the index of the specified key if it is stored in the map. Otherwise -1 is returned. The indexing is the same as with arrays, i.e. the first element in the map has index 0 and the last element has index size()-1.

Specified by:
indexOf in interface ITernarySearchTreeMap<V>
Parameters:
key - The key whose index is to be returned.
Returns:
int the key's index or -1 if the key isn't an element of the map.

getKeysForPrefix

public Iterable<CharSequence> getKeysForPrefix(CharSequence prefix)
Specified by:
getKeysForPrefix in interface ITernarySearchTreeMap<V>

getPrefixSubtreeIterator

public Iterator<Map.Entry<CharSequence,V>> getPrefixSubtreeIterator(String prefix)
Specified by:
getPrefixSubtreeIterator in interface ITernarySearchTreeMap<V>

getPrefixSubtreeIterator

public Iterator<Map.Entry<CharSequence,V>> getPrefixSubtreeIterator(String pPrefix,
                                                                    boolean inverseSearch)
Specified by:
getPrefixSubtreeIterator in interface ITernarySearchTreeMap<V>

predecessor

public Map.Entry<CharSequence,V> predecessor(Object keyObject)
Specified by:
predecessor in interface ITernarySearchTreeMap<V>

successor

public Map.Entry<CharSequence,V> successor(Object keyObject)
Specified by:
successor in interface ITernarySearchTreeMap<V>

size

public int size()
Specified by:
size in interface Map<CharSequence,V>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<CharSequence,V>

toString

public String toString()
Overrides:
toString in class Object

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<CharSequence,V>

containsValue

public boolean containsValue(Object pValue)
Specified by:
containsValue in interface Map<CharSequence,V>

get

public V get(Object key)
Specified by:
get in interface Map<CharSequence,V>

put

public V put(CharSequence key,
             V value)
Specified by:
put in interface Map<CharSequence,V>

remove

public V remove(Object key)
Specified by:
remove in interface Map<CharSequence,V>

putAll

public void putAll(Map<? extends CharSequence,? extends V> map)
Specified by:
putAll in interface Map<CharSequence,V>

clear

public void clear()
Specified by:
clear in interface Map<CharSequence,V>

comparator

public Comparator<? super CharSequence> comparator()
Specified by:
comparator in interface SortedMap<CharSequence,V>

subMap

public SortedMap<CharSequence,V> subMap(CharSequence fromKey,
                                        CharSequence toKey)
Specified by:
subMap in interface SortedMap<CharSequence,V>

headMap

public SortedMap<CharSequence,V> headMap(CharSequence toKey)
Specified by:
headMap in interface SortedMap<CharSequence,V>

tailMap

public SortedMap<CharSequence,V> tailMap(CharSequence fromKey)
Specified by:
tailMap in interface SortedMap<CharSequence,V>

firstKey

public CharSequence firstKey()
Specified by:
firstKey in interface SortedMap<CharSequence,V>

lastKey

public CharSequence lastKey()
Specified by:
lastKey in interface SortedMap<CharSequence,V>

keySet

public Set<CharSequence> keySet()
Specified by:
keySet in interface Map<CharSequence,V>
Specified by:
keySet in interface SortedMap<CharSequence,V>

values

public Collection<V> values()
Specified by:
values in interface Map<CharSequence,V>
Specified by:
values in interface SortedMap<CharSequence,V>

entrySet

public Set<Map.Entry<CharSequence,V>> entrySet()
Specified by:
entrySet in interface Map<CharSequence,V>
Specified by:
entrySet in interface SortedMap<CharSequence,V>


Copyright © 2007-2011. All Rights Reserved.