Package crawlercommons.domains
Class SuffixTrie<V>
- java.lang.Object
- 
- crawlercommons.domains.SuffixTrie<V>
 
- 
 public class SuffixTrie<V> extends Object 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classSuffixTrie.LookupResult<V>Wrapper for results when a string is checked for suffixes contained in the suffix trie.protected static classSuffixTrie.Node<V>
 - 
Field SummaryFields Modifier and Type Field Description protected SuffixTrie.Node<V>root
 - 
Constructor SummaryConstructors Constructor Description SuffixTrie()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(String suffix)Checks whether trie contains a suffix string.Vget(String suffix)Get value associated with suffix string in trie.protected SuffixTrie.LookupResult<V>getLongestSuffix(String string)Match the longest suffix of a string contained in trie.protected List<SuffixTrie.LookupResult<V>>getSuffixes(String string)Match all suffixes of a string contained in trie.Vput(String suffix, V value)Insert a string and an associated value into the trie.
 
- 
- 
- 
Field Detail- 
rootprotected SuffixTrie.Node<V> root 
 
- 
 - 
Method Detail- 
putpublic V put(String suffix, V value) Insert a string and an associated value into the trie. If the string is already present in the trie, the existing value is replaced by the new value.- Parameters:
- suffix- suffix string inserted into trie
- value- value associated with string
- Returns:
- previous value associated with string or null if there was no previous value
 
 - 
getpublic V get(String suffix) Get value associated with suffix string in trie.- Parameters:
- suffix- suffix string searched in trie
- Returns:
- value if suffix is found in trie, null otherwise
 
 - 
containspublic boolean contains(String suffix) Checks whether trie contains a suffix string.- Parameters:
- suffix- suffix string searched in trie
- Returns:
- true if suffix is found in trie
 
 - 
getLongestSuffixprotected SuffixTrie.LookupResult<V> getLongestSuffix(String string) Match the longest suffix of a string contained in trie.- Parameters:
- string- to be checked for a contained (longest) suffix
- Returns:
- lookup result or null if no suffix is found
 
 - 
getSuffixesprotected List<SuffixTrie.LookupResult<V>> getSuffixes(String string) Match all suffixes of a string contained in trie.- Parameters:
- string- string to be checked for suffixes contained in trie
- Returns:
- list of suffix lookup results, from shortest to longest
 
 
- 
 
-