ValueType
- The type of the values, which are stored by the triepublic class HashStringTrie<ValueType> +extends StringTrieWrapper<ValueType>+
HashTrie
for using character sequences as keys. This trie implementation has
+ the same properties as a HashTrie
. It should be preferred when using character sequences,
+ because it offers a less complex API.java.util.Map.Entry<K,V>
trie
Constructor and Description | +
---|
HashStringTrie()
+Creates a new empty, unsorted trie for storing character sequences, which uses hash maps for
+ storing the successors of nodes.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+toString() |
+
subTrie
clear, containsKey, containsValue, entrySet, equals, get, getRootNode, hashCode, isEmpty, keySet, put, putAll, remove, size, values
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getRootNode
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
SequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic class HashTrie<SequenceType extends Sequence,ValueType> +extends AbstractTrie<Structure<SequenceType,ValueType>,SequenceType,ValueType>+
SortedListTrie
, if the order of keys is
+ irrelevant.AbstractTrie.AbstractKeySet<K extends Sequence,MapType extends java.util.Map<K,?>>, AbstractTrie.KeySet<K extends Sequence>
java.util.Map.Entry<K,V>
rootNode, structure
Constructor and Description | +
---|
HashTrie()
+Creates a new empty, unsorted trie, which stores the successors of nodes in hash maps.
+ |
+
HashTrie(@NotNull java.util.Map<SequenceType,ValueType> map)
+Creates a new unsorted trie, which contains all key-value pairs that are contained by a map.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
protected @NotNull Node<SequenceType,ValueType> |
+createRootNode()
+The method, which is invoked on subclasses in order to create the trie's root node.
+ |
+
protected @NotNull Structure<SequenceType,ValueType> |
+createStructure()
+The method, which is invoked on subclasses in order to create the implementation of the
+ interface
+Structure , which defines the structure of the trie. |
+
@NotNull HashTrie<SequenceType,ValueType> |
+subTrie(SequenceType sequence)
+Returns the subtree of the node, which corresponds to a specific sequence (must not
+ necessarily be a key, which is contained by the trie, but can also be a suffix).
+ |
+
java.lang.String |
+toString() |
+
clear, containsKey, containsValue, entrySet, equals, get, getNode, getRootNode, hashCode, isEmpty, keySet, put, putAll, remove, size, values
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public HashTrie()+
public HashTrie(@NotNull + @NotNull java.util.Map<SequenceType,ValueType> map)+
map
- The map, which contains the key-value pairs that should be added to the trie, as
+ an instance of the type Map
. The map may not be null@NotNull +protected final @NotNull Node<SequenceType,ValueType> createRootNode()+
AbstractTrie
createRootNode
in class AbstractTrie<Structure<SequenceType extends Sequence,ValueType>,SequenceType extends Sequence,ValueType>
Node
. The
+ root node may not be null@NotNull +protected final @NotNull Structure<SequenceType,ValueType> createStructure()+
AbstractTrie
Structure
, which defines the structure of the trie.createStructure
in class AbstractTrie<Structure<SequenceType extends Sequence,ValueType>,SequenceType extends Sequence,ValueType>
Structure
as an instance of the generic
+ type StructureType
. The implementation may not be null@NotNull +public @NotNull HashTrie<SequenceType,ValueType> subTrie(@Nullable + SequenceType sequence)+
Trie
NoSuchElementException
will be thrown.
+ + The nodes of the returned trie are deep copies of those of the original trie. Therefore the + returned trie is fully functional and can be modified without affecting the original trie.
sequence
- The sequence as an instance of the generic type SequenceType
Trie
. The subtree may not be nullpublic final java.lang.String toString()+
toString
in class java.lang.Object
KeyType
- The type of the keys, which are associated with the node's successorsValueType
- The type of the node's valuepublic interface Node<KeyType,ValueType>
+extends java.lang.Iterable<KeyType>, java.io.Serializable, java.lang.Cloneable
+Iterable
+ to be able to iterate the keys, which correspond to the node's successors.
+
+ If the successors of the node are sorted, sublasses must implement the interface RandomAccess
.
Modifier and Type | +Method and Description | +
---|---|
default @NotNull Node<KeyType,ValueType> |
+addSuccessor(KeyType key)
+Creates a new successor and adds it to the node.
+ |
+
@NotNull Node<KeyType,ValueType> |
+addSuccessor(KeyType key,
+ @Nullable Node<KeyType,ValueType> successor)
+Adds a specific successor to the node.
+ |
+
Node<KeyType,ValueType> |
+clone()
+Creates and returns a deep copy of the node and its successors.
+ |
+
void |
+decreaseSuccessorValueCount(int by)
+Decreases the number of successors for which values are set by a specific amount.
+ |
+
default @Nullable Node<KeyType,ValueType> |
+getFirstSuccessor()
+Returns the first successor.
+ |
+
default KeyType |
+getFirstSuccessorKey()
+Returns the key, which corresponds to the first successor.
+ |
+
default @Nullable Node<KeyType,ValueType> |
+getLastSuccessor()
+Returns the last successor.
+ |
+
default KeyType |
+getLastSuccessorKey()
+Returns the key, which corresponds to the last successor.
+ |
+
@Nullable NodeValue<ValueType> |
+getNodeValue()
+Returns the value of the node.
+ |
+
java.util.Map.Entry<KeyType,Node<KeyType,ValueType>> |
+getPredecessor()
+Returns the predecessor of the node.
+ |
+
default @NotNull Node<KeyType,ValueType> |
+getSuccessor(int index)
+Returns the successor at a specific index.
+ |
+
@Nullable Node<KeyType,ValueType> |
+getSuccessor(KeyType key)
+Returns the successor of the node, which corresponds to a specific key.
+ |
+
int |
+getSuccessorCount()
+Returns the number of the node's successors.
+ |
+
default KeyType |
+getSuccessorKey(int index)
+Returns the key, which corresponds to the successor at a specific index.
+ |
+
int |
+getSuccessorValueCount()
+Returns the number of successors for which values are set, i.e.
+ |
+
default ValueType |
+getValue()
+Returns the unboxed value of the node, i.e.
+ |
+
default boolean |
+hasSuccessors()
+Returns, whether the node has successors, or not.
+ |
+
void |
+increaseSuccessorValueCount(int by)
+Increases the number of successors for which values are set by a specific amount.
+ |
+
default int |
+indexOf(KeyType key)
+Returns the index of the successor, which corresponds to a specific key.
+ |
+
default int |
+indexOfFirstElement(KeyType key)
+Returns the index of the successor, whose key starts with the first element of another key.
+ |
+
default boolean |
+isValueSet()
+Returns, whether a value is set for the node, or not.
+ |
+
default void |
+removeSuccessor(int index)
+Removes the successor at a specific index.
+ |
+
void |
+removeSuccessor(KeyType key)
+Removes the successor, which corresponds to a specific key.
+ |
+
@Nullable NodeValue<ValueType> |
+setNodeValue(@Nullable NodeValue<ValueType> nodeValue)
+Sets the value of the node.
+ |
+
void |
+setPredecessor(java.util.Map.Entry<KeyType,Node<KeyType,ValueType>> predecessor)
+Sets the predecessor of the node.
+ |
+
forEach, iterator, spliterator
@Nullable +@Nullable NodeValue<ValueType> getNodeValue()+
NodeValue
wrapper or null, if the
+ node does not correspond to a key, which has been put into the trie@Nullable +@Nullable NodeValue<ValueType> setNodeValue(@Nullable + @Nullable NodeValue<ValueType> nodeValue)+
nodeValue
- A wrapper, which encapsulates the value, which should be set, as an instance
+ of the class NodeValue
or null, if the node does not correspond to a
+ key, which has been put into the trieNodeValue
or null,
+ if no value was setdefault ValueType getValue()+
getNodeValue()
returns null, or
+ the encapsulated value of the returned NodeValue
otherwise.ValueType
default boolean isValueSet()+
int getSuccessorCount()+
Integer
valuedefault boolean hasSuccessors()+
@Nullable +@Nullable Node<KeyType,ValueType> getSuccessor(@NotNull + KeyType key)+
key
- The key of the successor, which should be returned, as an instance of the generic
+ type KeyType
. The key may not be nullNode
or null, if no successor corresponds to the given key@NotNull +default @NotNull Node<KeyType,ValueType> addSuccessor(@NotNull + KeyType key)+
key
- The key, which corresponds to the successor to be created, as an instance of the
+ generic type KeyType
. The key may not be nullNode
. The
+ successor may not be null@NotNull +@NotNull Node<KeyType,ValueType> addSuccessor(@NotNull + KeyType key, + @Nullable + @Nullable Node<KeyType,ValueType> successor)+
key
- The key, which corresponds to the successor to be created, as an instance of
+ the generic type KeyType
. The key may not be nullsuccessor
- The successor, which should be added, as an instance of the type Node
or null, if the successor should be createdNode
. The
+ successor may not be nullvoid removeSuccessor(@NotNull + KeyType key)+
key
- The key, which corresponds to the successor, which should be removed, as an
+ instance of the generic type KeyType
. The key may not be nulldefault void removeSuccessor(int index)+
IndexOutOfBoundsException
is thrown. If the node's successors are not sorted, an UnsupportedOperationException
is thrown.index
- The index of the successor, which should be removed, as an Integer
+ valueint getSuccessorValueCount()+
isValueSet()
returns
+ true
. All successors of the node are taken into account recursively down to the
+ leaf nodes.Integer
value@NotNull +default KeyType getSuccessorKey(int index)+
IndexOutOfBoundsException
is thrown. If the node's successor or are not
+ sorted, an UnsupportedOperationException
is thrown.index
- The index of the key, which should be returned, as an Integer
valueKeyType
. The key may not be null@Nullable +default KeyType getFirstSuccessorKey()+
UnsupportedOperationException
is thrown.KeyType
or
+ null, if the node does not have any successors@Nullable +default KeyType getLastSuccessorKey()+
UnsupportedOperationException
is thrown.KeyType
or
+ null, if the node does not have any successors@NotNull +default @NotNull Node<KeyType,ValueType> getSuccessor(int index)+
IndexOutOfBoundsException
is thrown. If the node's successors are not sorted, an UnsupportedOperationException
is thrown.index
- The index of the successor, which which should be returned, as an Integer
valueNode
. The
+ successor may not be null@Nullable +default @Nullable Node<KeyType,ValueType> getFirstSuccessor()+
UnsupportedOperationException
is thrown.Node
or null, if the node does
+ not have any successors@Nullable +default @Nullable Node<KeyType,ValueType> getLastSuccessor()+
UnsupportedOperationException
is thrown.Node
or null, if the node does
+ not have any successorsdefault int indexOf(@NotNull + KeyType key)+
UnsupportedOperationException
is thrown.key
- The key of the successor, whose index should be returned, as an instance of the
+ type KeyType
. The key may not be nullInteger
+ value or -1, if no such successor is availabledefault int indexOfFirstElement(@NotNull + KeyType key)+
UnsupportedOperationException
is thrown.key
- The key, whose first element should be searched, as an instance of the generic
+ type KeyType
. The key may not be nullInteger
value or -1, if no such successor is availablevoid increaseSuccessorValueCount(int by)+
by
- The amount, the number of successor should be increased by, as an Integer
+ value. The amount must be at least 0void decreaseSuccessorValueCount(int by)+
by
- The amount, the number of successor should be decreased by, as an Integer
+ value. The amount must be at least 0@Nullable +java.util.Map.Entry<KeyType,Node<KeyType,ValueType>> getPredecessor()+
Map.Entry
or null, if
+ no predecessor is setvoid setPredecessor(@Nullable + java.util.Map.Entry<KeyType,Node<KeyType,ValueType>> predecessor)+
predecessor
- An entry, which contains the predecessor, which should be set, as well as
+ the key this node is referenced by in the predecessor, as an instance of
+ the type Map.Entry
or null, if no predecessor should be setT
- The type of the valuepublic class NodeValue<T>
+extends java.lang.Object
+implements java.io.Serializable, java.lang.Cloneable
+null
and those that do not correspond to
+ a key.Constructor and Description | +
---|
NodeValue(T value)
+Creates a new wrapper, which encapsulates the value of a trie's node.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
NodeValue<T> |
+clone() |
+
boolean |
+equals(java.lang.Object obj) |
+
T |
+getValue()
+Returns the encapsulated value.
+ |
+
int |
+hashCode() |
+
java.lang.String |
+toString() |
+
finalize, getClass, notify, notifyAll, wait, wait, wait
public NodeValue(@Nullable + T value)+
value
- The encapsulated value as an instance of the generic type T
or null, if
+ the encapsulated value is null@Nullable +public T getValue()+
T
or null, if the
+ encapsulated value is nullpublic final java.lang.String toString()+
toString
in class java.lang.Object
public final int hashCode()+
hashCode
in class java.lang.Object
public final boolean equals(java.lang.Object obj)+
equals
in class java.lang.Object
ValueType
- The type of the values, which are stored by the triepublic class PatriciaStringTrie<ValueType> +extends SortedStringTrieWrapper<ValueType>+
PatriciaTrie
for using character sequences as keys. In contrast to a SortedListStringTrie
, the edges between nodes do not always correspond to a single element of a
+ sequence. Instead, subsequent nodes that only have a single successor are merged to a single node
+ to reduce space complexity. This trie implementation has the same properties as a PatriciaTrie
. It should be preferred when using character sequences, because it offers a less
+ complex API.SortedStringTrieWrapper.StringSequenceComparatorWrapper
java.util.Map.Entry<K,V>
trie
Constructor and Description | +
---|
PatriciaStringTrie()
+Creates a new empty, sorted trie for storing character sequences, which uses sorted lists for
+ storing the successors of nodes.
+ |
+
PatriciaStringTrie(@Nullable java.util.Comparator<? super java.lang.String> comparator)
+Creates a new empty, sorted trie for storing character sequences, which uses sorted lists for
+ storing the successors of nodes.
+ |
+
PatriciaStringTrie(@Nullable java.util.Comparator<? super java.lang.String> comparator,
+ @NotNull java.util.Map<java.lang.String,ValueType> map)
+Creates a new sorted trie for storing character sequences, which uses sorted lists for
+ storing the successors of nodes and contains all key-value pairs that are contained by a map.
+ |
+
PatriciaStringTrie(@NotNull java.util.Map<java.lang.String,ValueType> map)
+Creates a new sorted trie for storing character sequences, which uses sorted lists for
+ storing the successors of nodes and contains all key-value pairs that are contained by a map.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+toString() |
+
ceilingEntry, ceilingKey, comparator, descendingKeySet, descendingMap, firstEntry, firstKey, floorEntry, floorKey, headMap, headMap, higherEntry, higherKey, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, subMap, subMap, subTrie, tailMap, tailMap
clear, containsKey, containsValue, entrySet, equals, get, getRootNode, hashCode, isEmpty, keySet, put, putAll, remove, size, values
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
entrySet, keySet, values
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
getRootNode
public PatriciaStringTrie()+
public PatriciaStringTrie(@Nullable + @Nullable java.util.Comparator<? super java.lang.String> comparator)+
comparator
- The comparator, which should be used to compare keys with each other, as an
+ instance of the type Comparator
or null, if the natural ordering of
+ the keys should be usedpublic PatriciaStringTrie(@NotNull + @NotNull java.util.Map<java.lang.String,ValueType> map)+
map
- The map, which contains the key-value pairs that should be added to the trie, as
+ an instance of the type Map
. The map may not be nullpublic PatriciaStringTrie(@Nullable + @Nullable java.util.Comparator<? super java.lang.String> comparator, + @NotNull + @NotNull java.util.Map<java.lang.String,ValueType> map)+
comparator
- The comparator, which should be used to compare keys with each other, as an
+ instance of the type Comparator
or null, if the natural ordering of
+ the keys should be usedmap
- The map, which contains the key-value pairs that should be added to the
+ trie, as an instance of the type Map
. The map may not be nullSequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic class PatriciaTrie<SequenceType extends Sequence,ValueType> +extends AbstractSortedTrie<SequenceType,ValueType>+
SortedListTrie
, the edges between nodes do not always correspond to a single element of a
+ sequence. Instead, subsequent nodes that only have a single successor are merged to a single node
+ to reduce space complexity. This requires to reorganize the tree structure when inserting new
+ elements. Consequently, this trie should be preferred over the a SortedListTrie
, if new
+ elements are only inserted sporadically and minimizing memory consumption is important.AbstractTrie.AbstractKeySet<K extends Sequence,MapType extends java.util.Map<K,?>>, AbstractTrie.KeySet<K extends Sequence>
java.util.Map.Entry<K,V>
comparator
rootNode, structure
Modifier | +Constructor and Description | +
---|---|
|
+PatriciaTrie()
+Creates a new, empty Patricia trie.
+ |
+
|
+PatriciaTrie(@Nullable java.util.Comparator<? super SequenceType> comparator)
+Creates a new, empty Patricia trie.
+ |
+
|
+PatriciaTrie(@Nullable java.util.Comparator<? super SequenceType> comparator,
+ @NotNull java.util.Map<SequenceType,ValueType> map)
+Creates a new Patrica trie, which contains all key-value pairs that are contained by a map.
+ |
+
|
+PatriciaTrie(@NotNull java.util.Map<SequenceType,ValueType> map)
+Creates a new Patricia trie, which contains all key-value pairs that are contained by a map.
+ |
+
protected |
+PatriciaTrie(@Nullable Node<SequenceType,ValueType> rootNode,
+ @Nullable java.util.Comparator<? super SequenceType> comparator)
+Creates a new Patricia trie.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
protected @NotNull Node<SequenceType,ValueType> |
+createRootNode()
+The method, which is invoked on subclasses in order to create the trie's root node.
+ |
+
protected @NotNull SortedStructure<SequenceType,ValueType> |
+createStructure()
+The method, which is invoked on subclasses in order to create the implementation of the
+ interface
+Structure , which defines the structure of the trie. |
+
@NotNull SortedTrie<SequenceType,ValueType> |
+subTrie(SequenceType sequence)
+
+ |
+
java.lang.String |
+toString() |
+
ceilingEntry, ceilingKey, comparator, descendingKeySet, descendingMap, firstEntry, firstKey, floorEntry, floorKey, headMap, headMap, higherEntry, higherKey, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, subMap, subMap, tailMap, tailMap
clear, containsKey, containsValue, entrySet, equals, get, getNode, getRootNode, hashCode, isEmpty, keySet, put, putAll, remove, size, values
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
entrySet, keySet, values
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
getRootNode
protected PatriciaTrie(@Nullable + @Nullable Node<SequenceType,ValueType> rootNode, + @Nullable + @Nullable java.util.Comparator<? super SequenceType> comparator)+
rootNode
- The root node of the trie as an instance of the type Node
or null,
+ if the trie should be emptycomparator
- The comparator, which should be used to compare keys with each other, as an
+ instance of the type Comparator
or null, if the natural ordering of
+ the keys should be usedpublic PatriciaTrie()+
public PatriciaTrie(@NotNull + @NotNull java.util.Map<SequenceType,ValueType> map)+
map
- The map, which contains the key-value pairs that should be added to the trie, as
+ an instance of the type Map
. The map may not be nullpublic PatriciaTrie(@Nullable + @Nullable java.util.Comparator<? super SequenceType> comparator)+
comparator
- The comparator, which should be used to compare keys with each other, as an
+ instance of the type Comparator
or null, if the natural ordering of
+ the keys should be usedpublic PatriciaTrie(@Nullable + @Nullable java.util.Comparator<? super SequenceType> comparator, + @NotNull + @NotNull java.util.Map<SequenceType,ValueType> map)+
comparator
- The comparator, which should be used to compare keys with each other, as an
+ instance of the type Comparator
or null, if the natural ordering of
+ the keys should be usedmap
- The map, which contains the key-value pairs that should be added to the
+ trie, as an instance of the type Map
. The map may not be null@NotNull +protected final @NotNull Node<SequenceType,ValueType> createRootNode()+
AbstractTrie
createRootNode
in class AbstractTrie<SortedStructure<SequenceType extends Sequence,ValueType>,SequenceType extends Sequence,ValueType>
Node
. The
+ root node may not be null@NotNull +protected final @NotNull SortedStructure<SequenceType,ValueType> createStructure()+
AbstractTrie
Structure
, which defines the structure of the trie.createStructure
in class AbstractTrie<SortedStructure<SequenceType extends Sequence,ValueType>,SequenceType extends Sequence,ValueType>
Structure
as an instance of the generic
+ type StructureType
. The implementation may not be null@NotNull +public final @NotNull SortedTrie<SequenceType,ValueType> subTrie(@Nullable + SequenceType sequence)+
SortedTrie
sequence
- The sequence as an instance of the generic type SequenceType
Trie
. The subtree may not be nullpublic final java.lang.String toString()+
toString
in class java.lang.Object
public interface Sequence
+extends java.io.Serializable
+Trie
or SortedTrie
must implement. A sequence is a ordered list of elements, e.g. characters, numbers or
+ symbols.
+
+ Implementations of this class must be immutable, i.e. the concat(Sequence)
and subsequence(int, int)
methods must return a new object instead of modifying the original one.
+ Furthermore, the Object.hashCode()
and Object.equals(Object)
methods must be
+ overridden by implementing classes. If an implementation of this interface should be used
+ together with a SortedTrie
, without requiring to pass a Comparator
to
+ the trie, the sequence must also implement the interface Comparable
.
Modifier and Type | +Method and Description | +
---|---|
Sequence |
+concat(@NotNull Sequence sequence)
+Concatenates this sequence with another one.
+ |
+
default boolean |
+isEmpty()
+Returns, whether the sequence is empty, i.e.
+ |
+
int |
+length()
+Returns the length of the sequence.
+ |
+
default Sequence |
+subsequence(int start)
+Returns a new sequence, which is a subsequence of this sequence, starting at a specific index
+ and spanning to the end.
+ |
+
Sequence |
+subsequence(int start,
+ int end)
+Returns a new sequence, which is a subsequence of this sequence.
+ |
+
default Sequence subsequence(int start)+
start
- Specifies the index of the first element to be included (inclusive) as an Integer
value. If the index is invalid, an IndexOutOfBoundsException
+ may be thrownSequence
. The returned sequence must be a new immutable object
+ and its class must be the same as the class of the original sequenceSequence subsequence(int start, + int end)+
start
- Specifies the index of the first element to be included (inclusive) as an Integer
value. If the index is invalid, an IndexOutOfBoundsException
+ may be thrownend
- Specifies the index of the last element to be included (exclusive) as an Integer
value. If the index is invalid, an IndexOutOfBoundsException
+ may be thrownSequence
. The returned sequence must be a new immutable object
+ and its class must be the same as the class of the original sequenceSequence concat(@NotNull + @NotNull Sequence sequence)+
sequence
- The sequence, which should be appended to this sequence as a suffix, as an
+ instance of the type Sequence
. If the given sequence's class is
+ different from this classes' one, a ClassCastException
may be thrownSequence
. The returned sequence must be a new
+ immutable object and its class must be the same as the class of the original sequencedefault boolean isEmpty()+
int length()+
Integer
value. The length must be at least 0ValueType
- The type of the values, which are stored by the triepublic class SortedListStringTrie<ValueType> +extends SortedStringTrieWrapper<ValueType>+
SortedListTrie
for using character sequences as keys. This trie implementation has
+ the same properties as a SortedListTrie
. It should be preferred when using character
+ sequences, because it offers a less complex API.SortedStringTrieWrapper.StringSequenceComparatorWrapper
java.util.Map.Entry<K,V>
trie
Constructor and Description | +
---|
SortedListStringTrie()
+Creates a new empty, sorted trie for storing character sequences, which uses sorted lists for
+ storing the successors of nodes.
+ |
+
SortedListStringTrie(@Nullable java.util.Comparator<? super java.lang.String> comparator)
+Creates a new empty, sorted trie for storing character sequences, which uses sorted lists for
+ storing the successors of nodes.
+ |
+
SortedListStringTrie(@Nullable java.util.Comparator<? super java.lang.String> comparator,
+ @NotNull java.util.Map<java.lang.String,ValueType> map)
+Creates a new sorted trie for storing character sequences, which uses sorted lists for
+ storing the successors of nodes and contains all key-value pairs that are contained by a
+ map.
+ |
+
SortedListStringTrie(@NotNull java.util.Map<java.lang.String,ValueType> map)
+Creates a new sorted trie for storing character sequences, which uses sorted lists for
+ storing the successors of nodes and contains all key-value pairs that are contained by a map.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+toString() |
+
ceilingEntry, ceilingKey, comparator, descendingKeySet, descendingMap, firstEntry, firstKey, floorEntry, floorKey, headMap, headMap, higherEntry, higherKey, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, subMap, subMap, subTrie, tailMap, tailMap
clear, containsKey, containsValue, entrySet, equals, get, getRootNode, hashCode, isEmpty, keySet, put, putAll, remove, size, values
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
entrySet, keySet, values
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
getRootNode
public SortedListStringTrie()+
public SortedListStringTrie(@Nullable + @Nullable java.util.Comparator<? super java.lang.String> comparator)+
comparator
- The comparator, which should be used to compare keys with each other, as an
+ instance of the type Comparator
or null, if the natural ordering of
+ the keys should be usedpublic SortedListStringTrie(@NotNull + @NotNull java.util.Map<java.lang.String,ValueType> map)+
map
- The map, which contains the key-value pairs that should be added to the trie, as
+ an instance of the type Map
. The map may not be nullpublic SortedListStringTrie(@Nullable + @Nullable java.util.Comparator<? super java.lang.String> comparator, + @NotNull + @NotNull java.util.Map<java.lang.String,ValueType> map)+
comparator
- The comparator, which should be used to compare keys with each other, as an
+ instance of the type Comparator
or null, if the natural ordering of
+ the keys should be usedmap
- The map, which contains the key-value pairs that should be added to the
+ trie, as an instance of the type Map
. The map may not be nullSequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic class SortedListTrie<SequenceType extends Sequence,ValueType> +extends AbstractSortedTrie<SequenceType,ValueType>+
HashTrie
, this trie
+ implementation should be preferred, if the order of keys is relevant.AbstractTrie.AbstractKeySet<K extends Sequence,MapType extends java.util.Map<K,?>>, AbstractTrie.KeySet<K extends Sequence>
java.util.Map.Entry<K,V>
comparator
rootNode, structure
Constructor and Description | +
---|
SortedListTrie()
+Creates a new empty, sorted trie, which stores the successors of nodes in sorted lists.
+ |
+
SortedListTrie(@Nullable java.util.Comparator<? super SequenceType> comparator)
+Creates a new empty, sorted trie, which stores the successors of nodes in sorted lists.
+ |
+
SortedListTrie(@Nullable java.util.Comparator<? super SequenceType> comparator,
+ @NotNull java.util.Map<SequenceType,ValueType> map)
+Creates a new sorted trie, which stores the successors of nodes in sorted lists and contains
+ all key-value pairs that are contained by a map.
+ |
+
SortedListTrie(@NotNull java.util.Map<SequenceType,ValueType> map)
+Creates a new sorted trie, which stores the successors of nodes in sorted lists and contains
+ all key-value pairs that are contained by a map.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
protected @NotNull Node<SequenceType,ValueType> |
+createRootNode()
+The method, which is invoked on subclasses in order to create the trie's root node.
+ |
+
protected @NotNull SortedStructure<SequenceType,ValueType> |
+createStructure()
+The method, which is invoked on subclasses in order to create the implementation of the
+ interface
+Structure , which defines the structure of the trie. |
+
@NotNull SortedListTrie<SequenceType,ValueType> |
+subTrie(SequenceType sequence)
+
+ |
+
java.lang.String |
+toString() |
+
ceilingEntry, ceilingKey, comparator, descendingKeySet, descendingMap, firstEntry, firstKey, floorEntry, floorKey, headMap, headMap, higherEntry, higherKey, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, subMap, subMap, tailMap, tailMap
clear, containsKey, containsValue, entrySet, equals, get, getNode, getRootNode, hashCode, isEmpty, keySet, put, putAll, remove, size, values
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
entrySet, keySet, values
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
getRootNode
public SortedListTrie()+
public SortedListTrie(@NotNull + @NotNull java.util.Map<SequenceType,ValueType> map)+
map
- The map, which contains the key-value pairs that should be added to the trie, as
+ an instance of the type Map
. The map may not be nullpublic SortedListTrie(@Nullable + @Nullable java.util.Comparator<? super SequenceType> comparator)+
comparator
- The comparator, which should be used to compare keys with each other, as an
+ instance of the type Comparator
or null, if the natural ordering of
+ the keys should be usedpublic SortedListTrie(@Nullable + @Nullable java.util.Comparator<? super SequenceType> comparator, + @NotNull + @NotNull java.util.Map<SequenceType,ValueType> map)+
comparator
- The comparator, which should be used to compare keys with each other, as an
+ instance of the type Comparator
or null, if the natural ordering of
+ the keys should be usedmap
- The map, which contains the key-value pairs that should be added to the
+ trie, as an instance of the type Map
. The map may not be null@NotNull +protected final @NotNull Node<SequenceType,ValueType> createRootNode()+
AbstractTrie
createRootNode
in class AbstractTrie<SortedStructure<SequenceType extends Sequence,ValueType>,SequenceType extends Sequence,ValueType>
Node
. The
+ root node may not be null@NotNull +protected final @NotNull SortedStructure<SequenceType,ValueType> createStructure()+
AbstractTrie
Structure
, which defines the structure of the trie.createStructure
in class AbstractTrie<SortedStructure<SequenceType extends Sequence,ValueType>,SequenceType extends Sequence,ValueType>
Structure
as an instance of the generic
+ type StructureType
. The implementation may not be null@NotNull +public final @NotNull SortedListTrie<SequenceType,ValueType> subTrie(@Nullable + SequenceType sequence)+
SortedTrie
sequence
- The sequence as an instance of the generic type SequenceType
Trie
. The subtree may not be nullpublic final java.lang.String toString()+
toString
in class java.lang.Object
ValueType
- The type of the values, which are stored by the triepublic interface SortedStringTrie<ValueType> +extends java.util.NavigableMap<java.lang.String,ValueType>, StringTrie<ValueType>+
String
, as keys. This is the character-oriented pendant of the interface SortedTrie
and a specialization of the interface StringTrie
for implementations that
+ guarantee the trie's keys to be stored in a particular order. When iterating the trie, its
+ entries, keys and values are guaranteed to be traversed in the correct order.java.util.Map.Entry<K,V>
Modifier and Type | +Method and Description | +
---|---|
@NotNull SortedStringTrie<ValueType> |
+subTrie(@Nullable java.lang.String sequence) |
+
ceilingEntry, ceilingKey, descendingKeySet, descendingMap, firstEntry, floorEntry, floorKey, headMap, headMap, higherEntry, higherKey, lastEntry, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, subMap, subMap, tailMap, tailMap
comparator, entrySet, firstKey, keySet, lastKey, values
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
getRootNode
@NotNull +@NotNull SortedStringTrie<ValueType> subTrie(@Nullable + @Nullable java.lang.String sequence)+
subTrie
in interface StringTrie<ValueType>
StringTrie.subTrie(String)
SequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic interface SortedTrie<SequenceType extends Sequence,ValueType> +extends java.util.NavigableMap<SequenceType,ValueType>, Trie<SequenceType,ValueType>+
Trie
+ for implementations that guarantee the trie's keys to be stored in a particular order. When
+ iterating the trie, its entries, keys and values are guaranteed to be traversed in the correct
+ order.
+
+ To specify the order of the sequences, which are used as the trie's keys. The used sequence must
+ either implement the interface Comparable
or a Comparator
+ implementation must be provided to the trie.
java.util.Map.Entry<K,V>
Modifier and Type | +Method and Description | +
---|---|
@NotNull SortedTrie<SequenceType,ValueType> |
+subTrie(SequenceType sequence)
+
+ |
+
ceilingEntry, ceilingKey, descendingKeySet, descendingMap, firstEntry, floorEntry, floorKey, headMap, headMap, higherEntry, higherKey, lastEntry, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, subMap, subMap, tailMap, tailMap
comparator, entrySet, firstKey, keySet, lastKey, values
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
getRootNode
@NotNull +@NotNull SortedTrie<SequenceType,ValueType> subTrie(@Nullable + SequenceType sequence)+ +
subTrie
in interface Trie<SequenceType extends Sequence,ValueType>
sequence
- The sequence as an instance of the generic type SequenceType
Trie
. The subtree may not be nullValueType
- The type of the values, which are stored by the triepublic interface StringTrie<ValueType>
+extends java.util.Map<java.lang.String,ValueType>, java.io.Serializable
+String
, as keys.
+
+ This interface and its implementing classes should be preferred over the interface Trie
,
+ if character sequences should be stored in a trie. This is, because it offers a less complex API,
+ hiding the actual sequence implementation that is used internally (which is StringSequence
) and providing API methods that exclusively make use of the class String
.
java.util.Map.Entry<K,V>
Modifier and Type | +Method and Description | +
---|---|
@Nullable Node<java.lang.String,ValueType> |
+getRootNode() |
+
@NotNull StringTrie<ValueType> |
+subTrie(@Nullable java.lang.String sequence) |
+
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
@Nullable +@Nullable Node<java.lang.String,ValueType> getRootNode()+
Trie.getRootNode()
@NotNull +@NotNull StringTrie<ValueType> subTrie(@Nullable + @Nullable java.lang.String sequence)+
Trie.subTrie(Sequence)
SequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic interface Trie<SequenceType extends Sequence,ValueType>
+extends java.util.Map<SequenceType,ValueType>, java.io.Serializable
++ Tries allow to efficiently search for sequences (and their values) that share a common prefix. As + nodes with a common prefix share the same predecessors, tries also provide some kind of + compression. +
+ In a trie values are only associated with the leaf nodes and with some inner nodes. As all + successors of a node share a common prefix of the sequence, which is associated with that node, + the position of a value in the trie specifies the key it is associated with. The root node + corresponds to an empty sequence.
java.util.Map.Entry<K,V>
Modifier and Type | +Method and Description | +
---|---|
@Nullable Node<SequenceType,ValueType> |
+getRootNode()
+Returns the root node of the trie.
+ |
+
@NotNull Trie<SequenceType,ValueType> |
+subTrie(SequenceType sequence)
+Returns the subtree of the node, which corresponds to a specific sequence (must not
+ necessarily be a key, which is contained by the trie, but can also be a suffix).
+ |
+
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
@Nullable +@Nullable Node<SequenceType,ValueType> getRootNode()+
UnsupportedOperationException
will be thrown when attempting to change the state of the
+ returned node or one of its successors.Node
or null, if the
+ trie is empty@NotNull +@NotNull Trie<SequenceType,ValueType> subTrie(@Nullable + SequenceType sequence)+
NoSuchElementException
will be thrown.
+ + The nodes of the returned trie are deep copies of those of the original trie. Therefore the + returned trie is fully functional and can be modified without affecting the original trie.
sequence
- The sequence as an instance of the generic type SequenceType
Trie
. The subtree may not be nullpublic final class Tries
+extends java.lang.Object
+Collections
.Modifier and Type | +Field and Description | +
---|---|
static SortedStringTrie<?> |
+EMPTY_SORTED_STRING_TRIE
+The empty
+SortedStringTrie (immutable). |
+
static SortedTrie<?,?> |
+EMPTY_SORTED_TRIE
+The empty
+SortedTrie (immutable). |
+
static StringTrie<?> |
+EMPTY_STRING_TRIE
+The empty
+StringTrie (immutable). |
+
static Trie<?,?> |
+EMPTY_TRIE
+The empty
+Trie (immutable). |
+
Modifier and Type | +Method and Description | +
---|---|
static <V> @NotNull SortedStringTrie<V> |
+emptySortedStringTrie()
+Returns the empty
+SortedStringTrie (immutable). |
+
static <K extends Sequence,V> |
+emptySortedTrie()
+Returns the empty
+SortedTrie (immutable). |
+
static <V> @NotNull StringTrie<V> |
+emptyStringTrie()
+Returns the empty
+StringTrie (immutable). |
+
static <K extends Sequence,V> |
+emptyTrie()
+Returns the empty
+Trie (immutable). |
+
static <V> @NotNull SortedStringTrie<V> |
+singletonSortedStringTrie(@Nullable java.lang.String key,
+ V value)
+Returns an immutable
+SortedStringTrie , which only contains a single entry. |
+
static <K extends Sequence,V> |
+singletonSortedTrie(K key,
+ V value)
+Returns an immutable
+SortedTrie , which only contains a single entry. |
+
static <V> @NotNull StringTrie<V> |
+singletonStringTrie(@Nullable java.lang.String key,
+ V value)
+Returns an immutable
+StringTrie , which only contains a single entry. |
+
static <K extends Sequence,V> |
+singletonTrie(K key,
+ V value)
+Returns an immutable
+Trie , which only contains a single entry. |
+
static <V> @NotNull SortedStringTrie<V> |
+unmodifiableSortedStringTrie(@NotNull SortedStringTrie<V> trie)
+Returns an unmodifiable view of a specific
+SortedStringTrie . |
+
static <K extends Sequence,V> |
+unmodifiableSortedTrie(@NotNull SortedTrie<K,V> trie)
+Returns an unmodifiable view of a specific
+SortedTrie . |
+
static <V> @NotNull StringTrie<V> |
+unmodifiableStringTrie(@NotNull StringTrie<V> trie)
+Returns an unmodifiable view of a specific
+StringTrie . |
+
static <K extends Sequence,V> |
+unmodifiableTrie(@NotNull Trie<K,V> trie)
+Returns an unmodifiable view of a specific
+Trie . |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final Trie<?,?> EMPTY_TRIE+
Trie
(immutable). This trie is serializable.emptyTrie()
public static final SortedTrie<?,?> EMPTY_SORTED_TRIE+
SortedTrie
(immutable). This trie is serializable.emptySortedTrie()
public static final StringTrie<?> EMPTY_STRING_TRIE+
StringTrie
(immutable). This trie is serializable.emptyStringTrie()
public static final SortedStringTrie<?> EMPTY_SORTED_STRING_TRIE+
SortedStringTrie
(immutable). This trie is serializable.emptySortedStringTrie()
@NotNull +public static <K extends Sequence,V> @NotNull Trie<K,V> emptyTrie()+
Trie
(immutable). The returned trie is serializable.K
- The type of the sequences, which are used as the trie's keysV
- The type of the values, which are stored by the trieTrie
. The trie may not be nullEMPTY_TRIE
@NotNull +public static <K extends Sequence,V> @NotNull SortedTrie<K,V> emptySortedTrie()+
SortedTrie
(immutable). The returned trie is serializable.K
- The type of the sequences, which are used as the trie's keysV
- The type of the values, which are stored by the trieSortedTrie
. The trie may not be
+ nullEMPTY_SORTED_TRIE
@NotNull +public static <V> @NotNull StringTrie<V> emptyStringTrie()+
StringTrie
(immutable). The returned trie is serializable.V
- The type of the values, which are stored by the trieStringTrie
. The trie may not be
+ nullEMPTY_STRING_TRIE
@NotNull +public static <V> @NotNull SortedStringTrie<V> emptySortedStringTrie()+
SortedStringTrie
(immutable). The returned trie is serializable.V
- The type of the values, which are stored by the trieSortedStringTrie
. The trie may not
+ be nullEMPTY_SORTED_STRING_TRIE
@NotNull +public static <K extends Sequence,V> @NotNull Trie<K,V> singletonTrie(@Nullable + K key, + @Nullable + V value)+
Trie
, which only contains a single entry. The returned trie is
+ serializable.K
- The type of the sequences, which are used as the trie's keysV
- The type of the values, which are stored by the triekey
- The key of the entry, which should be stored in the trie, as an instance of the
+ generic type K
or nullvalue
- The value of the entry, which should be stored in the trie, as an instance of
+ the generic type V
or nullTrie
. The trie may not be null@NotNull +public static <K extends Sequence,V> @NotNull SortedTrie<K,V> singletonSortedTrie(@Nullable + K key, + @Nullable + V value)+
SortedTrie
, which only contains a single entry. The returned
+ trie is serializable.K
- The type of the sequences, which are used as the trie's keysV
- The type of the values, which are stored by the triekey
- The key of the entry, which should be stored in the trie, as an instance of the
+ generic type K
or nullvalue
- The value of the entry, which should be stored in the trie, as an instance of
+ the generic type V
or nullSortedTrie
. The trie may not be null@NotNull +public static <V> @NotNull StringTrie<V> singletonStringTrie(@Nullable + @Nullable java.lang.String key, + @Nullable + V value)+
StringTrie
, which only contains a single entry. The returned
+ trie is serializable.V
- The type of the values, which are stored by the triekey
- The key of the entry, which should be stored in the trie, as a String
or
+ nullvalue
- The value of the entry, which should be stored in the trie, as an instance of
+ the generic type V
or nullStringTrie
. The trie may not be null@NotNull +public static <V> @NotNull SortedStringTrie<V> singletonSortedStringTrie(@Nullable + @Nullable java.lang.String key, + @Nullable + V value)+
SortedStringTrie
, which only contains a single entry. The
+ returned trie is serializable.V
- The type of the values, which are stored by the triekey
- The key of the entry, which should be stored in the trie, as a String
or
+ nullvalue
- The value of the entry, which should be stored in the trie, as an instance of
+ the generic type V
or nullSortedStringTrie
. The trie may not be null@NotNull +public static <K extends Sequence,V> @NotNull Trie<K,V> unmodifiableTrie(@NotNull + @NotNull Trie<K,V> trie)+
Trie
. This method allows modules to
+ provide users with "read-only" access to internal tries. Query operations on the returned
+ trie "read through" to the specified trie, whereas attempts to modify the returned trie
+ result in an UnsupportedOperationException
.
+ + The returned trie will be serializable if the specified trie is serializable.
K
- The type of the sequences, which are used as the trie's keysV
- The type of the values, which are stored by the trietrie
- The trie for which an unmodifiable view should be returned as an instance of the
+ type Trie
. The trie may not be nullTrie
. The
+ view may not be null@NotNull +public static <K extends Sequence,V> @NotNull SortedTrie<K,V> unmodifiableSortedTrie(@NotNull + @NotNull SortedTrie<K,V> trie)+
SortedTrie
. This method allows modules to
+ provide users with "read-only" access to internal tries. Query operations on the returned
+ trie "read through" to the specified trie, whereas attempts to modify the returned trie
+ result in an UnsupportedOperationException
.
+ + The returned trie will be serializable if the specified trie is serializable.
K
- The type of the sequences, which are used as the trie's keysV
- The type of the values, which are stored by the trietrie
- The trie for which an unmodifiable view should be returned as an instance of the
+ type SortedTrie
. The trie may not be nullSortedTrie
.
+ The view may not be null@NotNull +public static <V> @NotNull StringTrie<V> unmodifiableStringTrie(@NotNull + @NotNull StringTrie<V> trie)+
StringTrie
. This method allows modules to
+ provide users with "read-only" access to internal tries. Query operations on the returned
+ trie "read through" to the specified trie, whereas attempts to modify the returned trie
+ result in an UnsupportedOperationException
.
+ + The returned trie will be serializable if the specified trie is serializable.
V
- The type of the values, which are stored by the trietrie
- The trie for which an unmodifiable view should be returned as an instance of the
+ type StringTrie
. The trie may not be nullStringTrie
.
+ The view may not be null@NotNull +public static <V> @NotNull SortedStringTrie<V> unmodifiableSortedStringTrie(@NotNull + @NotNull SortedStringTrie<V> trie)+
SortedStringTrie
. This method allows
+ modules to provide users with "read-only" access to internal tries. Query operations on the
+ returned trie "read through" to the specified trie, whereas attempts to modify the returned
+ trie result in an UnsupportedOperationException
.
+ + The returned trie will be serializable if the specified trie is serializable.
V
- The type of the values, which are stored by the trietrie
- The trie for which an unmodifiable view should be returned as an instance of the
+ type SortedStringTrie
. The trie may not be nullSortedStringTrie
. The view may not be nullSequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic abstract class AbstractEmptyTrie<SequenceType extends Sequence,ValueType> +extends java.lang.Object +implements Trie<SequenceType,ValueType>+
java.util.Map.Entry<K,V>
Constructor and Description | +
---|
AbstractEmptyTrie() |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+clear() |
+
boolean |
+containsKey(java.lang.Object key) |
+
boolean |
+containsValue(java.lang.Object value) |
+
@NotNull java.util.Set<java.util.Map.Entry<SequenceType,ValueType>> |
+entrySet() |
+
ValueType |
+get(java.lang.Object key) |
+
@Nullable Node<SequenceType,ValueType> |
+getRootNode()
+Returns the root node of the trie.
+ |
+
boolean |
+isEmpty() |
+
@NotNull java.util.Set<SequenceType> |
+keySet() |
+
ValueType |
+put(SequenceType key,
+ ValueType value) |
+
void |
+putAll(@NotNull java.util.Map<? extends SequenceType,? extends ValueType> map) |
+
ValueType |
+remove(java.lang.Object key) |
+
int |
+size() |
+
@NotNull java.util.Collection<ValueType> |
+values() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
public final int size()+
size
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final boolean isEmpty()+
isEmpty
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final boolean containsKey(java.lang.Object key)+
containsKey
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final boolean containsValue(java.lang.Object value)+
containsValue
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final ValueType get(java.lang.Object key)+
get
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final ValueType put(SequenceType key, + ValueType value)+
put
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final ValueType remove(java.lang.Object key)+
remove
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final void putAll(@NotNull + @NotNull java.util.Map<? extends SequenceType,? extends ValueType> map)+
putAll
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final void clear()+
clear
in interface java.util.Map<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.Set<SequenceType> keySet()+
keySet
in interface java.util.Map<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.Collection<ValueType> values()+
values
in interface java.util.Map<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.Set<java.util.Map.Entry<SequenceType,ValueType>> entrySet()+
entrySet
in interface java.util.Map<SequenceType extends Sequence,ValueType>
@Nullable +public final @Nullable Node<SequenceType,ValueType> getRootNode()+
Trie
UnsupportedOperationException
will be thrown when attempting to change the state of the
+ returned node or one of its successors.getRootNode
in interface Trie<SequenceType extends Sequence,ValueType>
Node
or null, if the
+ trie is emptySequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic abstract class AbstractSingletonTrie<SequenceType extends Sequence,ValueType> +extends java.lang.Object +implements Trie<SequenceType,ValueType>+
java.util.Map.Entry<K,V>
Constructor and Description | +
---|
AbstractSingletonTrie(SequenceType key,
+ ValueType value)
+Creates a new immutable trie, which only contains a single entry.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+clear() |
+
boolean |
+containsKey(java.lang.Object key) |
+
boolean |
+containsValue(java.lang.Object value) |
+
@NotNull java.util.Set<java.util.Map.Entry<SequenceType,ValueType>> |
+entrySet() |
+
boolean |
+equals(java.lang.Object obj) |
+
ValueType |
+get(java.lang.Object key) |
+
@Nullable Node<SequenceType,ValueType> |
+getRootNode()
+Returns the root node of the trie.
+ |
+
int |
+hashCode() |
+
boolean |
+isEmpty() |
+
@NotNull java.util.Set<SequenceType> |
+keySet() |
+
ValueType |
+put(SequenceType key,
+ ValueType value) |
+
void |
+putAll(@NotNull java.util.Map<? extends SequenceType,? extends ValueType> map) |
+
ValueType |
+remove(java.lang.Object key) |
+
int |
+size() |
+
@NotNull java.util.Collection<ValueType> |
+values() |
+
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public AbstractSingletonTrie(@Nullable + SequenceType key, + @Nullable + ValueType value)+
key
- The key of the entry as an instance of the generic type SequenceType
or
+ nullvalue
- The value of the entry as an instance of the generic type ValueType
or
+ nullpublic final int size()+
size
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final boolean isEmpty()+
isEmpty
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final boolean containsKey(java.lang.Object key)+
containsKey
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final boolean containsValue(java.lang.Object value)+
containsValue
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final ValueType get(java.lang.Object key)+
get
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final ValueType put(SequenceType key, + ValueType value)+
put
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final ValueType remove(java.lang.Object key)+
remove
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final void putAll(@NotNull + @NotNull java.util.Map<? extends SequenceType,? extends ValueType> map)+
putAll
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final void clear()+
clear
in interface java.util.Map<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.Set<SequenceType> keySet()+
keySet
in interface java.util.Map<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.Collection<ValueType> values()+
values
in interface java.util.Map<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.Set<java.util.Map.Entry<SequenceType,ValueType>> entrySet()+
entrySet
in interface java.util.Map<SequenceType extends Sequence,ValueType>
@Nullable +public final @Nullable Node<SequenceType,ValueType> getRootNode()+
Trie
UnsupportedOperationException
will be thrown when attempting to change the state of the
+ returned node or one of its successors.getRootNode
in interface Trie<SequenceType extends Sequence,ValueType>
Node
or null, if the
+ trie is emptypublic final int hashCode()+
hashCode
in interface java.util.Map<SequenceType extends Sequence,ValueType>
hashCode
in class java.lang.Object
public final boolean equals(java.lang.Object obj)+
equals
in interface java.util.Map<SequenceType extends Sequence,ValueType>
equals
in class java.lang.Object
SequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic abstract class AbstractSortedTrie<SequenceType extends Sequence,ValueType> +extends AbstractTrie<SortedStructure<SequenceType,ValueType>,SequenceType,ValueType> +implements SortedTrie<SequenceType,ValueType>+
NavigableMap
. Subclasses must provide an implementation of
+ the interface SortedStructure
, which adjusts the structure of the trie, when retrieving,
+ inserting or removing keys.AbstractTrie.AbstractKeySet<K extends Sequence,MapType extends java.util.Map<K,?>>, AbstractTrie.KeySet<K extends Sequence>
java.util.Map.Entry<K,V>
Modifier and Type | +Field and Description | +
---|---|
protected java.util.Comparator<? super SequenceType> |
+comparator
+The comparator, which is used to compare sequences to each other, or null, if the natural
+ order of the sequences is used.
+ |
+
rootNode, structure
Modifier | +Constructor and Description | +
---|---|
|
+AbstractSortedTrie(@Nullable java.util.Comparator<? super SequenceType> comparator)
+Creates a new empty, sorted trie.
+ |
+
|
+AbstractSortedTrie(@Nullable java.util.Comparator<? super SequenceType> comparator,
+ @NotNull java.util.Map<SequenceType,ValueType> map)
+Creates a new sorted trie, which contains all key-value pairs that are contained in a map.
+ |
+
protected |
+AbstractSortedTrie(@Nullable Node<SequenceType,ValueType> rootNode,
+ @Nullable java.util.Comparator<? super SequenceType> comparator)
+Creates a new sorted trie.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
java.util.Map.Entry<SequenceType,ValueType> |
+ceilingEntry(SequenceType key) |
+
SequenceType |
+ceilingKey(SequenceType key) |
+
java.util.Comparator<? super SequenceType> |
+comparator() |
+
java.util.NavigableSet<SequenceType> |
+descendingKeySet() |
+
@NotNull java.util.NavigableMap<SequenceType,ValueType> |
+descendingMap() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+firstEntry() |
+
SequenceType |
+firstKey() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+floorEntry(SequenceType key) |
+
SequenceType |
+floorKey(SequenceType key) |
+
@NotNull java.util.SortedMap<SequenceType,ValueType> |
+headMap(SequenceType toKey) |
+
@NotNull java.util.NavigableMap<SequenceType,ValueType> |
+headMap(SequenceType toKey,
+ boolean inclusive) |
+
java.util.Map.Entry<SequenceType,ValueType> |
+higherEntry(SequenceType key) |
+
SequenceType |
+higherKey(SequenceType key) |
+
java.util.Map.Entry<SequenceType,ValueType> |
+lastEntry() |
+
SequenceType |
+lastKey() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+lowerEntry(SequenceType key) |
+
SequenceType |
+lowerKey(SequenceType key) |
+
java.util.NavigableSet<SequenceType> |
+navigableKeySet() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+pollFirstEntry() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+pollLastEntry() |
+
@NotNull java.util.NavigableMap<SequenceType,ValueType> |
+subMap(SequenceType fromKey,
+ boolean fromInclusive,
+ SequenceType toKey,
+ boolean toInclusive) |
+
@NotNull java.util.SortedMap<SequenceType,ValueType> |
+subMap(SequenceType fromKey,
+ SequenceType toKey) |
+
@NotNull java.util.SortedMap<SequenceType,ValueType> |
+tailMap(SequenceType fromKey) |
+
java.util.NavigableMap<SequenceType,ValueType> |
+tailMap(SequenceType fromKey,
+ boolean inclusive) |
+
clear, containsKey, containsValue, createRootNode, createStructure, entrySet, equals, get, getNode, getRootNode, hashCode, isEmpty, keySet, put, putAll, remove, size, values
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
subTrie
entrySet, keySet, values
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
getRootNode
protected final java.util.Comparator<? super SequenceType extends Sequence> comparator+
protected AbstractSortedTrie(@Nullable + @Nullable Node<SequenceType,ValueType> rootNode, + @Nullable + @Nullable java.util.Comparator<? super SequenceType> comparator)+
rootNode
- The root node of the trie as an instance of the type Node
or null,
+ if the trie should be emptycomparator
- The comparator, which should be used to compare keys with each other, as an
+ instance of the type Comparator
or null, if the natural ordering of
+ the keys should be usedpublic AbstractSortedTrie(@Nullable + @Nullable java.util.Comparator<? super SequenceType> comparator)+
comparator
- The comparator, which should be used to compare keys with each other, as an
+ instance of the type Comparator
or null, if the natural ordering of
+ the keys should be usedpublic AbstractSortedTrie(@Nullable + @Nullable java.util.Comparator<? super SequenceType> comparator, + @NotNull + @NotNull java.util.Map<SequenceType,ValueType> map)+
comparator
- The comparator, which should be used to compare keys with each other, as an
+ instance of the type Comparator
or null, if the natural ordering of
+ the keys should be usedmap
- The map, which contains the key-value pairs that should be added to the
+ trie, as an instance of the type Map
. The map may not be nullpublic final java.util.Comparator<? super SequenceType> comparator()+
comparator
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
public final SequenceType lowerKey(SequenceType key)+
lowerKey
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final SequenceType higherKey(SequenceType key)+
higherKey
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final SequenceType floorKey(SequenceType key)+
floorKey
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final SequenceType ceilingKey(SequenceType key)+
ceilingKey
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final SequenceType firstKey()+
firstKey
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
public final SequenceType lastKey()+
lastKey
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> lowerEntry(SequenceType key)+
lowerEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> higherEntry(SequenceType key)+
higherEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> floorEntry(SequenceType key)+
floorEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> ceilingEntry(SequenceType key)+
ceilingEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> firstEntry()+
firstEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> lastEntry()+
lastEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> pollFirstEntry()+
pollFirstEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> pollLastEntry()+
pollLastEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.SortedMap<SequenceType,ValueType> subMap(SequenceType fromKey, + SequenceType toKey)+
subMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
subMap
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.NavigableMap<SequenceType,ValueType> subMap(SequenceType fromKey, + boolean fromInclusive, + SequenceType toKey, + boolean toInclusive)+
subMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.SortedMap<SequenceType,ValueType> headMap(SequenceType toKey)+
headMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
headMap
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.NavigableMap<SequenceType,ValueType> headMap(SequenceType toKey, + boolean inclusive)+
headMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.SortedMap<SequenceType,ValueType> tailMap(SequenceType fromKey)+
tailMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
tailMap
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableMap<SequenceType,ValueType> tailMap(SequenceType fromKey, + boolean inclusive)+
tailMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.NavigableMap<SequenceType,ValueType> descendingMap()+
descendingMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableSet<SequenceType> navigableKeySet()+
navigableKeySet
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableSet<SequenceType> descendingKeySet()+
descendingKeySet
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
TrieType
- The type of the encapsulated trieValueType
- The type of the values, which are stored by the triepublic abstract class AbstractStringTrieWrapper<TrieType extends Trie<StringSequence,ValueType>,ValueType> +extends java.lang.Object +implements StringTrie<ValueType>+
StringTrie
, by delegating all method calls to an encapsulated trie.java.util.Map.Entry<K,V>
Modifier and Type | +Field and Description | +
---|---|
protected TrieType |
+trie
+The encapsulated trie.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+clear() |
+
boolean |
+containsKey(java.lang.Object key) |
+
boolean |
+containsValue(java.lang.Object value) |
+
@NotNull java.util.Set<java.util.Map.Entry<java.lang.String,ValueType>> |
+entrySet() |
+
boolean |
+equals(java.lang.Object obj) |
+
ValueType |
+get(java.lang.Object key) |
+
@Nullable Node<java.lang.String,ValueType> |
+getRootNode() |
+
int |
+hashCode() |
+
boolean |
+isEmpty() |
+
@NotNull java.util.Set<java.lang.String> |
+keySet() |
+
ValueType |
+put(java.lang.String key,
+ ValueType value) |
+
void |
+putAll(@NotNull java.util.Map<? extends java.lang.String,? extends ValueType> map) |
+
ValueType |
+remove(java.lang.Object key) |
+
int |
+size() |
+
@NotNull java.util.Collection<ValueType> |
+values() |
+
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
subTrie
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
protected final TrieType extends Trie<StringSequence,ValueType> trie+
public final int size()+
size
in interface java.util.Map<java.lang.String,ValueType>
public final boolean isEmpty()+
isEmpty
in interface java.util.Map<java.lang.String,ValueType>
public final boolean containsKey(java.lang.Object key)+
containsKey
in interface java.util.Map<java.lang.String,ValueType>
public final boolean containsValue(java.lang.Object value)+
containsValue
in interface java.util.Map<java.lang.String,ValueType>
public final ValueType get(java.lang.Object key)+
get
in interface java.util.Map<java.lang.String,ValueType>
public final ValueType put(java.lang.String key, + ValueType value)+
put
in interface java.util.Map<java.lang.String,ValueType>
public final ValueType remove(java.lang.Object key)+
remove
in interface java.util.Map<java.lang.String,ValueType>
public final void putAll(@NotNull + @NotNull java.util.Map<? extends java.lang.String,? extends ValueType> map)+
putAll
in interface java.util.Map<java.lang.String,ValueType>
public final void clear()+
clear
in interface java.util.Map<java.lang.String,ValueType>
@NotNull +public final @NotNull java.util.Set<java.lang.String> keySet()+
keySet
in interface java.util.Map<java.lang.String,ValueType>
@NotNull +public final @NotNull java.util.Collection<ValueType> values()+
values
in interface java.util.Map<java.lang.String,ValueType>
@NotNull +public final @NotNull java.util.Set<java.util.Map.Entry<java.lang.String,ValueType>> entrySet()+
entrySet
in interface java.util.Map<java.lang.String,ValueType>
@Nullable +public final @Nullable Node<java.lang.String,ValueType> getRootNode()+
getRootNode
in interface StringTrie<ValueType>
Trie.getRootNode()
public final int hashCode()+
hashCode
in interface java.util.Map<java.lang.String,ValueType>
hashCode
in class java.lang.Object
public final boolean equals(java.lang.Object obj)+
equals
in interface java.util.Map<java.lang.String,ValueType>
equals
in class java.lang.Object
K
- The type of the keys, which are contained by the key setMapType
- The type of the mapprotected abstract static class AbstractTrie.AbstractKeySet<K extends Sequence,MapType extends java.util.Map<K,?>>
+extends java.util.AbstractSet<K>
+Map.keySet()
method.Modifier and Type | +Method and Description | +
---|---|
void |
+clear() |
+
boolean |
+contains(java.lang.Object o) |
+
boolean |
+isEmpty() |
+
boolean |
+remove(java.lang.Object o) |
+
int |
+size() |
+
equals, hashCode, removeAll
add, addAll, containsAll, iterator, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, addAll, containsAll, iterator, retainAll, spliterator, toArray, toArray
parallelStream, removeIf, stream
forEach
K
- The type of the sequences, which are used as the trie's keysprotected static final class AbstractTrie.KeySet<K extends Sequence> +extends AbstractTrie.AbstractKeySet<K,AbstractTrie<?,K,?>>+
Map.keySet()
. The entry set is
+ backed by a KeyIterator
, which traverses all keys of the trie.Modifier and Type | +Method and Description | +
---|---|
@NotNull java.util.Iterator<K> |
+iterator() |
+
clear, contains, isEmpty, remove, size
equals, hashCode, removeAll
add, addAll, containsAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, addAll, containsAll, retainAll, spliterator, toArray, toArray
parallelStream, removeIf, stream
forEach
@NotNull +public @NotNull java.util.Iterator<K> iterator()+
iterator
in interface java.lang.Iterable<K extends Sequence>
iterator
in interface java.util.Collection<K extends Sequence>
iterator
in interface java.util.Set<K extends Sequence>
iterator
in class java.util.AbstractCollection<K extends Sequence>
StructureType
- The type of the implementation of the interface Structure
, which
+ defines the structure of the trieSequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic abstract class AbstractTrie<StructureType extends Structure<SequenceType,ValueType>,SequenceType extends Sequence,ValueType> +extends java.lang.Object +implements Trie<SequenceType,ValueType>+
Map
. In
+ particular it provides general implementations of lookup, insert and delete operations without
+ forcing constraints on the trie's structure. Subclasses must provide an implementation of the
+ interface Structure
, which adjusts the structure of the trie, when retrieving, inserting
+ or removing keys.Modifier and Type | +Class and Description | +
---|---|
protected static class |
+AbstractTrie.AbstractKeySet<K extends Sequence,MapType extends java.util.Map<K,?>>
+An abstract base class for all key sets as returned by the
+Map.keySet() method. |
+
protected static class |
+AbstractTrie.KeySet<K extends Sequence>
+The key set of a trie as returned by the method
+Map.keySet() . |
+
java.util.Map.Entry<K,V>
Modifier and Type | +Field and Description | +
---|---|
protected Node<SequenceType,ValueType> |
+rootNode
+The root node of the trie.
+ |
+
protected StructureType |
+structure
+The implementation of the interface
+Structure , which defines the structure of the
+ trie. |
+
Modifier | +Constructor and Description | +
---|---|
|
+AbstractTrie()
+Creates a new empty trie.
+ |
+
|
+AbstractTrie(@NotNull java.util.Map<SequenceType,ValueType> map)
+Creates a new trie, which contains all key-value pairs that are contained in a map.
+ |
+
protected |
+AbstractTrie(@Nullable Node<SequenceType,ValueType> rootNode)
+Creates a new trie.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+clear() |
+
boolean |
+containsKey(java.lang.Object key) |
+
boolean |
+containsValue(java.lang.Object value) |
+
protected abstract @NotNull Node<SequenceType,ValueType> |
+createRootNode()
+The method, which is invoked on subclasses in order to create the trie's root node.
+ |
+
protected abstract StructureType |
+createStructure()
+The method, which is invoked on subclasses in order to create the implementation of the
+ interface
+Structure , which defines the structure of the trie. |
+
@NotNull java.util.Set<java.util.Map.Entry<SequenceType,ValueType>> |
+entrySet() |
+
boolean |
+equals(java.lang.Object obj) |
+
ValueType |
+get(java.lang.Object key) |
+
protected @Nullable Node<SequenceType,ValueType> |
+getNode(java.lang.Object key)
+Traverses the trie in order to returns the node, which corresponds to a specific key.
+ |
+
@Nullable Node<SequenceType,ValueType> |
+getRootNode()
+Returns the root node of the trie.
+ |
+
int |
+hashCode() |
+
boolean |
+isEmpty() |
+
@NotNull java.util.Set<SequenceType> |
+keySet() |
+
ValueType |
+put(SequenceType key,
+ ValueType value) |
+
void |
+putAll(@NotNull java.util.Map<? extends SequenceType,? extends ValueType> map) |
+
ValueType |
+remove(java.lang.Object key) |
+
int |
+size() |
+
@NotNull java.util.Collection<ValueType> |
+values() |
+
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
protected final StructureType extends Structure<SequenceType,ValueType> structure+
Structure
, which defines the structure of the
+ trie.protected Node<SequenceType extends Sequence,ValueType> rootNode+
protected AbstractTrie(@Nullable + @Nullable Node<SequenceType,ValueType> rootNode)+
rootNode
- The root node of the trie as an instance of the type Node
or null, if
+ the trie should be emptypublic AbstractTrie()+
public AbstractTrie(@NotNull + @NotNull java.util.Map<SequenceType,ValueType> map)+
map
- The map, which contains the key-value pairs that should be added to the trie, as
+ an instance of the type Map
. The map may not be null@NotNull +protected abstract @NotNull Node<SequenceType,ValueType> createRootNode()+
Node
. The
+ root node may not be null@NotNull +protected abstract StructureType createStructure()+
Structure
, which defines the structure of the trie.Structure
as an instance of the generic
+ type StructureType
. The implementation may not be null@Nullable +protected final @Nullable Node<SequenceType,ValueType> getNode(java.lang.Object key)+
key
- The key, the node, which should be returned, corresponds to, as an instance of the
+ class Object
. If the key cannot be cast to the generic type SequenceType
, a ClassCastException
will be thrownNode
+ or null, if no such node is available@Nullable +public final @Nullable Node<SequenceType,ValueType> getRootNode()+
Trie
UnsupportedOperationException
will be thrown when attempting to change the state of the
+ returned node or one of its successors.getRootNode
in interface Trie<SequenceType extends Sequence,ValueType>
Node
or null, if the
+ trie is emptypublic final boolean isEmpty()+
isEmpty
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final int size()+
size
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final boolean containsKey(java.lang.Object key)+
containsKey
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final boolean containsValue(java.lang.Object value)+
containsValue
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final void clear()+
clear
in interface java.util.Map<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.Set<SequenceType> keySet()+
keySet
in interface java.util.Map<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.Collection<ValueType> values()+
values
in interface java.util.Map<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.Set<java.util.Map.Entry<SequenceType,ValueType>> entrySet()+
entrySet
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final ValueType put(SequenceType key, + ValueType value)+
put
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final void putAll(@NotNull + @NotNull java.util.Map<? extends SequenceType,? extends ValueType> map)+
putAll
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final ValueType remove(java.lang.Object key)+
remove
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final ValueType get(java.lang.Object key)+
get
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final int hashCode()+
hashCode
in interface java.util.Map<SequenceType extends Sequence,ValueType>
hashCode
in class java.lang.Object
public final boolean equals(java.lang.Object obj)+
equals
in interface java.util.Map<SequenceType extends Sequence,ValueType>
equals
in class java.lang.Object
ValueType
- The type of the values, which are stored by the triepublic abstract class AbstractUnmodifiableStringTrie<ValueType,TrieType extends StringTrie<ValueType>> +extends java.lang.Object +implements StringTrie<ValueType>+
UnsupportedOperationException
s when calling a method, which
+ attempts to change the trie's state.java.util.Map.Entry<K,V>
Constructor and Description | +
---|
AbstractUnmodifiableStringTrie(TrieType trie)
+Creates a new immutable string trie.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+clear() |
+
boolean |
+containsKey(java.lang.Object key) |
+
boolean |
+containsValue(java.lang.Object value) |
+
@NotNull java.util.Set<java.util.Map.Entry<java.lang.String,ValueType>> |
+entrySet() |
+
boolean |
+equals(java.lang.Object obj) |
+
ValueType |
+get(java.lang.Object key) |
+
@Nullable Node<java.lang.String,ValueType> |
+getRootNode() |
+
int |
+hashCode() |
+
boolean |
+isEmpty() |
+
@NotNull java.util.Set<java.lang.String> |
+keySet() |
+
ValueType |
+put(java.lang.String key,
+ ValueType value) |
+
void |
+putAll(@NotNull java.util.Map<? extends java.lang.String,? extends ValueType> map) |
+
ValueType |
+remove(java.lang.Object key) |
+
int |
+size() |
+
java.lang.String |
+toString() |
+
@NotNull java.util.Collection<ValueType> |
+values() |
+
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
subTrie
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public AbstractUnmodifiableStringTrie(@NotNull + TrieType trie)+
trie
- The trie, which should be encapsulated, as an instance of the generic type TrieType
. The trie may not be nullpublic final int size()+
size
in interface java.util.Map<java.lang.String,ValueType>
public final boolean isEmpty()+
isEmpty
in interface java.util.Map<java.lang.String,ValueType>
public final boolean containsKey(java.lang.Object key)+
containsKey
in interface java.util.Map<java.lang.String,ValueType>
public final boolean containsValue(java.lang.Object value)+
containsValue
in interface java.util.Map<java.lang.String,ValueType>
public final ValueType get(java.lang.Object key)+
get
in interface java.util.Map<java.lang.String,ValueType>
public final ValueType put(java.lang.String key, + ValueType value)+
put
in interface java.util.Map<java.lang.String,ValueType>
public final ValueType remove(java.lang.Object key)+
remove
in interface java.util.Map<java.lang.String,ValueType>
public final void putAll(@NotNull + @NotNull java.util.Map<? extends java.lang.String,? extends ValueType> map)+
putAll
in interface java.util.Map<java.lang.String,ValueType>
public final void clear()+
clear
in interface java.util.Map<java.lang.String,ValueType>
@NotNull +public final @NotNull java.util.Set<java.lang.String> keySet()+
keySet
in interface java.util.Map<java.lang.String,ValueType>
@NotNull +public final @NotNull java.util.Collection<ValueType> values()+
values
in interface java.util.Map<java.lang.String,ValueType>
@NotNull +public final @NotNull java.util.Set<java.util.Map.Entry<java.lang.String,ValueType>> entrySet()+
entrySet
in interface java.util.Map<java.lang.String,ValueType>
@Nullable +public final @Nullable Node<java.lang.String,ValueType> getRootNode()+
getRootNode
in interface StringTrie<ValueType>
Trie.getRootNode()
public final java.lang.String toString()+
toString
in class java.lang.Object
public final int hashCode()+
hashCode
in interface java.util.Map<java.lang.String,ValueType>
hashCode
in class java.lang.Object
public final boolean equals(java.lang.Object obj)+
equals
in interface java.util.Map<java.lang.String,ValueType>
equals
in class java.lang.Object
SequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic abstract class AbstractUnmodifiableTrie<SequenceType extends Sequence,ValueType,TrieType extends Trie<SequenceType,ValueType>> +extends java.lang.Object +implements Trie<SequenceType,ValueType>+
UnsupportedOperationException
s when calling a method, which attempts to
+ change the trie's state.java.util.Map.Entry<K,V>
Constructor and Description | +
---|
AbstractUnmodifiableTrie(TrieType trie)
+Creates a new immutable trie.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+clear() |
+
boolean |
+containsKey(java.lang.Object key) |
+
boolean |
+containsValue(java.lang.Object value) |
+
@NotNull java.util.Set<java.util.Map.Entry<SequenceType,ValueType>> |
+entrySet() |
+
boolean |
+equals(java.lang.Object obj) |
+
ValueType |
+get(java.lang.Object key) |
+
@Nullable Node<SequenceType,ValueType> |
+getRootNode()
+Returns the root node of the trie.
+ |
+
int |
+hashCode() |
+
boolean |
+isEmpty() |
+
@NotNull java.util.Set<SequenceType> |
+keySet() |
+
ValueType |
+put(SequenceType key,
+ ValueType value) |
+
void |
+putAll(@NotNull java.util.Map<? extends SequenceType,? extends ValueType> map) |
+
ValueType |
+remove(java.lang.Object key) |
+
int |
+size() |
+
java.lang.String |
+toString() |
+
@NotNull java.util.Collection<ValueType> |
+values() |
+
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public AbstractUnmodifiableTrie(@NotNull + TrieType trie)+
trie
- The trie, which should be encapsulated, as an instance of the generic type TrieType
. The trie may not be nullpublic final int size()+
size
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final boolean isEmpty()+
isEmpty
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final boolean containsKey(java.lang.Object key)+
containsKey
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final boolean containsValue(java.lang.Object value)+
containsValue
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final ValueType get(java.lang.Object key)+
get
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final ValueType put(SequenceType key, + ValueType value)+
put
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final ValueType remove(java.lang.Object key)+
remove
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final void putAll(@NotNull + @NotNull java.util.Map<? extends SequenceType,? extends ValueType> map)+
putAll
in interface java.util.Map<SequenceType extends Sequence,ValueType>
public final void clear()+
clear
in interface java.util.Map<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.Set<SequenceType> keySet()+
keySet
in interface java.util.Map<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.Collection<ValueType> values()+
values
in interface java.util.Map<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.Set<java.util.Map.Entry<SequenceType,ValueType>> entrySet()+
entrySet
in interface java.util.Map<SequenceType extends Sequence,ValueType>
@Nullable +public final @Nullable Node<SequenceType,ValueType> getRootNode()+
Trie
UnsupportedOperationException
will be thrown when attempting to change the state of the
+ returned node or one of its successors.getRootNode
in interface Trie<SequenceType extends Sequence,ValueType>
Node
or null, if the
+ trie is emptypublic final java.lang.String toString()+
toString
in class java.lang.Object
public final int hashCode()+
hashCode
in interface java.util.Map<SequenceType extends Sequence,ValueType>
hashCode
in class java.lang.Object
public final boolean equals(java.lang.Object obj)+
equals
in interface java.util.Map<SequenceType extends Sequence,ValueType>
equals
in class java.lang.Object
SequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic class EmptySortedTrie<SequenceType extends Sequence,ValueType> +extends AbstractEmptyTrie<SequenceType,ValueType> +implements SortedTrie<SequenceType,ValueType>+
java.util.Map.Entry<K,V>
Constructor and Description | +
---|
EmptySortedTrie() |
+
Modifier and Type | +Method and Description | +
---|---|
java.util.Map.Entry<SequenceType,ValueType> |
+ceilingEntry(SequenceType key) |
+
SequenceType |
+ceilingKey(SequenceType key) |
+
java.util.Comparator<? super SequenceType> |
+comparator() |
+
java.util.NavigableSet<SequenceType> |
+descendingKeySet() |
+
java.util.NavigableMap<SequenceType,ValueType> |
+descendingMap() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+firstEntry() |
+
SequenceType |
+firstKey() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+floorEntry(SequenceType key) |
+
SequenceType |
+floorKey(SequenceType key) |
+
@NotNull java.util.SortedMap<SequenceType,ValueType> |
+headMap(SequenceType toKey) |
+
java.util.NavigableMap<SequenceType,ValueType> |
+headMap(SequenceType toKey,
+ boolean inclusive) |
+
java.util.Map.Entry<SequenceType,ValueType> |
+higherEntry(SequenceType key) |
+
SequenceType |
+higherKey(SequenceType key) |
+
java.util.Map.Entry<SequenceType,ValueType> |
+lastEntry() |
+
SequenceType |
+lastKey() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+lowerEntry(SequenceType key) |
+
SequenceType |
+lowerKey(SequenceType key) |
+
java.util.NavigableSet<SequenceType> |
+navigableKeySet() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+pollFirstEntry() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+pollLastEntry() |
+
java.util.NavigableMap<SequenceType,ValueType> |
+subMap(SequenceType fromKey,
+ boolean fromInclusive,
+ SequenceType toKey,
+ boolean toInclusive) |
+
@NotNull java.util.SortedMap<SequenceType,ValueType> |
+subMap(SequenceType fromKey,
+ SequenceType toKey) |
+
@NotNull SortedTrie<SequenceType,ValueType> |
+subTrie(SequenceType sequence)
+
+ |
+
@NotNull java.util.SortedMap<SequenceType,ValueType> |
+tailMap(SequenceType fromKey) |
+
java.util.NavigableMap<SequenceType,ValueType> |
+tailMap(SequenceType fromKey,
+ boolean inclusive) |
+
java.lang.String |
+toString() |
+
clear, containsKey, containsValue, entrySet, get, getRootNode, isEmpty, keySet, put, putAll, remove, size, values
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
entrySet, keySet, values
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
getRootNode
public final java.util.Map.Entry<SequenceType,ValueType> lowerEntry(SequenceType key)+
lowerEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final SequenceType lowerKey(SequenceType key)+
lowerKey
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> floorEntry(SequenceType key)+
floorEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final SequenceType floorKey(SequenceType key)+
floorKey
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> ceilingEntry(SequenceType key)+
ceilingEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final SequenceType ceilingKey(SequenceType key)+
ceilingKey
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> higherEntry(SequenceType key)+
higherEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final SequenceType higherKey(SequenceType key)+
higherKey
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> firstEntry()+
firstEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> lastEntry()+
lastEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> pollFirstEntry()+
pollFirstEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> pollLastEntry()+
pollLastEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableMap<SequenceType,ValueType> descendingMap()+
descendingMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableSet<SequenceType> navigableKeySet()+
navigableKeySet
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableSet<SequenceType> descendingKeySet()+
descendingKeySet
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableMap<SequenceType,ValueType> subMap(SequenceType fromKey, + boolean fromInclusive, + SequenceType toKey, + boolean toInclusive)+
subMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableMap<SequenceType,ValueType> headMap(SequenceType toKey, + boolean inclusive)+
headMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableMap<SequenceType,ValueType> tailMap(SequenceType fromKey, + boolean inclusive)+
tailMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Comparator<? super SequenceType> comparator()+
comparator
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.SortedMap<SequenceType,ValueType> subMap(SequenceType fromKey, + SequenceType toKey)+
subMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
subMap
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.SortedMap<SequenceType,ValueType> headMap(SequenceType toKey)+
headMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
headMap
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.SortedMap<SequenceType,ValueType> tailMap(SequenceType fromKey)+
tailMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
tailMap
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
public final SequenceType firstKey()+
firstKey
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
public final SequenceType lastKey()+
lastKey
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull SortedTrie<SequenceType,ValueType> subTrie(@NotNull + SequenceType sequence)+
SortedTrie
subTrie
in interface SortedTrie<SequenceType extends Sequence,ValueType>
subTrie
in interface Trie<SequenceType extends Sequence,ValueType>
sequence
- The sequence as an instance of the generic type SequenceType
Trie
. The subtree may not be nullpublic final java.lang.String toString()+
toString
in class java.lang.Object
SequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic class EmptyTrie<SequenceType extends Sequence,ValueType> +extends AbstractEmptyTrie<SequenceType,ValueType>+
java.util.Map.Entry<K,V>
Modifier and Type | +Method and Description | +
---|---|
@NotNull Trie<SequenceType,ValueType> |
+subTrie(SequenceType sequence)
+Returns the subtree of the node, which corresponds to a specific sequence (must not
+ necessarily be a key, which is contained by the trie, but can also be a suffix).
+ |
+
java.lang.String |
+toString() |
+
clear, containsKey, containsValue, entrySet, get, getRootNode, isEmpty, keySet, put, putAll, remove, size, values
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
@NotNull +public final @NotNull Trie<SequenceType,ValueType> subTrie(@NotNull + SequenceType sequence)+
Trie
NoSuchElementException
will be thrown.
+ + The nodes of the returned trie are deep copies of those of the original trie. Therefore the + returned trie is fully functional and can be modified without affecting the original trie.
sequence
- The sequence as an instance of the generic type SequenceType
Trie
. The subtree may not be nullpublic final java.lang.String toString()+
toString
in class java.lang.Object
SequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic class SingletonSortedTrie<SequenceType extends Sequence,ValueType> +extends AbstractSingletonTrie<SequenceType,ValueType> +implements SortedTrie<SequenceType,ValueType>+
SortedTrie
, which contains only a single entry.java.util.Map.Entry<K,V>
Constructor and Description | +
---|
SingletonSortedTrie(SequenceType key,
+ ValueType value)
+Creates a new immutable
+SortedTrie , which only contains a single entry. |
+
Modifier and Type | +Method and Description | +
---|---|
java.util.Map.Entry<SequenceType,ValueType> |
+ceilingEntry(SequenceType key) |
+
SequenceType |
+ceilingKey(SequenceType key) |
+
java.util.Comparator<? super SequenceType> |
+comparator() |
+
java.util.NavigableSet<SequenceType> |
+descendingKeySet() |
+
java.util.NavigableMap<SequenceType,ValueType> |
+descendingMap() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+firstEntry() |
+
SequenceType |
+firstKey() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+floorEntry(SequenceType key) |
+
SequenceType |
+floorKey(SequenceType key) |
+
@NotNull java.util.SortedMap<SequenceType,ValueType> |
+headMap(SequenceType toKey) |
+
java.util.NavigableMap<SequenceType,ValueType> |
+headMap(SequenceType toKey,
+ boolean inclusive) |
+
java.util.Map.Entry<SequenceType,ValueType> |
+higherEntry(SequenceType key) |
+
SequenceType |
+higherKey(SequenceType key) |
+
java.util.Map.Entry<SequenceType,ValueType> |
+lastEntry() |
+
SequenceType |
+lastKey() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+lowerEntry(SequenceType key) |
+
SequenceType |
+lowerKey(SequenceType key) |
+
java.util.NavigableSet<SequenceType> |
+navigableKeySet() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+pollFirstEntry() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+pollLastEntry() |
+
java.util.NavigableMap<SequenceType,ValueType> |
+subMap(SequenceType fromKey,
+ boolean fromInclusive,
+ SequenceType toKey,
+ boolean toInclusive) |
+
@NotNull java.util.SortedMap<SequenceType,ValueType> |
+subMap(SequenceType fromKey,
+ SequenceType toKey) |
+
@NotNull SortedTrie<SequenceType,ValueType> |
+subTrie(SequenceType sequence)
+
+ |
+
@NotNull java.util.SortedMap<SequenceType,ValueType> |
+tailMap(SequenceType fromKey) |
+
java.util.NavigableMap<SequenceType,ValueType> |
+tailMap(SequenceType fromKey,
+ boolean inclusive) |
+
java.lang.String |
+toString() |
+
clear, containsKey, containsValue, entrySet, equals, get, getRootNode, hashCode, isEmpty, keySet, put, putAll, remove, size, values
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
entrySet, keySet, values
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
getRootNode
public SingletonSortedTrie(@Nullable + SequenceType key, + @Nullable + ValueType value)+
SortedTrie
, which only contains a single entry.key
- The key of the entry as an instance of the generic type SequenceType
or
+ nullvalue
- The value of the entry as an instance of the generic type ValueType
orpublic final java.util.Map.Entry<SequenceType,ValueType> lowerEntry(SequenceType key)+
lowerEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final SequenceType lowerKey(SequenceType key)+
lowerKey
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> floorEntry(SequenceType key)+
floorEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final SequenceType floorKey(SequenceType key)+
floorKey
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> ceilingEntry(SequenceType key)+
ceilingEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final SequenceType ceilingKey(SequenceType key)+
ceilingKey
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> higherEntry(SequenceType key)+
higherEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final SequenceType higherKey(SequenceType key)+
higherKey
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> firstEntry()+
firstEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> lastEntry()+
lastEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> pollFirstEntry()+
pollFirstEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> pollLastEntry()+
pollLastEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableMap<SequenceType,ValueType> descendingMap()+
descendingMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableSet<SequenceType> navigableKeySet()+
navigableKeySet
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableSet<SequenceType> descendingKeySet()+
descendingKeySet
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableMap<SequenceType,ValueType> subMap(SequenceType fromKey, + boolean fromInclusive, + SequenceType toKey, + boolean toInclusive)+
subMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableMap<SequenceType,ValueType> headMap(SequenceType toKey, + boolean inclusive)+
headMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableMap<SequenceType,ValueType> tailMap(SequenceType fromKey, + boolean inclusive)+
tailMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Comparator<? super SequenceType> comparator()+
comparator
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.SortedMap<SequenceType,ValueType> subMap(SequenceType fromKey, + SequenceType toKey)+
subMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
subMap
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.SortedMap<SequenceType,ValueType> headMap(SequenceType toKey)+
headMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
headMap
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.SortedMap<SequenceType,ValueType> tailMap(SequenceType fromKey)+
tailMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
tailMap
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
public final SequenceType firstKey()+
firstKey
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
public final SequenceType lastKey()+
lastKey
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull SortedTrie<SequenceType,ValueType> subTrie(@NotNull + SequenceType sequence)+
SortedTrie
subTrie
in interface SortedTrie<SequenceType extends Sequence,ValueType>
subTrie
in interface Trie<SequenceType extends Sequence,ValueType>
sequence
- The sequence as an instance of the generic type SequenceType
Trie
. The subtree may not be nullpublic final java.lang.String toString()+
toString
in class java.lang.Object
SequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic class SingletonTrie<SequenceType extends Sequence,ValueType> +extends AbstractSingletonTrie<SequenceType,ValueType>+
Trie
, which contains only a single entry.java.util.Map.Entry<K,V>
Constructor and Description | +
---|
SingletonTrie(SequenceType key,
+ ValueType value)
+Creates a new immutable
+Trie , which only contains a single entry. |
+
Modifier and Type | +Method and Description | +
---|---|
@NotNull Trie<SequenceType,ValueType> |
+subTrie(SequenceType sequence)
+Returns the subtree of the node, which corresponds to a specific sequence (must not
+ necessarily be a key, which is contained by the trie, but can also be a suffix).
+ |
+
java.lang.String |
+toString() |
+
clear, containsKey, containsValue, entrySet, equals, get, getRootNode, hashCode, isEmpty, keySet, put, putAll, remove, size, values
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public SingletonTrie(@Nullable + SequenceType key, + @Nullable + ValueType value)+
Trie
, which only contains a single entry.key
- The key of the entry as an instance of the generic type SequenceType
or
+ nullvalue
- The value of the entry as an instance of the generic type ValueType
or
+ null@NotNull +public final @NotNull Trie<SequenceType,ValueType> subTrie(@NotNull + SequenceType sequence)+
Trie
NoSuchElementException
will be thrown.
+ + The nodes of the returned trie are deep copies of those of the original trie. Therefore the + returned trie is fully functional and can be modified without affecting the original trie.
sequence
- The sequence as an instance of the generic type SequenceType
Trie
. The subtree may not be nullpublic final java.lang.String toString()+
toString
in class java.lang.Object
protected static final class SortedStringTrieWrapper.StringSequenceComparatorWrapper +extends java.lang.Object +implements java.util.Comparator<StringSequence>+
StringSequence
by
+ encapsulating a comparator, which compares String
s.Constructor and Description | +
---|
StringSequenceComparatorWrapper(@NotNull java.util.Comparator<? super java.lang.String> comparator)
+Creates a new comparator, which allows to compare instances of the class
+StringSequence by encapsulating a comparator, which compares String s. |
+
Modifier and Type | +Method and Description | +
---|---|
int |
+compare(StringSequence o1,
+ StringSequence o2) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public StringSequenceComparatorWrapper(@NotNull + @NotNull java.util.Comparator<? super java.lang.String> comparator)+
StringSequence
by encapsulating a comparator, which compares String
s.comparator
- The comparator, which should be encapsulated, as an instance of the
+ type Comparator
. The comparator may not be nullpublic final int compare(StringSequence o1, + StringSequence o2)+
compare
in interface java.util.Comparator<StringSequence>
ValueType
- The type of the values, which are stored by the triepublic class SortedStringTrieWrapper<ValueType> +extends AbstractStringTrieWrapper<SortedTrie<StringSequence,ValueType>,ValueType> +implements SortedStringTrie<ValueType>+
SortedStringTrie
by delegating all method calls
+ to an encapsulated SortedTrie
.Modifier and Type | +Class and Description | +
---|---|
protected static class |
+SortedStringTrieWrapper.StringSequenceComparatorWrapper
+A comparator, which allows to compare instances of the class
+StringSequence by
+ encapsulating a comparator, which compares String s. |
+
java.util.Map.Entry<K,V>
trie
Constructor and Description | +
---|
SortedStringTrieWrapper(@NotNull SortedTrie<StringSequence,ValueType> trie)
+Creates a new wrapper, which implements the interface
+SortedStringTrie . |
+
Modifier and Type | +Method and Description | +
---|---|
java.util.Map.Entry<java.lang.String,ValueType> |
+ceilingEntry(java.lang.String key) |
+
java.lang.String |
+ceilingKey(java.lang.String key) |
+
java.util.Comparator<? super java.lang.String> |
+comparator() |
+
java.util.NavigableSet<java.lang.String> |
+descendingKeySet() |
+
java.util.NavigableMap<java.lang.String,ValueType> |
+descendingMap() |
+
java.util.Map.Entry<java.lang.String,ValueType> |
+firstEntry() |
+
java.lang.String |
+firstKey() |
+
java.util.Map.Entry<java.lang.String,ValueType> |
+floorEntry(java.lang.String key) |
+
java.lang.String |
+floorKey(java.lang.String key) |
+
@NotNull java.util.SortedMap<java.lang.String,ValueType> |
+headMap(java.lang.String toKey) |
+
java.util.NavigableMap<java.lang.String,ValueType> |
+headMap(java.lang.String toKey,
+ boolean inclusive) |
+
java.util.Map.Entry<java.lang.String,ValueType> |
+higherEntry(java.lang.String key) |
+
java.lang.String |
+higherKey(java.lang.String key) |
+
java.util.Map.Entry<java.lang.String,ValueType> |
+lastEntry() |
+
java.lang.String |
+lastKey() |
+
java.util.Map.Entry<java.lang.String,ValueType> |
+lowerEntry(java.lang.String key) |
+
java.lang.String |
+lowerKey(java.lang.String key) |
+
java.util.NavigableSet<java.lang.String> |
+navigableKeySet() |
+
java.util.Map.Entry<java.lang.String,ValueType> |
+pollFirstEntry() |
+
java.util.Map.Entry<java.lang.String,ValueType> |
+pollLastEntry() |
+
java.util.NavigableMap<java.lang.String,ValueType> |
+subMap(java.lang.String fromKey,
+ boolean fromInclusive,
+ java.lang.String toKey,
+ boolean toInclusive) |
+
@NotNull java.util.SortedMap<java.lang.String,ValueType> |
+subMap(java.lang.String fromKey,
+ java.lang.String toKey) |
+
@NotNull SortedStringTrie<ValueType> |
+subTrie(@Nullable java.lang.String sequence) |
+
@NotNull java.util.SortedMap<java.lang.String,ValueType> |
+tailMap(java.lang.String fromKey) |
+
java.util.NavigableMap<java.lang.String,ValueType> |
+tailMap(java.lang.String fromKey,
+ boolean inclusive) |
+
clear, containsKey, containsValue, entrySet, equals, get, getRootNode, hashCode, isEmpty, keySet, put, putAll, remove, size, values
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
entrySet, keySet, values
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
getRootNode
public SortedStringTrieWrapper(@NotNull + @NotNull SortedTrie<StringSequence,ValueType> trie)+
SortedStringTrie
.trie
- The trie, which should be encapsulated, as an instance of the type SortedTrie
. The trie may not be nullpublic final java.util.Map.Entry<java.lang.String,ValueType> lowerEntry(java.lang.String key)+
lowerEntry
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.lang.String lowerKey(java.lang.String key)+
lowerKey
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.Map.Entry<java.lang.String,ValueType> floorEntry(java.lang.String key)+
floorEntry
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.lang.String floorKey(java.lang.String key)+
floorKey
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.Map.Entry<java.lang.String,ValueType> ceilingEntry(java.lang.String key)+
ceilingEntry
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.lang.String ceilingKey(java.lang.String key)+
ceilingKey
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.Map.Entry<java.lang.String,ValueType> higherEntry(java.lang.String key)+
higherEntry
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.lang.String higherKey(java.lang.String key)+
higherKey
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.Map.Entry<java.lang.String,ValueType> firstEntry()+
firstEntry
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.Map.Entry<java.lang.String,ValueType> lastEntry()+
lastEntry
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.Map.Entry<java.lang.String,ValueType> pollFirstEntry()+
pollFirstEntry
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.Map.Entry<java.lang.String,ValueType> pollLastEntry()+
pollLastEntry
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.NavigableMap<java.lang.String,ValueType> descendingMap()+
descendingMap
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.NavigableSet<java.lang.String> navigableKeySet()+
navigableKeySet
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.NavigableSet<java.lang.String> descendingKeySet()+
descendingKeySet
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.NavigableMap<java.lang.String,ValueType> subMap(java.lang.String fromKey, + boolean fromInclusive, + java.lang.String toKey, + boolean toInclusive)+
subMap
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.NavigableMap<java.lang.String,ValueType> headMap(java.lang.String toKey, + boolean inclusive)+
headMap
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.NavigableMap<java.lang.String,ValueType> tailMap(java.lang.String fromKey, + boolean inclusive)+
tailMap
in interface java.util.NavigableMap<java.lang.String,ValueType>
public java.util.Comparator<? super java.lang.String> comparator()+
comparator
in interface java.util.SortedMap<java.lang.String,ValueType>
@NotNull +public final @NotNull java.util.SortedMap<java.lang.String,ValueType> subMap(java.lang.String fromKey, + java.lang.String toKey)+ +
@NotNull +public final @NotNull java.util.SortedMap<java.lang.String,ValueType> headMap(java.lang.String toKey)+ +
@NotNull +public final @NotNull java.util.SortedMap<java.lang.String,ValueType> tailMap(java.lang.String fromKey)+ +
public final java.lang.String firstKey()+
firstKey
in interface java.util.SortedMap<java.lang.String,ValueType>
public final java.lang.String lastKey()+
lastKey
in interface java.util.SortedMap<java.lang.String,ValueType>
@NotNull +public final @NotNull SortedStringTrie<ValueType> subTrie(@Nullable + @Nullable java.lang.String sequence)+
subTrie
in interface SortedStringTrie<ValueType>
subTrie
in interface StringTrie<ValueType>
StringTrie.subTrie(String)
ValueType
- The type of the node's valuepublic class StringNodeWrapper<ValueType> +extends java.lang.Object +implements Node<java.lang.String,ValueType>+
Node
, where predecessors correspond to keys of the
+ type String
. It forwards read-only method calls to an encapsulated node by mapping String
s to StringSequence
s and throws UnsupportedOperationException
s when
+ calling a method, which attempts to change the node's state.Constructor and Description | +
---|
StringNodeWrapper(@NotNull Node<StringSequence,ValueType> node)
+Creates a new implementation of the interface
+Node , where predecessors correspond to
+ keys of the type String . |
+
Modifier and Type | +Method and Description | +
---|---|
@NotNull Node<java.lang.String,ValueType> |
+addSuccessor(@NotNull java.lang.String key,
+ @Nullable Node<java.lang.String,ValueType> successor)
+Adds a specific successor to the node.
+ |
+
Node<java.lang.String,ValueType> |
+clone()
+Creates and returns a deep copy of the node and its successors.
+ |
+
void |
+decreaseSuccessorValueCount(int by)
+Decreases the number of successors for which values are set by a specific amount.
+ |
+
boolean |
+equals(java.lang.Object obj) |
+
@Nullable NodeValue<ValueType> |
+getNodeValue()
+Returns the value of the node.
+ |
+
java.util.Map.Entry<java.lang.String,Node<java.lang.String,ValueType>> |
+getPredecessor()
+Returns the predecessor of the node.
+ |
+
@Nullable Node<java.lang.String,ValueType> |
+getSuccessor(@NotNull java.lang.String key)
+Returns the successor of the node, which corresponds to a specific key.
+ |
+
int |
+getSuccessorCount()
+Returns the number of the node's successors.
+ |
+
int |
+getSuccessorValueCount()
+Returns the number of successors for which values are set, i.e.
+ |
+
int |
+hashCode() |
+
void |
+increaseSuccessorValueCount(int by)
+Increases the number of successors for which values are set by a specific amount.
+ |
+
@NotNull java.util.Iterator<java.lang.String> |
+iterator() |
+
void |
+removeSuccessor(@NotNull java.lang.String key)
+Removes the successor, which corresponds to a specific key.
+ |
+
@Nullable NodeValue<ValueType> |
+setNodeValue(@Nullable NodeValue<ValueType> nodeValue)
+Sets the value of the node.
+ |
+
void |
+setPredecessor(java.util.Map.Entry<java.lang.String,Node<java.lang.String,ValueType>> predecessor)
+Sets the predecessor of the node.
+ |
+
java.lang.String |
+toString() |
+
finalize, getClass, notify, notifyAll, wait, wait, wait
addSuccessor, getFirstSuccessor, getFirstSuccessorKey, getLastSuccessor, getLastSuccessorKey, getSuccessor, getSuccessorKey, getValue, hasSuccessors, indexOf, indexOfFirstElement, isValueSet, removeSuccessor
forEach, spliterator
public StringNodeWrapper(@NotNull + @NotNull Node<StringSequence,ValueType> node)+
Node
, where predecessors correspond to
+ keys of the type String
.node
- The node, which should be encapsulated, as an instance of the type Node
.
+ The node may not be null@Nullable +public final @Nullable NodeValue<ValueType> getNodeValue()+
Node
getNodeValue
in interface Node<java.lang.String,ValueType>
NodeValue
wrapper or null, if the
+ node does not correspond to a key, which has been put into the trie@Nullable +public final @Nullable NodeValue<ValueType> setNodeValue(@Nullable + @Nullable NodeValue<ValueType> nodeValue)+
Node
setNodeValue
in interface Node<java.lang.String,ValueType>
nodeValue
- A wrapper, which encapsulates the value, which should be set, as an instance
+ of the class NodeValue
or null, if the node does not correspond to a
+ key, which has been put into the trieNodeValue
or null,
+ if no value was setpublic final int getSuccessorCount()+
Node
getSuccessorCount
in interface Node<java.lang.String,ValueType>
Integer
value@Nullable +public final @Nullable Node<java.lang.String,ValueType> getSuccessor(@NotNull + @NotNull java.lang.String key)+
Node
getSuccessor
in interface Node<java.lang.String,ValueType>
key
- The key of the successor, which should be returned, as an instance of the generic
+ type KeyType
. The key may not be nullNode
or null, if no successor corresponds to the given key@NotNull +public final @NotNull Node<java.lang.String,ValueType> addSuccessor(@NotNull + @NotNull java.lang.String key, + @Nullable + @Nullable Node<java.lang.String,ValueType> successor)+
Node
addSuccessor
in interface Node<java.lang.String,ValueType>
key
- The key, which corresponds to the successor to be created, as an instance of
+ the generic type KeyType
. The key may not be nullsuccessor
- The successor, which should be added, as an instance of the type Node
or null, if the successor should be createdNode
. The
+ successor may not be nullpublic final void removeSuccessor(@NotNull + @NotNull java.lang.String key)+
Node
removeSuccessor
in interface Node<java.lang.String,ValueType>
key
- The key, which corresponds to the successor, which should be removed, as an
+ instance of the generic type KeyType
. The key may not be nullpublic final int getSuccessorValueCount()+
Node
Node.isValueSet()
returns
+ true
. All successors of the node are taken into account recursively down to the
+ leaf nodes.getSuccessorValueCount
in interface Node<java.lang.String,ValueType>
Integer
valuepublic final void increaseSuccessorValueCount(int by)+
Node
increaseSuccessorValueCount
in interface Node<java.lang.String,ValueType>
by
- The amount, the number of successor should be increased by, as an Integer
+ value. The amount must be at least 0public final void decreaseSuccessorValueCount(int by)+
Node
decreaseSuccessorValueCount
in interface Node<java.lang.String,ValueType>
by
- The amount, the number of successor should be decreased by, as an Integer
+ value. The amount must be at least 0@Nullable +public final java.util.Map.Entry<java.lang.String,Node<java.lang.String,ValueType>> getPredecessor()+
Node
getPredecessor
in interface Node<java.lang.String,ValueType>
Map.Entry
or null, if
+ no predecessor is setpublic final void setPredecessor(@Nullable + java.util.Map.Entry<java.lang.String,Node<java.lang.String,ValueType>> predecessor)+
Node
setPredecessor
in interface Node<java.lang.String,ValueType>
predecessor
- An entry, which contains the predecessor, which should be set, as well as
+ the key this node is referenced by in the predecessor, as an instance of
+ the type Map.Entry
or null, if no predecessor should be setpublic final Node<java.lang.String,ValueType> clone()+
Node
@NotNull +public final @NotNull java.util.Iterator<java.lang.String> iterator()+
iterator
in interface java.lang.Iterable<java.lang.String>
public final java.lang.String toString()+
toString
in class java.lang.Object
public final int hashCode()+
hashCode
in class java.lang.Object
public final boolean equals(java.lang.Object obj)+
equals
in class java.lang.Object
ValueType
- The type of the values, which are stored by the triepublic class StringTrieWrapper<ValueType> +extends AbstractStringTrieWrapper<Trie<StringSequence,ValueType>,ValueType> +implements StringTrie<ValueType>+
StringTrie
by delegating all method calls to an
+ encapsulated Trie
.java.util.Map.Entry<K,V>
trie
Constructor and Description | +
---|
StringTrieWrapper(@NotNull Trie<StringSequence,ValueType> trie)
+Creates a new wrapper, which implements the interface
+StringTrie . |
+
Modifier and Type | +Method and Description | +
---|---|
@NotNull StringTrieWrapper<ValueType> |
+subTrie(@Nullable java.lang.String sequence) |
+
clear, containsKey, containsValue, entrySet, equals, get, getRootNode, hashCode, isEmpty, keySet, put, putAll, remove, size, values
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getRootNode
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
public StringTrieWrapper(@NotNull + @NotNull Trie<StringSequence,ValueType> trie)+
StringTrie
.trie
- The trie, which should be encapsulated, as an instance of the type Trie
.
+ The trie may not be null@NotNull +public final @NotNull StringTrieWrapper<ValueType> subTrie(@Nullable + @Nullable java.lang.String sequence)+
subTrie
in interface StringTrie<ValueType>
Trie.subTrie(Sequence)
ValueType
- The type of the values, which are stored by the triepublic class UnmodifiableSortedStringTrie<ValueType> +extends AbstractUnmodifiableStringTrie<ValueType,SortedStringTrie<ValueType>> +implements SortedStringTrie<ValueType>+
SortedStringTrie
.java.util.Map.Entry<K,V>
Constructor and Description | +
---|
UnmodifiableSortedStringTrie(@NotNull SortedStringTrie<ValueType> trie)
+Creates a new unmodifiable sorted string trie.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
java.util.Map.Entry<java.lang.String,ValueType> |
+ceilingEntry(java.lang.String key) |
+
java.lang.String |
+ceilingKey(java.lang.String key) |
+
java.util.Comparator<? super java.lang.String> |
+comparator() |
+
java.util.NavigableSet<java.lang.String> |
+descendingKeySet() |
+
java.util.NavigableMap<java.lang.String,ValueType> |
+descendingMap() |
+
java.util.Map.Entry<java.lang.String,ValueType> |
+firstEntry() |
+
java.lang.String |
+firstKey() |
+
java.util.Map.Entry<java.lang.String,ValueType> |
+floorEntry(java.lang.String key) |
+
java.lang.String |
+floorKey(java.lang.String key) |
+
@NotNull java.util.SortedMap<java.lang.String,ValueType> |
+headMap(java.lang.String toKey) |
+
java.util.NavigableMap<java.lang.String,ValueType> |
+headMap(java.lang.String toKey,
+ boolean inclusive) |
+
java.util.Map.Entry<java.lang.String,ValueType> |
+higherEntry(java.lang.String key) |
+
java.lang.String |
+higherKey(java.lang.String key) |
+
java.util.Map.Entry<java.lang.String,ValueType> |
+lastEntry() |
+
java.lang.String |
+lastKey() |
+
java.util.Map.Entry<java.lang.String,ValueType> |
+lowerEntry(java.lang.String key) |
+
java.lang.String |
+lowerKey(java.lang.String key) |
+
@NotNull java.util.NavigableSet<java.lang.String> |
+navigableKeySet() |
+
java.util.Map.Entry<java.lang.String,ValueType> |
+pollFirstEntry() |
+
java.util.Map.Entry<java.lang.String,ValueType> |
+pollLastEntry() |
+
java.util.NavigableMap<java.lang.String,ValueType> |
+subMap(java.lang.String fromKey,
+ boolean fromInclusive,
+ java.lang.String toKey,
+ boolean toInclusive) |
+
java.util.SortedMap<java.lang.String,ValueType> |
+subMap(java.lang.String fromKey,
+ java.lang.String toKey) |
+
@NotNull SortedStringTrie<ValueType> |
+subTrie(@NotNull java.lang.String sequence) |
+
@NotNull java.util.SortedMap<java.lang.String,ValueType> |
+tailMap(java.lang.String fromKey) |
+
java.util.NavigableMap<java.lang.String,ValueType> |
+tailMap(java.lang.String fromKey,
+ boolean inclusive) |
+
clear, containsKey, containsValue, entrySet, equals, get, getRootNode, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
entrySet, keySet, values
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
getRootNode
public UnmodifiableSortedStringTrie(@NotNull + @NotNull SortedStringTrie<ValueType> trie)+
trie
- The trie, which should be encapsulated, as an instance of the generic type SortedStringTrie
. The trie may not be nullpublic final java.util.Map.Entry<java.lang.String,ValueType> lowerEntry(java.lang.String key)+
lowerEntry
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.lang.String lowerKey(java.lang.String key)+
lowerKey
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.Map.Entry<java.lang.String,ValueType> floorEntry(java.lang.String key)+
floorEntry
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.lang.String floorKey(java.lang.String key)+
floorKey
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.Map.Entry<java.lang.String,ValueType> ceilingEntry(java.lang.String key)+
ceilingEntry
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.lang.String ceilingKey(java.lang.String key)+
ceilingKey
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.Map.Entry<java.lang.String,ValueType> higherEntry(java.lang.String key)+
higherEntry
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.lang.String higherKey(java.lang.String key)+
higherKey
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.Map.Entry<java.lang.String,ValueType> firstEntry()+
firstEntry
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.Map.Entry<java.lang.String,ValueType> lastEntry()+
lastEntry
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.Map.Entry<java.lang.String,ValueType> pollFirstEntry()+
pollFirstEntry
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.Map.Entry<java.lang.String,ValueType> pollLastEntry()+
pollLastEntry
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.NavigableMap<java.lang.String,ValueType> descendingMap()+
descendingMap
in interface java.util.NavigableMap<java.lang.String,ValueType>
@NotNull +public final @NotNull java.util.NavigableSet<java.lang.String> navigableKeySet()+
navigableKeySet
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.NavigableSet<java.lang.String> descendingKeySet()+
descendingKeySet
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.NavigableMap<java.lang.String,ValueType> subMap(java.lang.String fromKey, + boolean fromInclusive, + java.lang.String toKey, + boolean toInclusive)+
subMap
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.NavigableMap<java.lang.String,ValueType> headMap(java.lang.String toKey, + boolean inclusive)+
headMap
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.NavigableMap<java.lang.String,ValueType> tailMap(java.lang.String fromKey, + boolean inclusive)+
tailMap
in interface java.util.NavigableMap<java.lang.String,ValueType>
public final java.util.Comparator<? super java.lang.String> comparator()+
comparator
in interface java.util.SortedMap<java.lang.String,ValueType>
public final java.util.SortedMap<java.lang.String,ValueType> subMap(java.lang.String fromKey, + java.lang.String toKey)+ +
@NotNull +public final @NotNull java.util.SortedMap<java.lang.String,ValueType> headMap(java.lang.String toKey)+ +
@NotNull +public final @NotNull java.util.SortedMap<java.lang.String,ValueType> tailMap(java.lang.String fromKey)+ +
public final java.lang.String firstKey()+
firstKey
in interface java.util.SortedMap<java.lang.String,ValueType>
public final java.lang.String lastKey()+
lastKey
in interface java.util.SortedMap<java.lang.String,ValueType>
@NotNull +public final @NotNull SortedStringTrie<ValueType> subTrie(@NotNull + @NotNull java.lang.String sequence)+
subTrie
in interface SortedStringTrie<ValueType>
subTrie
in interface StringTrie<ValueType>
StringTrie.subTrie(String)
SequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic class UnmodifiableSortedTrie<SequenceType extends Sequence,ValueType> +extends AbstractUnmodifiableTrie<SequenceType,ValueType,SortedTrie<SequenceType,ValueType>> +implements SortedTrie<SequenceType,ValueType>+
SortedTrie
.java.util.Map.Entry<K,V>
Constructor and Description | +
---|
UnmodifiableSortedTrie(@NotNull SortedTrie<SequenceType,ValueType> trie)
+Creates a new immutable
+SortedTrie . |
+
Modifier and Type | +Method and Description | +
---|---|
java.util.Map.Entry<SequenceType,ValueType> |
+ceilingEntry(SequenceType key) |
+
SequenceType |
+ceilingKey(SequenceType key) |
+
java.util.Comparator<? super SequenceType> |
+comparator() |
+
java.util.NavigableSet<SequenceType> |
+descendingKeySet() |
+
java.util.NavigableMap<SequenceType,ValueType> |
+descendingMap() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+firstEntry() |
+
SequenceType |
+firstKey() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+floorEntry(SequenceType key) |
+
SequenceType |
+floorKey(SequenceType key) |
+
@NotNull java.util.SortedMap<SequenceType,ValueType> |
+headMap(SequenceType toKey) |
+
java.util.NavigableMap<SequenceType,ValueType> |
+headMap(SequenceType toKey,
+ boolean inclusive) |
+
java.util.Map.Entry<SequenceType,ValueType> |
+higherEntry(SequenceType key) |
+
SequenceType |
+higherKey(SequenceType key) |
+
java.util.Map.Entry<SequenceType,ValueType> |
+lastEntry() |
+
SequenceType |
+lastKey() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+lowerEntry(SequenceType key) |
+
SequenceType |
+lowerKey(SequenceType key) |
+
java.util.NavigableSet<SequenceType> |
+navigableKeySet() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+pollFirstEntry() |
+
java.util.Map.Entry<SequenceType,ValueType> |
+pollLastEntry() |
+
java.util.NavigableMap<SequenceType,ValueType> |
+subMap(SequenceType fromKey,
+ boolean fromInclusive,
+ SequenceType toKey,
+ boolean toInclusive) |
+
@NotNull java.util.SortedMap<SequenceType,ValueType> |
+subMap(SequenceType fromKey,
+ SequenceType toKey) |
+
@NotNull SortedTrie<SequenceType,ValueType> |
+subTrie(SequenceType sequence)
+
+ |
+
java.util.SortedMap<SequenceType,ValueType> |
+tailMap(SequenceType fromKey) |
+
java.util.NavigableMap<SequenceType,ValueType> |
+tailMap(SequenceType fromKey,
+ boolean inclusive) |
+
clear, containsKey, containsValue, entrySet, equals, get, getRootNode, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
entrySet, keySet, values
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
getRootNode
public UnmodifiableSortedTrie(@NotNull + @NotNull SortedTrie<SequenceType,ValueType> trie)+
SortedTrie
.trie
- The trie, which should be encapsulated, as an instance of the generic type SortedTrie
. The trie may not be nullpublic final java.util.Map.Entry<SequenceType,ValueType> lowerEntry(SequenceType key)+
lowerEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final SequenceType lowerKey(SequenceType key)+
lowerKey
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> floorEntry(SequenceType key)+
floorEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final SequenceType floorKey(SequenceType key)+
floorKey
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> ceilingEntry(SequenceType key)+
ceilingEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final SequenceType ceilingKey(SequenceType key)+
ceilingKey
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> higherEntry(SequenceType key)+
higherEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final SequenceType higherKey(SequenceType key)+
higherKey
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> firstEntry()+
firstEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> lastEntry()+
lastEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> pollFirstEntry()+
pollFirstEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Map.Entry<SequenceType,ValueType> pollLastEntry()+
pollLastEntry
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableMap<SequenceType,ValueType> descendingMap()+
descendingMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableSet<SequenceType> navigableKeySet()+
navigableKeySet
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableSet<SequenceType> descendingKeySet()+
descendingKeySet
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableMap<SequenceType,ValueType> subMap(SequenceType fromKey, + boolean fromInclusive, + SequenceType toKey, + boolean toInclusive)+
subMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableMap<SequenceType,ValueType> headMap(SequenceType toKey, + boolean inclusive)+
headMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.NavigableMap<SequenceType,ValueType> tailMap(SequenceType fromKey, + boolean inclusive)+
tailMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
public final java.util.Comparator<? super SequenceType> comparator()+
comparator
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.SortedMap<SequenceType,ValueType> subMap(SequenceType fromKey, + SequenceType toKey)+
subMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
subMap
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull java.util.SortedMap<SequenceType,ValueType> headMap(SequenceType toKey)+
headMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
headMap
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
public final java.util.SortedMap<SequenceType,ValueType> tailMap(SequenceType fromKey)+
tailMap
in interface java.util.NavigableMap<SequenceType extends Sequence,ValueType>
tailMap
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
public final SequenceType firstKey()+
firstKey
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
public final SequenceType lastKey()+
lastKey
in interface java.util.SortedMap<SequenceType extends Sequence,ValueType>
@NotNull +public final @NotNull SortedTrie<SequenceType,ValueType> subTrie(@NotNull + SequenceType sequence)+
SortedTrie
subTrie
in interface SortedTrie<SequenceType extends Sequence,ValueType>
subTrie
in interface Trie<SequenceType extends Sequence,ValueType>
sequence
- The sequence as an instance of the generic type SequenceType
Trie
. The subtree may not be nullValueType
- The type of the values, which are stored by the triepublic class UnmodifiableStringTrie<ValueType> +extends AbstractUnmodifiableStringTrie<ValueType,StringTrie<ValueType>>+
StringTrie
.java.util.Map.Entry<K,V>
Constructor and Description | +
---|
UnmodifiableStringTrie(@NotNull StringTrie<ValueType> trie)
+Creates a new immutable
+StringTrie . |
+
Modifier and Type | +Method and Description | +
---|---|
@NotNull StringTrie<ValueType> |
+subTrie(@NotNull java.lang.String sequence) |
+
clear, containsKey, containsValue, entrySet, equals, get, getRootNode, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public UnmodifiableStringTrie(@NotNull + @NotNull StringTrie<ValueType> trie)+
StringTrie
.trie
- The trie, which should be encapsulated, as an instance of the type StringTrie
. The trie may not be null@NotNull +public final @NotNull StringTrie<ValueType> subTrie(@NotNull + @NotNull java.lang.String sequence)+
Trie.subTrie(Sequence)
SequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic class UnmodifiableTrie<SequenceType extends Sequence,ValueType> +extends AbstractUnmodifiableTrie<SequenceType,ValueType,Trie<SequenceType,ValueType>>+
Trie
.java.util.Map.Entry<K,V>
Constructor and Description | +
---|
UnmodifiableTrie(@NotNull Trie<SequenceType,ValueType> trie)
+Creates a new immutable
+Trie . |
+
Modifier and Type | +Method and Description | +
---|---|
@NotNull Trie<SequenceType,ValueType> |
+subTrie(SequenceType sequence)
+Returns the subtree of the node, which corresponds to a specific sequence (must not
+ necessarily be a key, which is contained by the trie, but can also be a suffix).
+ |
+
clear, containsKey, containsValue, entrySet, equals, get, getRootNode, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public UnmodifiableTrie(@NotNull + @NotNull Trie<SequenceType,ValueType> trie)+
Trie
.trie
- The trie, which should be encapsulated, as an instance of the type Trie
.
+ The trie may not be null@NotNull +public final @NotNull Trie<SequenceType,ValueType> subTrie(@NotNull + SequenceType sequence)+
Trie
NoSuchElementException
will be thrown.
+ + The nodes of the returned trie are deep copies of those of the original trie. Therefore the + returned trie is fully functional and can be modified without affecting the original trie.
sequence
- The sequence as an instance of the generic type SequenceType
Trie
. The subtree may not be nullKeyType
- The type of the keys, which are associated with the node's successorsValueType
- The type of the node's valuepublic abstract class AbstractNode<KeyType extends Sequence,ValueType> +extends java.lang.Object +implements Node<KeyType,ValueType>+
Modifier and Type | +Method and Description | +
---|---|
@NotNull Node<KeyType,ValueType> |
+addSuccessor(KeyType key,
+ @Nullable Node<KeyType,ValueType> successor)
+Adds a specific successor to the node.
+ |
+
abstract Node<KeyType,ValueType> |
+clone()
+Creates and returns a deep copy of the node and its successors.
+ |
+
protected void |
+cloneSuccessors(@NotNull Node<KeyType,ValueType> source,
+ @NotNull Node<KeyType,ValueType> target)
+Clones all successors of a specific node recursively and adds them to another node.
+ |
+
void |
+decreaseSuccessorValueCount(int by)
+Decreases the number of successors for which values are set by a specific amount.
+ |
+
boolean |
+equals(java.lang.Object obj) |
+
@Nullable NodeValue<ValueType> |
+getNodeValue()
+Returns the value of the node.
+ |
+
java.util.Map.Entry<KeyType,Node<KeyType,ValueType>> |
+getPredecessor()
+Returns the predecessor of the node.
+ |
+
int |
+getSuccessorValueCount()
+Returns the number of successors for which values are set, i.e.
+ |
+
int |
+hashCode() |
+
void |
+increaseSuccessorValueCount(int by)
+Increases the number of successors for which values are set by a specific amount.
+ |
+
protected abstract @NotNull Node<KeyType,ValueType> |
+onAddSuccessor(KeyType key,
+ @Nullable Node<KeyType,ValueType> successor)
+The method, which is invoked on subclasses in order to add a specific successor to the node.
+ |
+
protected abstract @Nullable Node<KeyType,ValueType> |
+onRemoveSuccessor(KeyType key)
+The method, which is invoked on subclasses in order to remove a specific successor from the
+ node.
+ |
+
void |
+removeSuccessor(KeyType key)
+Removes the successor, which corresponds to a specific key.
+ |
+
@Nullable NodeValue<ValueType> |
+setNodeValue(@Nullable NodeValue<ValueType> nodeValue)
+Sets the value of the node.
+ |
+
void |
+setPredecessor(java.util.Map.Entry<KeyType,Node<KeyType,ValueType>> predecessor)
+Sets the predecessor of the node.
+ |
+
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addSuccessor, getFirstSuccessor, getFirstSuccessorKey, getLastSuccessor, getLastSuccessorKey, getSuccessor, getSuccessor, getSuccessorCount, getSuccessorKey, getValue, hasSuccessors, indexOf, indexOfFirstElement, isValueSet, removeSuccessor
forEach, iterator, spliterator
protected final void cloneSuccessors(@NotNull + @NotNull Node<KeyType,ValueType> source, + @NotNull + @NotNull Node<KeyType,ValueType> target)+
@NotNull +protected abstract @NotNull Node<KeyType,ValueType> onAddSuccessor(@NotNull + KeyType key, + @Nullable + @Nullable Node<KeyType,ValueType> successor)+
key
- The key, which corresponds to the successor as an instance of the generic
+ type KeyType
. The key may not be nullsuccessor
- The successor, which should be added, as an instance of the type Node
or null, if a new node should be createdNode
. The node may not be null@Nullable +protected abstract @Nullable Node<KeyType,ValueType> onRemoveSuccessor(@NotNull + KeyType key)+
key
- The key, which corresponds to the successor, which should be removed, as an
+ instance of the generic type KeyType
. The key may not be nullNode
or
+ null, if no successor corresponds to the given key@Nullable +public final @Nullable NodeValue<ValueType> getNodeValue()+
Node
@Nullable +public final @Nullable NodeValue<ValueType> setNodeValue(@Nullable + @Nullable NodeValue<ValueType> nodeValue)+
Node
setNodeValue
in interface Node<KeyType extends Sequence,ValueType>
nodeValue
- A wrapper, which encapsulates the value, which should be set, as an instance
+ of the class NodeValue
or null, if the node does not correspond to a
+ key, which has been put into the trieNodeValue
or null,
+ if no value was set@NotNull +public final @NotNull Node<KeyType,ValueType> addSuccessor(@NotNull + KeyType key, + @Nullable + @Nullable Node<KeyType,ValueType> successor)+
Node
addSuccessor
in interface Node<KeyType extends Sequence,ValueType>
key
- The key, which corresponds to the successor to be created, as an instance of
+ the generic type KeyType
. The key may not be nullsuccessor
- The successor, which should be added, as an instance of the type Node
or null, if the successor should be createdNode
. The
+ successor may not be nullpublic final void removeSuccessor(@NotNull + KeyType key)+
Node
removeSuccessor
in interface Node<KeyType extends Sequence,ValueType>
key
- The key, which corresponds to the successor, which should be removed, as an
+ instance of the generic type KeyType
. The key may not be nullpublic final int getSuccessorValueCount()+
Node
Node.isValueSet()
returns
+ true
. All successors of the node are taken into account recursively down to the
+ leaf nodes.getSuccessorValueCount
in interface Node<KeyType extends Sequence,ValueType>
Integer
valuepublic final void increaseSuccessorValueCount(int by)+
Node
increaseSuccessorValueCount
in interface Node<KeyType extends Sequence,ValueType>
by
- The amount, the number of successor should be increased by, as an Integer
+ value. The amount must be at least 0public final void decreaseSuccessorValueCount(int by)+
Node
decreaseSuccessorValueCount
in interface Node<KeyType extends Sequence,ValueType>
by
- The amount, the number of successor should be decreased by, as an Integer
+ value. The amount must be at least 0@Nullable +public final java.util.Map.Entry<KeyType,Node<KeyType,ValueType>> getPredecessor()+
Node
getPredecessor
in interface Node<KeyType extends Sequence,ValueType>
Map.Entry
or null, if
+ no predecessor is setpublic final void setPredecessor(@Nullable + java.util.Map.Entry<KeyType,Node<KeyType,ValueType>> predecessor)+
Node
setPredecessor
in interface Node<KeyType extends Sequence,ValueType>
predecessor
- An entry, which contains the predecessor, which should be set, as well as
+ the key this node is referenced by in the predecessor, as an instance of
+ the type Map.Entry
or null, if no predecessor should be setpublic abstract Node<KeyType,ValueType> clone()+
Node
public int hashCode()+
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)+
equals
in class java.lang.Object
KeyType
- The type of the keys, which are associated with the node's successorsValueType
- The type of the node's valuepublic class HashNode<KeyType extends Sequence,ValueType> +extends AbstractNode<KeyType,ValueType>+
HashMap
.Constructor and Description | +
---|
HashNode()
+Creates a new node of a trie, which stores its successors in a
+HashMap . |
+
Modifier and Type | +Method and Description | +
---|---|
HashNode<KeyType,ValueType> |
+clone()
+Creates and returns a deep copy of the node and its successors.
+ |
+
boolean |
+equals(java.lang.Object obj) |
+
@Nullable Node<KeyType,ValueType> |
+getSuccessor(KeyType key)
+Returns the successor of the node, which corresponds to a specific key.
+ |
+
int |
+getSuccessorCount()
+Returns the number of the node's successors.
+ |
+
int |
+hashCode() |
+
@NotNull java.util.Iterator<KeyType> |
+iterator() |
+
protected @NotNull Node<KeyType,ValueType> |
+onAddSuccessor(KeyType key,
+ @Nullable Node<KeyType,ValueType> successor)
+The method, which is invoked on subclasses in order to add a specific successor to the node.
+ |
+
protected Node<KeyType,ValueType> |
+onRemoveSuccessor(KeyType key)
+The method, which is invoked on subclasses in order to remove a specific successor from the
+ node.
+ |
+
java.lang.String |
+toString() |
+
addSuccessor, cloneSuccessors, decreaseSuccessorValueCount, getNodeValue, getPredecessor, getSuccessorValueCount, increaseSuccessorValueCount, removeSuccessor, setNodeValue, setPredecessor
finalize, getClass, notify, notifyAll, wait, wait, wait
addSuccessor, getFirstSuccessor, getFirstSuccessorKey, getLastSuccessor, getLastSuccessorKey, getSuccessor, getSuccessorKey, getValue, hasSuccessors, indexOf, indexOfFirstElement, isValueSet, removeSuccessor
forEach, spliterator
public HashNode()+
HashMap
.@NotNull +protected final @NotNull Node<KeyType,ValueType> onAddSuccessor(@NotNull + KeyType key, + @Nullable + @Nullable Node<KeyType,ValueType> successor)+
AbstractNode
onAddSuccessor
in class AbstractNode<KeyType extends Sequence,ValueType>
key
- The key, which corresponds to the successor as an instance of the generic
+ type KeyType
. The key may not be nullsuccessor
- The successor, which should be added, as an instance of the type Node
or null, if a new node should be createdNode
. The node may not be nullprotected final Node<KeyType,ValueType> onRemoveSuccessor(@NotNull + KeyType key)+
AbstractNode
onRemoveSuccessor
in class AbstractNode<KeyType extends Sequence,ValueType>
key
- The key, which corresponds to the successor, which should be removed, as an
+ instance of the generic type KeyType
. The key may not be nullNode
or
+ null, if no successor corresponds to the given key@Nullable +public final @Nullable Node<KeyType,ValueType> getSuccessor(@NotNull + KeyType key)+
Node
key
- The key of the successor, which should be returned, as an instance of the generic
+ type KeyType
. The key may not be nullNode
or null, if no successor corresponds to the given keypublic final int getSuccessorCount()+
Node
Integer
value@NotNull +public final @NotNull java.util.Iterator<KeyType> iterator()+
public final HashNode<KeyType,ValueType> clone()+
Node
public final java.lang.String toString()+
toString
in class java.lang.Object
public final int hashCode()+
hashCode
in class AbstractNode<KeyType extends Sequence,ValueType>
public final boolean equals(java.lang.Object obj)+
equals
in class AbstractNode<KeyType extends Sequence,ValueType>
KeyType
- The type of the keys, which are associated with the node's successorsValueType
- The type of the node's valuepublic class SortedListNode<KeyType extends Sequence,ValueType> +extends AbstractNode<KeyType,ValueType> +implements java.util.RandomAccess+
SortedArrayList
.Constructor and Description | +
---|
SortedListNode(@Nullable java.util.Comparator<? super KeyType> comparator)
+Creates a new node of a trie, which stores its successors in a sorted list.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
SortedListNode<KeyType,ValueType> |
+clone()
+Creates and returns a deep copy of the node and its successors.
+ |
+
boolean |
+equals(java.lang.Object obj) |
+
@NotNull Node<KeyType,ValueType> |
+getSuccessor(int index)
+Returns the successor at a specific index.
+ |
+
@Nullable Node<KeyType,ValueType> |
+getSuccessor(KeyType key)
+Returns the successor of the node, which corresponds to a specific key.
+ |
+
int |
+getSuccessorCount()
+Returns the number of the node's successors.
+ |
+
KeyType |
+getSuccessorKey(int index)
+Returns the key, which corresponds to the successor at a specific index.
+ |
+
int |
+hashCode() |
+
int |
+indexOf(KeyType key)
+Returns the index of the successor, which corresponds to a specific key.
+ |
+
int |
+indexOfFirstElement(KeyType key)
+Returns the index of the successor, whose key starts with the first element of another key.
+ |
+
@NotNull java.util.Iterator<KeyType> |
+iterator() |
+
protected @NotNull Node<KeyType,ValueType> |
+onAddSuccessor(KeyType key,
+ @Nullable Node<KeyType,ValueType> successor)
+The method, which is invoked on subclasses in order to add a specific successor to the node.
+ |
+
protected @Nullable Node<KeyType,ValueType> |
+onRemoveSuccessor(KeyType key)
+The method, which is invoked on subclasses in order to remove a specific successor from the
+ node.
+ |
+
void |
+removeSuccessor(int index)
+Removes the successor at a specific index.
+ |
+
java.lang.String |
+toString() |
+
addSuccessor, cloneSuccessors, decreaseSuccessorValueCount, getNodeValue, getPredecessor, getSuccessorValueCount, increaseSuccessorValueCount, removeSuccessor, setNodeValue, setPredecessor
finalize, getClass, notify, notifyAll, wait, wait, wait
addSuccessor, getFirstSuccessor, getFirstSuccessorKey, getLastSuccessor, getLastSuccessorKey, getValue, hasSuccessors, isValueSet
forEach, spliterator
public SortedListNode(@Nullable + @Nullable java.util.Comparator<? super KeyType> comparator)+
comparator
- The comparator, which should be used to compare the successors to each
+ other, as an instance of the type Comparator
or null, if the
+ natural order of the successors' keys should be used@NotNull +protected final @NotNull Node<KeyType,ValueType> onAddSuccessor(@NotNull + KeyType key, + @Nullable + @Nullable Node<KeyType,ValueType> successor)+
AbstractNode
onAddSuccessor
in class AbstractNode<KeyType extends Sequence,ValueType>
key
- The key, which corresponds to the successor as an instance of the generic
+ type KeyType
. The key may not be nullsuccessor
- The successor, which should be added, as an instance of the type Node
or null, if a new node should be createdNode
. The node may not be null@Nullable +protected final @Nullable Node<KeyType,ValueType> onRemoveSuccessor(@NotNull + KeyType key)+
AbstractNode
onRemoveSuccessor
in class AbstractNode<KeyType extends Sequence,ValueType>
key
- The key, which corresponds to the successor, which should be removed, as an
+ instance of the generic type KeyType
. The key may not be nullNode
or
+ null, if no successor corresponds to the given keypublic final int getSuccessorCount()+
Node
getSuccessorCount
in interface Node<KeyType extends Sequence,ValueType>
Integer
value@Nullable +public final @Nullable Node<KeyType,ValueType> getSuccessor(@NotNull + KeyType key)+
Node
getSuccessor
in interface Node<KeyType extends Sequence,ValueType>
key
- The key of the successor, which should be returned, as an instance of the generic
+ type KeyType
. The key may not be nullNode
or null, if no successor corresponds to the given key@NotNull +public final KeyType getSuccessorKey(int index)+
Node
IndexOutOfBoundsException
is thrown. If the node's successor or are not
+ sorted, an UnsupportedOperationException
is thrown.getSuccessorKey
in interface Node<KeyType extends Sequence,ValueType>
index
- The index of the key, which should be returned, as an Integer
valueKeyType
. The key may not be null@NotNull +public final @NotNull Node<KeyType,ValueType> getSuccessor(int index)+
Node
IndexOutOfBoundsException
is thrown. If the node's successors are not sorted, an UnsupportedOperationException
is thrown.public final int indexOf(@NotNull + KeyType key)+
Node
UnsupportedOperationException
is thrown.indexOf
in interface Node<KeyType extends Sequence,ValueType>
key
- The key of the successor, whose index should be returned, as an instance of the
+ type KeyType
. The key may not be nullInteger
+ value or -1, if no such successor is availablepublic final int indexOfFirstElement(@NotNull + KeyType key)+
Node
UnsupportedOperationException
is thrown.indexOfFirstElement
in interface Node<KeyType extends Sequence,ValueType>
key
- The key, whose first element should be searched, as an instance of the generic
+ type KeyType
. The key may not be nullInteger
value or -1, if no such successor is availablepublic final void removeSuccessor(int index)+
Node
IndexOutOfBoundsException
is thrown. If the node's successors are not sorted, an UnsupportedOperationException
is thrown.removeSuccessor
in interface Node<KeyType extends Sequence,ValueType>
index
- The index of the successor, which should be removed, as an Integer
+ value@NotNull +public final @NotNull java.util.Iterator<KeyType> iterator()+ +
public final SortedListNode<KeyType,ValueType> clone()+
Node
public final java.lang.String toString()+
toString
in class java.lang.Object
public final int hashCode()+
hashCode
in class AbstractNode<KeyType extends Sequence,ValueType>
public final boolean equals(java.lang.Object obj)+
equals
in class AbstractNode<KeyType extends Sequence,ValueType>
KeyType
- The type of the sequences, which correspond to the node's successorsValueType
- The type of the node's valuepublic class UnmodifiableNode<KeyType extends Sequence,ValueType> +extends java.lang.Object +implements Node<KeyType,ValueType>+
Node
, which forwards read-only method calls to an
+ encapsulated node and throws UnsupportedOperationException
s when calling a method, which
+ attempts to change the node's state.Constructor and Description | +
---|
UnmodifiableNode(@NotNull Node<KeyType,ValueType> node)
+Creates a new immutable node.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
@NotNull Node<KeyType,ValueType> |
+addSuccessor(KeyType key,
+ @Nullable Node<KeyType,ValueType> successor)
+Adds a specific successor to the node.
+ |
+
Node<KeyType,ValueType> |
+clone()
+Creates and returns a deep copy of the node and its successors.
+ |
+
void |
+decreaseSuccessorValueCount(int by)
+Decreases the number of successors for which values are set by a specific amount.
+ |
+
boolean |
+equals(java.lang.Object obj) |
+
@Nullable NodeValue<ValueType> |
+getNodeValue()
+Returns the value of the node.
+ |
+
java.util.Map.Entry<KeyType,Node<KeyType,ValueType>> |
+getPredecessor()
+Returns the predecessor of the node.
+ |
+
@NotNull Node<KeyType,ValueType> |
+getSuccessor(int index)
+Returns the successor at a specific index.
+ |
+
@Nullable Node<KeyType,ValueType> |
+getSuccessor(KeyType key)
+Returns the successor of the node, which corresponds to a specific key.
+ |
+
int |
+getSuccessorCount()
+Returns the number of the node's successors.
+ |
+
KeyType |
+getSuccessorKey(int index)
+Returns the key, which corresponds to the successor at a specific index.
+ |
+
int |
+getSuccessorValueCount()
+Returns the number of successors for which values are set, i.e.
+ |
+
int |
+hashCode() |
+
void |
+increaseSuccessorValueCount(int by)
+Increases the number of successors for which values are set by a specific amount.
+ |
+
int |
+indexOf(KeyType key)
+Returns the index of the successor, which corresponds to a specific key.
+ |
+
@NotNull java.util.Iterator<KeyType> |
+iterator() |
+
void |
+removeSuccessor(KeyType key)
+Removes the successor, which corresponds to a specific key.
+ |
+
@Nullable NodeValue<ValueType> |
+setNodeValue(@Nullable NodeValue<ValueType> nodeValue)
+Sets the value of the node.
+ |
+
void |
+setPredecessor(java.util.Map.Entry<KeyType,Node<KeyType,ValueType>> predecessor)
+Sets the predecessor of the node.
+ |
+
java.lang.String |
+toString() |
+
finalize, getClass, notify, notifyAll, wait, wait, wait
addSuccessor, getFirstSuccessor, getFirstSuccessorKey, getLastSuccessor, getLastSuccessorKey, getValue, hasSuccessors, indexOfFirstElement, isValueSet, removeSuccessor
forEach, spliterator
@Nullable +public final @Nullable NodeValue<ValueType> getNodeValue()+
Node
@Nullable +public final @Nullable NodeValue<ValueType> setNodeValue(@Nullable + @Nullable NodeValue<ValueType> nodeValue)+
Node
setNodeValue
in interface Node<KeyType extends Sequence,ValueType>
nodeValue
- A wrapper, which encapsulates the value, which should be set, as an instance
+ of the class NodeValue
or null, if the node does not correspond to a
+ key, which has been put into the trieNodeValue
or null,
+ if no value was setpublic final int getSuccessorCount()+
Node
getSuccessorCount
in interface Node<KeyType extends Sequence,ValueType>
Integer
value@Nullable +public final @Nullable Node<KeyType,ValueType> getSuccessor(@NotNull + KeyType key)+
Node
getSuccessor
in interface Node<KeyType extends Sequence,ValueType>
key
- The key of the successor, which should be returned, as an instance of the generic
+ type KeyType
. The key may not be nullNode
or null, if no successor corresponds to the given key@NotNull +public final KeyType getSuccessorKey(int index)+
Node
IndexOutOfBoundsException
is thrown. If the node's successor or are not
+ sorted, an UnsupportedOperationException
is thrown.getSuccessorKey
in interface Node<KeyType extends Sequence,ValueType>
index
- The index of the key, which should be returned, as an Integer
valueKeyType
. The key may not be null@NotNull +public final @NotNull Node<KeyType,ValueType> getSuccessor(int index)+
Node
IndexOutOfBoundsException
is thrown. If the node's successors are not sorted, an UnsupportedOperationException
is thrown.public final int indexOf(@NotNull + KeyType key)+
Node
UnsupportedOperationException
is thrown.indexOf
in interface Node<KeyType extends Sequence,ValueType>
key
- The key of the successor, whose index should be returned, as an instance of the
+ type KeyType
. The key may not be nullInteger
+ value or -1, if no such successor is available@NotNull +public final @NotNull Node<KeyType,ValueType> addSuccessor(@NotNull + KeyType key, + @Nullable + @Nullable Node<KeyType,ValueType> successor)+
Node
addSuccessor
in interface Node<KeyType extends Sequence,ValueType>
key
- The key, which corresponds to the successor to be created, as an instance of
+ the generic type KeyType
. The key may not be nullsuccessor
- The successor, which should be added, as an instance of the type Node
or null, if the successor should be createdNode
. The
+ successor may not be nullpublic final void removeSuccessor(@NotNull + KeyType key)+
Node
removeSuccessor
in interface Node<KeyType extends Sequence,ValueType>
key
- The key, which corresponds to the successor, which should be removed, as an
+ instance of the generic type KeyType
. The key may not be nullpublic final int getSuccessorValueCount()+
Node
Node.isValueSet()
returns
+ true
. All successors of the node are taken into account recursively down to the
+ leaf nodes.getSuccessorValueCount
in interface Node<KeyType extends Sequence,ValueType>
Integer
valuepublic final void increaseSuccessorValueCount(int by)+
Node
increaseSuccessorValueCount
in interface Node<KeyType extends Sequence,ValueType>
by
- The amount, the number of successor should be increased by, as an Integer
+ value. The amount must be at least 0public final void decreaseSuccessorValueCount(int by)+
Node
decreaseSuccessorValueCount
in interface Node<KeyType extends Sequence,ValueType>
by
- The amount, the number of successor should be decreased by, as an Integer
+ value. The amount must be at least 0@Nullable +public final java.util.Map.Entry<KeyType,Node<KeyType,ValueType>> getPredecessor()+
Node
getPredecessor
in interface Node<KeyType extends Sequence,ValueType>
Map.Entry
or null, if
+ no predecessor is setpublic final void setPredecessor(@Nullable + java.util.Map.Entry<KeyType,Node<KeyType,ValueType>> predecessor)+
Node
setPredecessor
in interface Node<KeyType extends Sequence,ValueType>
predecessor
- An entry, which contains the predecessor, which should be set, as well as
+ the key this node is referenced by in the predecessor, as an instance of
+ the type Map.Entry
or null, if no predecessor should be set@NotNull +public final @NotNull java.util.Iterator<KeyType> iterator()+ +
public final Node<KeyType,ValueType> clone()+
Node
public final java.lang.String toString()+
toString
in class java.lang.Object
public final int hashCode()+
hashCode
in class java.lang.Object
public final boolean equals(java.lang.Object obj)+
equals
in class java.lang.Object
Class | +Description | +
---|---|
AbstractNode<KeyType extends Sequence,ValueType> | +
+ An abstract base for all nodes of a trie.
+ |
+
HashNode<KeyType extends Sequence,ValueType> | +
+ A node of a trie, which stores its successors in a
+HashMap . |
+
SortedListNode<KeyType extends Sequence,ValueType> | +
+ A node of a trie, which stores its successors in a
+SortedArrayList . |
+
UnmodifiableNode<KeyType extends Sequence,ValueType> | +
+ An implementation of the interface
+Node , which forwards read-only method calls to an
+ encapsulated node and throws UnsupportedOperationException s when calling a method, which
+ attempts to change the node's state. |
+
Class | +Description | +
---|---|
AbstractEmptyTrie<SequenceType extends Sequence,ValueType> | +
+ An abstract base class for all immutable and empty tries.
+ |
+
AbstractSingletonTrie<SequenceType extends Sequence,ValueType> | +
+ An abstract base class for all immutable tries, which contains only a single entry.
+ |
+
AbstractSortedTrie<SequenceType extends Sequence,ValueType> | +
+ An abstract base class for all sorted tries, whose nodes are ordered by their keys.
+ |
+
AbstractStringTrieWrapper<TrieType extends Trie<StringSequence,ValueType>,ValueType> | +
+ An abstract base class for all wrappers, which implement an interface, which is extended from
+
+StringTrie , by delegating all method calls to an encapsulated trie. |
+
AbstractTrie<StructureType extends Structure<SequenceType,ValueType>,SequenceType extends Sequence,ValueType> | +
+ An abstract base class for all tries.
+ |
+
AbstractTrie.AbstractKeySet<K extends Sequence,MapType extends java.util.Map<K,?>> | +
+ An abstract base class for all key sets as returned by the
+Map.keySet() method. |
+
AbstractTrie.KeySet<K extends Sequence> | +
+ The key set of a trie as returned by the method
+Map.keySet() . |
+
AbstractUnmodifiableStringTrie<ValueType,TrieType extends StringTrie<ValueType>> | +
+ An abstract base class for all string tries, which forward read-only method calls to an
+ encapsulated trie and throw
+UnsupportedOperationException s when calling a method, which
+ attempts to change the trie's state. |
+
AbstractUnmodifiableTrie<SequenceType extends Sequence,ValueType,TrieType extends Trie<SequenceType,ValueType>> | +
+ An abstract base class for all tries, which forward read-only method calls to an encapsulated
+ trie and throw
+UnsupportedOperationException s when calling a method, which attempts to
+ change the trie's state. |
+
EmptySortedTrie<SequenceType extends Sequence,ValueType> | +
+ An unmodifiable and empty sorted trie.
+ |
+
EmptyTrie<SequenceType extends Sequence,ValueType> | +
+ An immutable and empty trie.
+ |
+
SingletonSortedTrie<SequenceType extends Sequence,ValueType> | +
+ An immutable
+SortedTrie , which contains only a single entry. |
+
SingletonTrie<SequenceType extends Sequence,ValueType> | +
+ An immutable
+Trie , which contains only a single entry. |
+
SortedStringTrieWrapper<ValueType> | +
+ A wrapper, which implements the interface
+SortedStringTrie by delegating all method calls
+ to an encapsulated SortedTrie . |
+
SortedStringTrieWrapper.StringSequenceComparatorWrapper | +
+ A comparator, which allows to compare instances of the class
+StringSequence by
+ encapsulating a comparator, which compares String s. |
+
StringNodeWrapper<ValueType> | +
+ An implementation of the interface
+Node , where predecessors correspond to keys of the
+ type String . |
+
StringTrieWrapper<ValueType> | +
+ A wrapper, which implements the interface
+StringTrie by delegating all method calls to an
+ encapsulated Trie . |
+
UnmodifiableSortedStringTrie<ValueType> | +
+ An immutable
+SortedStringTrie . |
+
UnmodifiableSortedTrie<SequenceType extends Sequence,ValueType> | +
+ An immutable
+SortedTrie . |
+
UnmodifiableStringTrie<ValueType> | +
+ An immutable
+StringTrie . |
+
UnmodifiableTrie<SequenceType extends Sequence,ValueType> | +
+ An immutable
+Trie . |
+
Interface | +Description | +
---|---|
Node<KeyType,ValueType> | +
+ Defines the interface, a node of a trie must implement.
+ |
+
Sequence | +
+ Defines the interface, a sequence, which can be used as the keys of a
+Trie or SortedTrie must implement. |
+
SortedStringTrie<ValueType> | +
+ Defines the interface of a sorted trie, which uses character sequences, represented by the class
+
+String , as keys. |
+
SortedTrie<SequenceType extends Sequence,ValueType> | +
+ Defines the interface of a sorted trie.
+ |
+
StringTrie<ValueType> | +
+ Defines the interface of a trie, which allows to use character sequences, represented by the
+ class
+String , as keys. |
+
Trie<SequenceType extends Sequence,ValueType> | +
+ Defines the interface of a trie (also called prefix tree, digital tree or radix tree).
+ |
+
Class | +Description | +
---|---|
HashStringTrie<ValueType> | +
+ An unsorted trie, which uses hash maps for storing the successors of nodes.
+ |
+
HashTrie<SequenceType extends Sequence,ValueType> | +
+ A unsorted trie, which stores the successors of nodes in hash maps.
+ |
+
NodeValue<T> | +
+ A wrapper, which encapsulates the value of a trie's node.
+ |
+
PatriciaStringTrie<ValueType> | +
+ A sorted trie, which stores the successors of nodes in sorted lists.
+ |
+
PatriciaTrie<SequenceType extends Sequence,ValueType> | +
+ A sorted trie, which stores the successor of nodes in sorted lists.
+ |
+
SortedListStringTrie<ValueType> | +
+ A sorted trie, which stores the successors of nodes in sorted lists.
+ |
+
SortedListTrie<SequenceType extends Sequence,ValueType> | +
+ A sorted trie, which stores the successors of nodes in sorted lists.
+ |
+
Tries | +
+ This class consists exclusively of static methods that operate on or return tries.
+ |
+
public class StringSequence +extends java.lang.Object +implements Sequence, java.lang.Comparable<StringSequence>+
String
. It can be used as the keys of a StringTrie
or SortedStringTrie
.Constructor and Description | +
---|
StringSequence(@NotNull java.lang.String string)
+Creates a new character sequence.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
int |
+compareTo(@NotNull StringSequence o) |
+
Sequence |
+concat(@NotNull Sequence sequence)
+Concatenates this sequence with another one.
+ |
+
static @Nullable StringSequence |
+convertFromString(@Nullable java.lang.String string)
+Converts a specific
+String to a string sequence. |
+
static @Nullable java.lang.String |
+convertToString(@Nullable StringSequence stringSequence)
+Converts a specific
+StringSequence to a string. |
+
boolean |
+equals(java.lang.Object obj) |
+
int |
+hashCode() |
+
int |
+length()
+Returns the length of the sequence.
+ |
+
Sequence |
+subsequence(int start,
+ int end)
+Returns a new sequence, which is a subsequence of this sequence.
+ |
+
java.lang.String |
+toString() |
+
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isEmpty, subsequence
public StringSequence(@NotNull + @NotNull java.lang.String string)+
string
- The string, which should back the sequence as a String
. The string may
+ not be null@Nullable +public static @Nullable java.lang.String convertToString(@Nullable + @Nullable StringSequence stringSequence)+
StringSequence
to a string.stringSequence
- The string sequence to convert as an instance of the class StringSequence
or nullString
or null, if the given string
+ sequence is null@Nullable +public static @Nullable StringSequence convertFromString(@Nullable + @Nullable java.lang.String string)+
String
to a string sequence.string
- The string to convert as a String
or nullStringSequence
or null, if the given string is nullpublic final Sequence subsequence(int start, + int end)+
Sequence
subsequence
in interface Sequence
start
- Specifies the index of the first element to be included (inclusive) as an Integer
value. If the index is invalid, an IndexOutOfBoundsException
+ may be thrownend
- Specifies the index of the last element to be included (exclusive) as an Integer
value. If the index is invalid, an IndexOutOfBoundsException
+ may be thrownSequence
. The returned sequence must be a new immutable object
+ and its class must be the same as the class of the original sequencepublic final Sequence concat(@NotNull + @NotNull Sequence sequence)+
Sequence
concat
in interface Sequence
sequence
- The sequence, which should be appended to this sequence as a suffix, as an
+ instance of the type Sequence
. If the given sequence's class is
+ different from this classes' one, a ClassCastException
may be thrownSequence
. The returned sequence must be a new
+ immutable object and its class must be the same as the class of the original sequencepublic final int length()+
Sequence
public final int compareTo(@NotNull + @NotNull StringSequence o)+
compareTo
in interface java.lang.Comparable<StringSequence>
public final java.lang.String toString()+
toString
in class java.lang.Object
public final int hashCode()+
hashCode
in class java.lang.Object
public final boolean equals(java.lang.Object obj)+
equals
in class java.lang.Object
Class | +Description | +
---|---|
StringSequence | +
+ A character sequence, which is backed by a
+String . |
+
SequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic class PatriciaStructure<SequenceType extends Sequence,ValueType> +extends java.lang.Object +implements SortedStructure<SequenceType,ValueType>+
Structure.Operation
Constructor and Description | +
---|
PatriciaStructure() |
+
Modifier and Type | +Method and Description | +
---|---|
@NotNull Node<SequenceType,ValueType> |
+getSubTrie(SequenceType sequence,
+ @NotNull Node<SequenceType,ValueType> rootNode,
+ @NotNull Node<SequenceType,ValueType> node)
+Returns the subtree of the node, which corresponds to a specific sequence (must not
+ necessarily be a key, which is contained by the trie, but can also be a suffix).
+ |
+
@Nullable de.mrapp.util.datastructure.Pair<java.lang.Integer,SequenceType> |
+indexOf(@NotNull Node<SequenceType,ValueType> node,
+ SequenceType sequence)
+The method, which is invoked in order to identify the index of a node's successor, which
+ corresponds to a specific sequence.
+ |
+
@NotNull de.mrapp.util.datastructure.Pair<Node<SequenceType,ValueType>,SequenceType> |
+onAddSuccessor(@NotNull Node<SequenceType,ValueType> node,
+ SequenceType sequence)
+The method, which is invoked in order to add a successor to a specific node.
+ |
+
void |
+onDeletedValue(@NotNull Node<SequenceType,ValueType> node)
+The method, which is invoked on subclasses, when the value of a not was deleted.
+ |
+
@Nullable de.mrapp.util.datastructure.Pair<Node<SequenceType,ValueType>,SequenceType> |
+onGetSuccessor(@NotNull Node<SequenceType,ValueType> node,
+ SequenceType sequence,
+ @NotNull Structure.Operation operation)
+The method, which is invoked in order to retrieve the successor of a specific node, which
+ corresponds to a specific sequence.
+ |
+
void |
+onRemoveSuccessor(@NotNull Node<SequenceType,ValueType> node,
+ SequenceType sequence)
+The method, which is invoked on subclasses in order to remove the successor, which
+ corresponds to a specific sequence, from a specific node.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
@Nullable +public final @Nullable de.mrapp.util.datastructure.Pair<Node<SequenceType,ValueType>,SequenceType> onGetSuccessor(@NotNull + @NotNull Node<SequenceType,ValueType> node, + @NotNull + SequenceType sequence, + @NotNull + @NotNull Structure.Operation operation)+
Structure
onGetSuccessor
in interface Structure<SequenceType extends Sequence,ValueType>
node
- The node, whose successor should be returned, as an instance of the type
+ Node
. The node may not be nullsequence
- The sequence, the successor corresponds to, as an instance of the generic
+ type SequenceType
. The sequence may neither be null, nor emptyoperation
- The operation, the method invocation is part of, as a value of the enum
+ Structure.Operation
. The operation may not be nullPair
or null, if no matching successor is available@NotNull +public final @NotNull de.mrapp.util.datastructure.Pair<Node<SequenceType,ValueType>,SequenceType> onAddSuccessor(@NotNull + @NotNull Node<SequenceType,ValueType> node, + @NotNull + SequenceType sequence)+
Structure
onAddSuccessor
in interface Structure<SequenceType extends Sequence,ValueType>
node
- The node, the successor should be added to, as an instance of the type Node
. The node may not be nullsequence
- The sequence, the successor, which should be added, corresponds to, as an
+ instance of the generic type SequenceType
. The sequence may neither
+ be null, nor emptyPair
. The pair may not be nullpublic final void onRemoveSuccessor(@NotNull + @NotNull Node<SequenceType,ValueType> node, + @NotNull + SequenceType sequence)+
Structure
onRemoveSuccessor
in interface Structure<SequenceType extends Sequence,ValueType>
node
- The node, the successor should be removed from, as an instance of the type
+ Node
. The node may not be nullsequence
- The sequence, the successor, which should be removed, corresponds to, as an
+ instance of the generic type SequenceType
. The sequence may neither
+ be null, nor emptypublic final void onDeletedValue(@NotNull + @NotNull Node<SequenceType,ValueType> node)+
Structure
onDeletedValue
in interface Structure<SequenceType extends Sequence,ValueType>
node
- The node, whose values was deleted, as an instance of the type Node
. The
+ node may not be null@NotNull +public final @NotNull Node<SequenceType,ValueType> getSubTrie(@Nullable + SequenceType sequence, + @NotNull + @NotNull Node<SequenceType,ValueType> rootNode, + @NotNull + @NotNull Node<SequenceType,ValueType> node)+
Structure
getSubTrie
in interface Structure<SequenceType extends Sequence,ValueType>
sequence
- The sequence as an instance of the generic type SequenceType
. The
+ sequence may not be nullrootNode
- The root node of the subtree, which should be returned, as an instance of the
+ type Node
. The root node may not be nullnode
- The node, which corresponds the given sequence as an instance of the type
+ Node
. The node may not be nullNode
. The root node
+ may not be null@Nullable +public final @Nullable de.mrapp.util.datastructure.Pair<java.lang.Integer,SequenceType> indexOf(@NotNull + @NotNull Node<SequenceType,ValueType> node, + @NotNull + SequenceType sequence)+
SortedStructure
indexOf
in interface SortedStructure<SequenceType extends Sequence,ValueType>
node
- The node, whose successors should be checked, as an instance of the type
+ Node
. The node may not be nullsequence
- The sequence, the successor, whose index should be returned, corresponds to,
+ as an Integer
valueInteger
value or -1, if no such successor is available for the given nodeK
- The type of the sequences, which are used as the trie's keysV
- The type of the values, which are stored by the triepublic interface SortedStructure<K extends Sequence,V> +extends Structure<K,V>+
Structure
, this interface also provides a method
+ for retrieving the index of the successor, which corresponds to a specific sequence.Structure.Operation
Modifier and Type | +Method and Description | +
---|---|
@Nullable de.mrapp.util.datastructure.Pair<java.lang.Integer,K> |
+indexOf(@NotNull Node<K,V> node,
+ K sequence)
+The method, which is invoked in order to identify the index of a node's successor, which
+ corresponds to a specific sequence.
+ |
+
getSubTrie, onAddSuccessor, onDeletedValue, onGetSuccessor, onRemoveSuccessor
@Nullable +@Nullable de.mrapp.util.datastructure.Pair<java.lang.Integer,K> indexOf(@NotNull + @NotNull Node<K,V> node, + @NotNull + K sequence)+
node
- The node, whose successors should be checked, as an instance of the type
+ Node
. The node may not be nullsequence
- The sequence, the successor, whose index should be returned, corresponds to,
+ as an Integer
valueInteger
value or -1, if no such successor is available for the given nodepublic static enum Structure.Operation +extends java.lang.Enum<Structure.Operation>+
Enum Constant and Description | +
---|
GET
+An operation, which retrieves data from the trie.
+ |
+
PUT
+An operation, which puts data into the trie.
+ |
+
REMOVE
+An operation, which removes data from the trie.
+ |
+
SUB_TRIE
+An operation, which creates a subtrie of the trie.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
static Structure.Operation |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static Structure.Operation[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final Structure.Operation GET+
public static final Structure.Operation REMOVE+
public static final Structure.Operation PUT+
public static final Structure.Operation SUB_TRIE+
public static Structure.Operation[] values()+
+for (Structure.Operation c : Structure.Operation.values()) + System.out.println(c); +
public static Structure.Operation valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullSequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic interface Structure<SequenceType extends Sequence,ValueType>
+Modifier and Type | +Interface and Description | +
---|---|
static class |
+Structure.Operation
+An enum, which contains all types of operations, which can be performed on a trie.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
@NotNull Node<SequenceType,ValueType> |
+getSubTrie(SequenceType sequence,
+ @NotNull Node<SequenceType,ValueType> rootNode,
+ @NotNull Node<SequenceType,ValueType> node)
+Returns the subtree of the node, which corresponds to a specific sequence (must not
+ necessarily be a key, which is contained by the trie, but can also be a suffix).
+ |
+
@NotNull de.mrapp.util.datastructure.Pair<Node<SequenceType,ValueType>,SequenceType> |
+onAddSuccessor(@NotNull Node<SequenceType,ValueType> node,
+ SequenceType sequence)
+The method, which is invoked in order to add a successor to a specific node.
+ |
+
void |
+onDeletedValue(@NotNull Node<SequenceType,ValueType> node)
+The method, which is invoked on subclasses, when the value of a not was deleted.
+ |
+
@Nullable de.mrapp.util.datastructure.Pair<Node<SequenceType,ValueType>,SequenceType> |
+onGetSuccessor(@NotNull Node<SequenceType,ValueType> node,
+ SequenceType sequence,
+ @NotNull Structure.Operation operation)
+The method, which is invoked in order to retrieve the successor of a specific node, which
+ corresponds to a specific sequence.
+ |
+
void |
+onRemoveSuccessor(@NotNull Node<SequenceType,ValueType> node,
+ SequenceType sequence)
+The method, which is invoked on subclasses in order to remove the successor, which
+ corresponds to a specific sequence, from a specific node.
+ |
+
@Nullable +@Nullable de.mrapp.util.datastructure.Pair<Node<SequenceType,ValueType>,SequenceType> onGetSuccessor(@NotNull + @NotNull Node<SequenceType,ValueType> node, + @NotNull + SequenceType sequence, + @NotNull + @NotNull Structure.Operation operation)+
node
- The node, whose successor should be returned, as an instance of the type
+ Node
. The node may not be nullsequence
- The sequence, the successor corresponds to, as an instance of the generic
+ type SequenceType
. The sequence may neither be null, nor emptyoperation
- The operation, the method invocation is part of, as a value of the enum
+ Structure.Operation
. The operation may not be nullPair
or null, if no matching successor is available@NotNull +@NotNull de.mrapp.util.datastructure.Pair<Node<SequenceType,ValueType>,SequenceType> onAddSuccessor(@NotNull + @NotNull Node<SequenceType,ValueType> node, + @NotNull + SequenceType sequence)+
node
- The node, the successor should be added to, as an instance of the type Node
. The node may not be nullsequence
- The sequence, the successor, which should be added, corresponds to, as an
+ instance of the generic type SequenceType
. The sequence may neither
+ be null, nor emptyPair
. The pair may not be nullvoid onRemoveSuccessor(@NotNull + @NotNull Node<SequenceType,ValueType> node, + @NotNull + SequenceType sequence)+
node
- The node, the successor should be removed from, as an instance of the type
+ Node
. The node may not be nullsequence
- The sequence, the successor, which should be removed, corresponds to, as an
+ instance of the generic type SequenceType
. The sequence may neither
+ be null, nor emptyvoid onDeletedValue(@NotNull + @NotNull Node<SequenceType,ValueType> node)+
node
- The node, whose values was deleted, as an instance of the type Node
. The
+ node may not be null@NotNull +@NotNull Node<SequenceType,ValueType> getSubTrie(@Nullable + SequenceType sequence, + @NotNull + @NotNull Node<SequenceType,ValueType> rootNode, + @NotNull + @NotNull Node<SequenceType,ValueType> node)+
sequence
- The sequence as an instance of the generic type SequenceType
. The
+ sequence may not be nullrootNode
- The root node of the subtree, which should be returned, as an instance of the
+ type Node
. The root node may not be nullnode
- The node, which corresponds the given sequence as an instance of the type
+ Node
. The node may not be nullNode
. The root node
+ may not be nullSequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic class UncompressedSortedStructure<SequenceType extends Sequence,ValueType> +extends UncompressedStructure<SequenceType,ValueType> +implements SortedStructure<SequenceType,ValueType>+
Structure.Operation
Constructor and Description | +
---|
UncompressedSortedStructure() |
+
Modifier and Type | +Method and Description | +
---|---|
@Nullable de.mrapp.util.datastructure.Pair<java.lang.Integer,SequenceType> |
+indexOf(@NotNull Node<SequenceType,ValueType> node,
+ SequenceType sequence)
+The method, which is invoked in order to identify the index of a node's successor, which
+ corresponds to a specific sequence.
+ |
+
getSubTrie, onAddSuccessor, onDeletedValue, onGetSuccessor, onRemoveSuccessor
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSubTrie, onAddSuccessor, onDeletedValue, onGetSuccessor, onRemoveSuccessor
public UncompressedSortedStructure()+
@Nullable +public final @Nullable de.mrapp.util.datastructure.Pair<java.lang.Integer,SequenceType> indexOf(@NotNull + @NotNull Node<SequenceType,ValueType> node, + @NotNull + SequenceType sequence)+
SortedStructure
indexOf
in interface SortedStructure<SequenceType extends Sequence,ValueType>
node
- The node, whose successors should be checked, as an instance of the type
+ Node
. The node may not be nullsequence
- The sequence, the successor, whose index should be returned, corresponds to,
+ as an Integer
valueInteger
value or -1, if no such successor is available for the given nodeSequenceType
- The type of the sequences, which are used as the trie's keysValueType
- The type of the values, which are stored by the triepublic class UncompressedStructure<SequenceType extends Sequence,ValueType> +extends java.lang.Object +implements Structure<SequenceType,ValueType>+
Structure.Operation
Constructor and Description | +
---|
UncompressedStructure() |
+
Modifier and Type | +Method and Description | +
---|---|
@NotNull Node<SequenceType,ValueType> |
+getSubTrie(SequenceType sequence,
+ @NotNull Node<SequenceType,ValueType> rootNode,
+ @NotNull Node<SequenceType,ValueType> node)
+Returns the subtree of the node, which corresponds to a specific sequence (must not
+ necessarily be a key, which is contained by the trie, but can also be a suffix).
+ |
+
@NotNull de.mrapp.util.datastructure.Pair<Node<SequenceType,ValueType>,SequenceType> |
+onAddSuccessor(@NotNull Node<SequenceType,ValueType> node,
+ SequenceType sequence)
+The method, which is invoked in order to add a successor to a specific node.
+ |
+
void |
+onDeletedValue(@NotNull Node<SequenceType,ValueType> node)
+The method, which is invoked on subclasses, when the value of a not was deleted.
+ |
+
@Nullable de.mrapp.util.datastructure.Pair<Node<SequenceType,ValueType>,SequenceType> |
+onGetSuccessor(@NotNull Node<SequenceType,ValueType> node,
+ SequenceType sequence,
+ @NotNull Structure.Operation operation)
+The method, which is invoked in order to retrieve the successor of a specific node, which
+ corresponds to a specific sequence.
+ |
+
void |
+onRemoveSuccessor(@NotNull Node<SequenceType,ValueType> node,
+ SequenceType sequence)
+The method, which is invoked on subclasses in order to remove the successor, which
+ corresponds to a specific sequence, from a specific node.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
@Nullable +public final @Nullable de.mrapp.util.datastructure.Pair<Node<SequenceType,ValueType>,SequenceType> onGetSuccessor(@NotNull + @NotNull Node<SequenceType,ValueType> node, + @NotNull + SequenceType sequence, + @NotNull + @NotNull Structure.Operation operation)+
Structure
onGetSuccessor
in interface Structure<SequenceType extends Sequence,ValueType>
node
- The node, whose successor should be returned, as an instance of the type
+ Node
. The node may not be nullsequence
- The sequence, the successor corresponds to, as an instance of the generic
+ type SequenceType
. The sequence may neither be null, nor emptyoperation
- The operation, the method invocation is part of, as a value of the enum
+ Structure.Operation
. The operation may not be nullPair
or null, if no matching successor is available@NotNull +public final @NotNull de.mrapp.util.datastructure.Pair<Node<SequenceType,ValueType>,SequenceType> onAddSuccessor(@NotNull + @NotNull Node<SequenceType,ValueType> node, + @NotNull + SequenceType sequence)+
Structure
onAddSuccessor
in interface Structure<SequenceType extends Sequence,ValueType>
node
- The node, the successor should be added to, as an instance of the type Node
. The node may not be nullsequence
- The sequence, the successor, which should be added, corresponds to, as an
+ instance of the generic type SequenceType
. The sequence may neither
+ be null, nor emptyPair
. The pair may not be nullpublic final void onRemoveSuccessor(@NotNull + @NotNull Node<SequenceType,ValueType> node, + @NotNull + SequenceType sequence)+
Structure
onRemoveSuccessor
in interface Structure<SequenceType extends Sequence,ValueType>
node
- The node, the successor should be removed from, as an instance of the type
+ Node
. The node may not be nullsequence
- The sequence, the successor, which should be removed, corresponds to, as an
+ instance of the generic type SequenceType
. The sequence may neither
+ be null, nor emptypublic final void onDeletedValue(@NotNull + @NotNull Node<SequenceType,ValueType> node)+
Structure
onDeletedValue
in interface Structure<SequenceType extends Sequence,ValueType>
node
- The node, whose values was deleted, as an instance of the type Node
. The
+ node may not be null@NotNull +public final @NotNull Node<SequenceType,ValueType> getSubTrie(@Nullable + SequenceType sequence, + @NotNull + @NotNull Node<SequenceType,ValueType> rootNode, + @NotNull + @NotNull Node<SequenceType,ValueType> node)+
Structure
getSubTrie
in interface Structure<SequenceType extends Sequence,ValueType>
sequence
- The sequence as an instance of the generic type SequenceType
. The
+ sequence may not be nullrootNode
- The root node of the subtree, which should be returned, as an instance of the
+ type Node
. The root node may not be nullnode
- The node, which corresponds the given sequence as an instance of the type
+ Node
. The node may not be nullNode
. The root node
+ may not be nullInterface | +Description | +
---|---|
SortedStructure<K extends Sequence,V> | +
+ Defines the interface, a class, which defines the structure of a sorted trie, must implement.
+ |
+
Structure<SequenceType extends Sequence,ValueType> | +
+ Defines the interface, a class, which defines the structure of a trie, must implement.
+ |
+
Class | +Description | +
---|---|
PatriciaStructure<SequenceType extends Sequence,ValueType> | +
+ Defines the structure of a Patricia trie, where the edges between nodes do not always correspond
+ to a single element of a sequence.
+ |
+
UncompressedSortedStructure<SequenceType extends Sequence,ValueType> | +
+ Defines the structure of an uncompressed sorted trie, where the edges between nodes always
+ correspond to exactly one element of a sequence.
+ |
+
UncompressedStructure<SequenceType extends Sequence,ValueType> | +
+ Defines the structure of an uncompressed trie, where the edges between nodes always correspond to
+ exactly one element of a sequence.
+ |
+
Enum | +Description | +
---|---|
Structure.Operation | +
+ An enum, which contains all types of operations, which can be performed on a trie.
+ |
+
public final class EntryUtil
+extends java.lang.Object
+Map.Entry
.Modifier and Type | +Method and Description | +
---|---|
static <K> K |
+getKey(java.util.Map.Entry<K,?> entry)
+Returns the key of a specific entry or null, if the entry is null.
+ |
+
static <K> K |
+getKeyOrThrowException(java.util.Map.Entry<K,?> entry)
+Returns the key of a specific entry or throws a
+NoSuchElementException , if the entry
+ is null. |
+
static boolean |
+isEqual(@Nullable java.lang.Object o1,
+ @Nullable java.lang.Object o2)
+Returns, whether two objects are equal, or not.
+ |
+
static boolean |
+isValueEqual(@NotNull Node<?,?> node,
+ java.util.Map.Entry<?,?> entry)
+Returns, whether the values of a specific node and entry are equal, or not.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static boolean isValueEqual(@NotNull + @NotNull Node<?,?> node, + @NotNull + java.util.Map.Entry<?,?> entry)+
node
- The node as an instance of the type Node
. The node may not be nullentry
- The entry as an instance of the type Map.Entry
. The entry may not be
+ nullpublic static boolean isEqual(@Nullable + @Nullable java.lang.Object o1, + @Nullable + @Nullable java.lang.Object o2)+
o1
- The first object as an instance of the class Object
or nullo2
- The second object as an instance of the class Object
or null@Nullable +public static <K> K getKey(@Nullable + java.util.Map.Entry<K,?> entry)+
K
- The type of the entry's keyentry
- The entry, whose key should be returned, as an instance of the type Map.Entry
or nullK
or null, if
+ the key or the given entry is null@Nullable +public static <K> K getKeyOrThrowException(@Nullable + java.util.Map.Entry<K,?> entry)+
NoSuchElementException
, if the entry
+ is null.K
- The type of the entry's keyentry
- The entry, whose key should be returned, as an instance of the type Map.Entry
or nullK
or null, if
+ the key is nullpublic class SequenceUtil
+extends java.lang.Object
+Modifier and Type | +Method and Description | +
---|---|
static <T extends Sequence> |
+binarySearch(int size,
+ @NotNull java.util.function.Function<java.lang.Integer,T> getter,
+ @Nullable java.util.Comparator<? super T> comparator,
+ T sequence)
+Performs a binary search to find a specific sequence.
+ |
+
static <T extends Sequence> |
+comparator(@Nullable java.util.Comparator<? super T> comparator)
+Creates and returns a comparator, which allows to compare sequences.
+ |
+
static <T extends Sequence> |
+concat(T prefix,
+ T suffix)
+Concatenates two sequences.
+ |
+
static <T extends Sequence> |
+getCommonPrefix(T sequence1,
+ T sequence2)
+Returns the longest common prefix of two sequences.
+ |
+
static boolean |
+isEmpty(@Nullable Sequence sequence)
+Returns, whether a specific sequence is null or empty.
+ |
+
static <T extends Sequence> |
+subsequence(T sequence,
+ int start)
+Returns a subsequence of a specific sequence, starting at a specific index and spanning to
+ the end.
+ |
+
static <T extends Sequence> |
+subsequence(T sequence,
+ int start,
+ int end)
+Returns a subsequence of a specific sequence, starting at a specific index and spanning to an
+ end index.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static boolean isEmpty(@Nullable + @Nullable Sequence sequence)+
sequence
- The sequence, which should be checked, as an instance of the type Sequence
or null@NotNull +public static <T extends Sequence> T subsequence(@NotNull + T sequence, + int start)+
IndexOutOfBoundsException
will be
+ thrown.T
- The type of the sequencesequence
- The sequence as an instance of the generic type T
. The sequence may
+ not be nullstart
- The start index (inclusive) of the subsequence to return as an Integer
valueT
.
+ The subsequence may not be null@NotNull +public static <T extends Sequence> T subsequence(@NotNull + T sequence, + int start, + int end)+
IndexOutOfBoundsException
+ will be thrown.T
- The type of the sequencesequence
- The sequence as an instance of the generic type T
. The sequence may
+ not be nullstart
- The start index (inclusive) of the subsequence to return as an Integer
valueend
- The end index (exclusive) of the subsequence to return as an Integer
+ valueT
.
+ The subsequence may not be nullpublic static <T extends Sequence> T concat(@Nullable + T prefix, + @Nullable + T suffix)+
T
- The type of the sequencesprefix
- The first sequence as an instance of the generic type T
suffix
- The second sequence to be appended to the first one as an instance of the
+ generic type T
T
or null, if
+ both of the given sequences are null@NotNull +public static <T extends Sequence> @NotNull java.util.Comparator<? super T> comparator(@Nullable + @Nullable java.util.Comparator<? super T> comparator)+
T
- The type of the sequencescomparator
- The comparator, which should be used to compare the sequences, as an
+ instance of the type Comparator
or null, if the natural order
+ should be usedComparator
. The comparator may not be null@Nullable +public static <T extends Sequence> T getCommonPrefix(@NotNull + T sequence1, + @NotNull + T sequence2)+
T
- The type of the sequencessequence1
- The first sequence as an instance of the generic type T
. The
+ sequence may not be nullsequence2
- The second sequence as an instance of the generic type T
. The
+ sequence may not be nullT
or null, if the sequences do not have a common prefixpublic static <T extends Sequence> int binarySearch(int size, + @NotNull + @NotNull java.util.function.Function<java.lang.Integer,T> getter, + @Nullable + @Nullable java.util.Comparator<? super T> comparator, + @NotNull + T sequence)+
T
- The type of the sequencessize
- The total number of sequences as an Integer
valuegetter
- A function, which returns the corresponding sequence for a given index, as
+ an instance of the type Function
. The function may not be nullcomparator
- A comparator, which allows to compare sequences to each other, as an
+ instance of the type Comparator
or null, if the natural order of
+ the sequences should be usedsequence
- The sequence to search for as an instance of the generic type T
.
+ The sequence may not be nullInteger
value or -1, if the sequence
+ could not be foundClass | +Description | +
---|---|
EntryUtil | +
+ An utility class, which provides static methods for handling instances of the type
+Map.Entry . |
+
SequenceUtil | +
+ An utility class, which provides methods for handling sequences.
+ |
+
The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.
+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+Each annotation type has its own separate page with the following sections:
+Each enum has its own separate page with the following sections:
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object
. The interfaces do not inherit from java.lang.Object
.
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+These links take you to the next or previous class, interface, package, or related page.
+These links show and hide the HTML frames. All pages are available with or without frames.
+The All Classes link shows all classes and interfaces except non-static nested types.
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+The Constant Field Values page lists the static final fields and their values.
+StringTrie
, by delegating all method calls to an encapsulated trie.Map.keySet()
method.Map.keySet()
.UnsupportedOperationException
s when calling a method, which
+ attempts to change the trie's state.UnsupportedOperationException
s when calling a method, which attempts to
+ change the trie's state.Trie
or SortedTrie
must implement.SortedStringTrie
, which only contains a single entry.SortedTrie
, which contains only a single entry.SortedTrie
, which only contains a single entry.SortedTrie
, which only contains a single entry.StringTrie
, which only contains a single entry.Trie
, which contains only a single entry.Trie
, which only contains a single entry.Trie
, which only contains a single entry.SortedArrayList
.String
, as keys.SortedStringTrie
by delegating all method calls
+ to an encapsulated SortedTrie
.SortedStringTrie
.StringSequence
by
+ encapsulating a comparator, which compares String
s.Node
, where predecessors correspond to keys of the
+ type String
.Node
, where predecessors correspond to
+ keys of the type String
.String
.StringSequence
by encapsulating a comparator, which compares String
s.String
, as keys.StringTrie
by delegating all method calls to an
+ encapsulated Trie
.StringTrie
.Structure
, which defines the structure of the
+ trie.Node
, which forwards read-only method calls to an
+ encapsulated node and throws UnsupportedOperationException
s when calling a method, which
+ attempts to change the node's state.SortedStringTrie
.SortedStringTrie
.SortedTrie
.SortedTrie
.SortedTrie
.StringTrie
.StringTrie
.StringTrie
.Trie
.Trie
.Trie
.String
to a string sequence.StringSequence
to a string.Structure
, which defines the structure of the trie.SortedStringTrie
(immutable).SortedTrie
(immutable).StringTrie
(immutable).Trie
(immutable).SortedStringTrie
(immutable).SortedTrie
(immutable).StringTrie
(immutable).Trie
(immutable).Map.Entry
.NoSuchElementException
, if the entry
+ is null.HashMap
.HashMap
.+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100644 index 0000000..1bd66df --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,153 @@ + + + + + +
Package | +Description | +
---|---|
de.mrapp.tries | ++ |
de.mrapp.tries.datastructure | ++ |
de.mrapp.tries.datastructure.node | ++ |
de.mrapp.tries.sequence | ++ |
de.mrapp.tries.structure | ++ |
de.mrapp.tries.util | ++ |
java.lang.Object value+
java.util.Comparator<T> comparator+
Trie<SequenceType extends Sequence,ValueType> trie+
Structure<SequenceType extends Sequence,ValueType> structure+
Structure
, which defines the structure of the
+ trie.Node<KeyType,ValueType> rootNode+
long modificationCount+
ConcurrentModificationException
.java.util.Collection<E> values+
AbstractTrie.values()
).java.util.Set<E> keySet+
AbstractTrie.keySet()
).java.util.Set<E> entrySet+
AbstractTrie.entrySet()
).StringTrie<ValueType> trie+
Trie<SequenceType extends Sequence,ValueType> trie+
java.util.Comparator<T> comparator+
java.util.Map<K,V> successors+
de.mrapp.util.datastructure.SortedArrayList<T> successors+
java.util.Comparator<T> comparator+
java.lang.String string+
* Implementations of this class must be immutable, i.e. the {@link #concat(Sequence)} and {@link
* #subsequence(int, int)} methods must return a new object instead of modifying the original one.
- * Furthermore, the {@link #hashCode()} and {@link #equals(Object)} methods must be overridden by
- * implementing classes. If an implementation of this interface should be used together with a
- * {@link SortedTrie}, without requiring to pass a {@link java.util.Comparator} to the trie, the
- * sequence must also implement the interface {@link Comparable}.
+ * Furthermore, the {@link Object#hashCode()} and {@link Object#equals(Object)} methods must be
+ * overridden by implementing classes. If an implementation of this interface should be used
+ * together with a {@link SortedTrie}, without requiring to pass a {@link java.util.Comparator} to
+ * the trie, the sequence must also implement the interface {@link Comparable}.
*
* @author Michael Rapp
* @since 1.0.0
diff --git a/src/main/java/de/mrapp/tries/SortedListTrie.java b/src/main/java/de/mrapp/tries/SortedListTrie.java
index 558ad5c..1b5fd2d 100644
--- a/src/main/java/de/mrapp/tries/SortedListTrie.java
+++ b/src/main/java/de/mrapp/tries/SortedListTrie.java
@@ -13,8 +13,10 @@
*/
package de.mrapp.tries;
-import de.mrapp.tries.datastructure.*;
-import de.mrapp.util.datastructure.Pair;
+import de.mrapp.tries.datastructure.AbstractSortedTrie;
+import de.mrapp.tries.datastructure.node.SortedListNode;
+import de.mrapp.tries.structure.SortedStructure;
+import de.mrapp.tries.structure.UncompressedSortedStructure;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -53,7 +55,7 @@ public class SortedListTrie
* The nodes of the returned trie are deep copies of those of the original trie. Therefore the
* returned trie is fully functional and can be modified without affecting the original trie.
*
- * @param sequence The sequence as an instance of the generic type {@link SequenceType}. The
- * sequence may not be null
+ * @param sequence The sequence as an instance of the generic type {@link SequenceType}
* @return The subtree of the node, which corresponds to the given sequence, as an instance of
* the type {@link Trie}. The subtree may not be null
*/
- @NotNull
- Trie