|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
PATRICIA trie (Practical Algorithm To Retrieve Information Coded In Alphanumeric).
Tries are a kind of tree where each node holds a common part of one or more keys.
PATRICIA trie is one of the many existing variants of the trie, which adds path compression
by grouping common sequences of nodes together.
This structure provides a very efficient way of storing values while maintaining the lookup time
for a key in O(N) in the worst case, where N is the length of the longest key.
This structure has it's main use in IP routing software, but can provide an interesting alternative
to other structures such as hashtables when memory space is of concern.
| Method Summary | |
IPersistent |
add(PatriciaTrieKey key,
IPersistent obj)
Add new key to the trie |
void |
clear()
Clear the trie: remove all elements from trie |
java.util.ArrayList |
elements()
Get all objects in the trie. |
IPersistent |
findBestMatch(PatriciaTrieKey key)
Find best match with specified key |
IPersistent |
findExactMatch(PatriciaTrieKey key)
Find exact match with specified key |
java.util.Iterator |
iterator()
Get iterator through all trie members. |
IPersistent |
remove(PatriciaTrieKey key)
Removes key from the triesKFind exact match with specified key |
IPersistent[] |
toArray()
Get array of all members of the trie |
IPersistent[] |
toArray(IPersistent[] arr)
Get all objects in the trie. |
| Methods inherited from interface org.garret.perst.IPersistent |
assignOid, deallocate, getOid, getStorage, invalidate, isDeleted, isModified, isPersistent, isRaw, load, loadAndModify, makePersistent, modify, onLoad, onStore, recursiveLoading, store |
| Methods inherited from interface java.io.Externalizable |
readExternal, writeExternal |
| Methods inherited from interface org.garret.perst.IResource |
exclusiveLock, exclusiveLock, reset, sharedLock, sharedLock, unlock |
| Methods inherited from interface org.garret.perst.ITable |
select, size |
| Method Detail |
public IPersistent add(PatriciaTrieKey key,
IPersistent obj)
key - bit vectorobj - persistent object associated with this key
null if there
was no such objectpublic void clear()
public java.util.ArrayList elements()
public IPersistent findBestMatch(PatriciaTrieKey key)
key - bit vector
public IPersistent findExactMatch(PatriciaTrieKey key)
key - bit vector
public java.util.Iterator iterator()
iterator in interface ITablepublic IPersistent remove(PatriciaTrieKey key)
key - bit vector
null if such key is not foundpublic IPersistent[] toArray()
public IPersistent[] toArray(IPersistent[] arr)
If this index fits in the specified array with room to spare (i.e., the array has more elements than this index), the element in the array immediately following the end of the index is set to null. This is useful in determining the length of this index only if the caller knows that this index does not contain any null elements.)
arr - specified array
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||