diff --git a/README.md b/README.md new file mode 100644 index 0000000..dbca9c6 --- /dev/null +++ b/README.md @@ -0,0 +1,153 @@ +# Tries - README + +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=X75YSLEJV3DWE) + +This is a Java library, which provides different implementations of "Tries" (also referred to as "prefix trees", "digital trees" or "radix trees"). Tries are data structures that can be used to store associative arrays where the keys are sequences (e.g. sequences of characters or digits). Tries allow to efficiently search for sequences (and their associated values) that share a common prefix. + +The library currently provides the following features: + +* Provides an unsorted trie implementation, which stores successors of nodes in hash maps (`HashTrie`). +* Provides a sorted trie implementation, which stores successors of nodes in sorted lists (`SortedListTrie`). +* Provides a Patricia trie implementation (`PatriciaTrie`). +* For each available trie implementation a dedicated variant for using character sequences as keys is available. +* The utility class `Tries` allows to create empty, singleton and unmodifiable instances of all available trie implementations. + +## License Agreement + +This project is distributed under the Apache License version 2.0. For further information about this license agreement's content please refer to its full version, which is available at http://www.apache.org/licenses/LICENSE-2.0.txt. + +## Download + +The latest release of this library can be downloaded as a zip archive from the download section of the project's Github page, which is available [here](https://github.com/michael-rapp/Tries/releases). Furthermore, the library's source code is available as a Git repository, which can be cloned using the URL https://github.com/michael-rapp/Tries.git. + +Alternatively, the library can be added to your project as a Gradle dependency by adding the following dependency to the `build.gradle` file: + +```groovy +dependencies { + compile 'com.github.michael-rapp:tries:1.0.0' +} +``` + +When using Maven, the following dependency can be added to the `pom.xml`: + +```xml + + com.github.michael-rapp + tries + 1.0.0 + +``` + +## Tries + +The image below illustrates the structure of an (unsorted) trie. The following key-value pairs (where the keys are character sequences and the values are integers) are stored by the trie: + +``` +A -> 21 +to -> 7 +tea -> 13 +ted -> 8 +ten -> 9 +in -> 14 +inn -> 16 +``` + +![](/doc/images/trie_example.png) + +As the given example illustrates, all leaf nodes of a trie are associated with values (highlighted in blue). In addition, some of the inner nodes may also correspond to values. The predecessors of a node specify the sequence it corresponds to. E.g. the node that corresponds to the key "tea" has the predecessors t -> e -> a. The root node corresponds to an empty sequence. Because nodes with a common prefix share the same predecessors, tries provide some kind of compression. + +Most importantly, this library provides two interfaces - `Trie` and `SortedTrie`. The first of both interfaces extends the interface `java.util.Map`, whereas the latter extends the interface `java.util.NavigableMap`. Similar to the map implementations the Java SDK provides, key-value pairs can be added to a trie using the `put`-method. For retrieving values by their key, the `get`-method can be used. Whereas the order of keys is not taken into account by unsorted tries, when iterating a sorted trie, the order of the keys preserved. The following table provides an overview of the different implementations of the interfaces `Trie` and `SortedTrie`: + +| Interface | Implementations | Description | +|----------------------------------------|-------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `Trie` | `HashTrie` | An unsorted trie, which stores the successors of nodes in hash maps. This enables to lookup keys with linear complexity. | +| `StringTrie` | `HashStringTrie` | The pendant of the class `HashTrie` for using character sequences, i.e. Strings, as keys. | +| `SortedTrie` | `SortedListTrie` | A sorted trie, which stores the successors of nodes in sorted lists. As binary searches are used to search for successors, looking up keys comes at logarithmic costs. | +| | `PatriciaTrie` | A sorted trie similar to a `SortedListTrie`, where edges between nodes do not always correspond to a single element. Subsequent nodes with a single successor are merged to a single node. | +| `SortedStringTrie` | `SortedListStringTrie` | The pendant of the class `SortedListTrie` for using character sequences, i.e. Strings, as keys. | +| | `PatriciaStringTrie` | The pendant of the class `PatriciaTrie` for using character sequences, i.e. Strings, as keys. | + +Whereas the values of a trie can be of an arbitrary type (referred to as the generic type `ValueType`), the type of the keys (referred to as `SequenceType`) must implement the interface `Sequence`. The tries for storing character sequences internally use the class `StringSequence`, which implements that interface. The following example illustrates how key-value pairs can be added and looked up using a generic `HashTrie`. + +```java +Trie trie = new HashTrie<>(); +trie.put(new StringSequence("A"), 21); +trie.put(new StringSequence("to"), 7); +// ... +int value = trie.get(new StringSequence("to")); +``` + +Using a `StringTrie` instead of a `Trie` simplifies the handling of keys: + +```java +StringTrie trie = new HashStringTrie<>(); +trie.put("A", 21); +trie.put("to", 7); +// ... +int value = trie.get("to"); +``` + +The nodes of a trie are implemented as classes implementing the interface `Node`. If necessary, the root node of a trie can be retrieved by using the `getRootNode`-method. Although the returned node may not be modified, this enables to traverse the tree structure of the trie: + +```java +Node rootNode = trie.getRootNode(); + +if (rootNode.hasSuccessors()) { + for (StringSequence successorKey : rootNote) + Node successor = rootNode.getSuccessor(successorKey); + // ... + } +} +``` + +The interfaces [`Map`](https://docs.oracle.com/javase/8/docs/api/java/util/Map.html), respectively [`NavigableMap`](https://docs.oracle.com/javase/8/docs/api/java/util/NavigableMap.html), which are extends by the interfaces `Trie` and `SortedTrie` provide various methods for modifying a trie or retrieving its key or values. For a more detailed documentation of these interfaces, please refer to their API documentation. In addition to the methods, which are provides by these interfaces, each trie provides a `subTrie`-method. It enables to create a new trie from an existing one, which will only contain a subset of the original key-value pairs. In the example below, the resulting sub trie only contains keys that start with the element "t". + +```java +Trie subTrie = trie.subTrie(new StringSequence("t")); +``` + +## Patricia Tries + +Patricia tries use a structure, which is optimized in terms of the required space. Unlike a `HashTrie` or a `SortedListTrie`, the edges between a `PatriciaTrie`'s nodes do not always correspond to a single element. Instead, subsequent nodes that only have a single successor are merged into a single node to reduce space complexity. As this requires to reorganize the tree structure when inserting or removing elements, patricia tries should be preferred over a `SortedListTrie` if elements are only added or removed sporadically and optimizing memory consumption is important. + +The image below illustrates the structure of a Patricia trie, which contains the following key value-pairs. + +``` +roman -> 7 +romane -> 13 +romanus -> 8 +romulus -> 9 +ruber -> 17 +rubicon -> 14 +``` + +![](/doc/images/patricia_trie_example.png) + +## Utility methods + +Similar to the Java SDK's class `java.util.Collections`, the class `Tries` provides various static utility methods regarding tries. By using the following methods, empty and unmodifiable trie can be created: + +```java +Trie trie = Tries.emptyTrie(); +StringTrie stringTrie = Tries.emptyStringTrie(); +SortedTrie sortedTrie = Tries.emptySortedTrie(); +SortedStringTrie sortedStringTrie = Tries.emptySortedStringTrie(); +``` + +Furthermore, the class `Tries` provides the following methods to create unmodifiable tries that consist of a single entry: + +```java +Trie trie = Tries.singletonTrie(key, value); +StringTrie stringTrie = Tries.singletonStringTrie(key, value); +SortedTrie sortedTrie = Tries.singletonSortedTrie(key, value); +SortedStringTrie sortedStringTrie = Tries.singletonSortedStringTrie(key, value); +``` + +In order to create an unmodifiable instance of an existing trie, the following utility methods can be used. This enables to return a trie from an API, which only provides read-only access to some data. + +```java +Trie unmodifiableTrie = Trie.unmodifiableTrie(trie); +StringTrie unmodifiableStringTrie = Trie.unmodifiableStringTrie(stringTrie); +SortedTrie unmodifiableSortedTrie = Trie.unmodifiableSortedTrie(sortedTrie); +SortedStringTrie unmodifiableSortedStringTrie = Trie.unmodifiableSortedStringTrie(sortedStringTrie); +``` \ No newline at end of file diff --git a/assets/patricia_trie_example.odg b/assets/patricia_trie_example.odg new file mode 100644 index 0000000..fb04f41 Binary files /dev/null and b/assets/patricia_trie_example.odg differ diff --git a/assets/trie_example.odg b/assets/trie_example.odg new file mode 100644 index 0000000..31d02dc Binary files /dev/null and b/assets/trie_example.odg differ diff --git a/doc/images/patricia_trie_example.png b/doc/images/patricia_trie_example.png new file mode 100644 index 0000000..fec576f Binary files /dev/null and b/doc/images/patricia_trie_example.png differ diff --git a/doc/images/trie_example.png b/doc/images/trie_example.png new file mode 100644 index 0000000..eb9ce9a Binary files /dev/null and b/doc/images/trie_example.png differ diff --git a/doc/javadoc/allclasses-frame.html b/doc/javadoc/allclasses-frame.html new file mode 100644 index 0000000..00a7d46 --- /dev/null +++ b/doc/javadoc/allclasses-frame.html @@ -0,0 +1,66 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/allclasses-noframe.html b/doc/javadoc/allclasses-noframe.html new file mode 100644 index 0000000..422da5e --- /dev/null +++ b/doc/javadoc/allclasses-noframe.html @@ -0,0 +1,66 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/doc/javadoc/constant-values.html b/doc/javadoc/constant-values.html new file mode 100644 index 0000000..7d0b856 --- /dev/null +++ b/doc/javadoc/constant-values.html @@ -0,0 +1,122 @@ + + + + + +Constant Field Values + + + + + + + + + + + +
+

Constant Field Values

+

Contents

+
+ + + + + + diff --git a/doc/javadoc/de/mrapp/tries/HashStringTrie.html b/doc/javadoc/de/mrapp/tries/HashStringTrie.html new file mode 100644 index 0000000..308124d --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/HashStringTrie.html @@ -0,0 +1,364 @@ + + + + + +HashStringTrie + + + + + + + + + + + + +
+
de.mrapp.tries
+

Class HashStringTrie<ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    StringTrie<ValueType>, java.io.Serializable, java.util.Map<java.lang.String,ValueType>
    +
    +
    +
    +
    public class HashStringTrie<ValueType>
    +extends StringTrieWrapper<ValueType>
    +
    An unsorted trie, which uses hash maps for storing the successors of nodes. It is the pendant of + the class 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.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from interface java.util.Map

        +java.util.Map.Entry<K,V>
      • +
      +
    • +
    + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      HashStringTrie() +
      Creates a new empty, unsorted trie for storing character sequences, which uses hash maps for + storing the successors of nodes.
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HashStringTrie

        +
        public HashStringTrie()
        +
        Creates a new empty, unsorted trie for storing character sequences, which uses hash maps for + storing the successors of nodes.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        toString

        +
        public final java.lang.String toString()
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/HashTrie.html b/doc/javadoc/de/mrapp/tries/HashTrie.html new file mode 100644 index 0000000..e4526e2 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/HashTrie.html @@ -0,0 +1,461 @@ + + + + + +HashTrie + + + + + + + + + + + + +
+
de.mrapp.tries
+

Class HashTrie<SequenceType extends Sequence,ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    Trie<SequenceType,ValueType>, java.io.Serializable, java.util.Map<SequenceType,ValueType>
    +
    +
    +
    +
    public class HashTrie<SequenceType extends Sequence,ValueType>
    +extends AbstractTrie<Structure<SequenceType,ValueType>,SequenceType,ValueType>
    +
    A unsorted trie, which stores the successors of nodes in hash maps. The edges between nodes + always correspond to exactly one element of a sequence. Therefore, even if a subsequence of + length n is not shared between multiple keys, the trie contains n nodes to store that + subsequence. As the used hash maps enable to lookup successors in constant time, this + implementation should be preferred over SortedListTrie, if the order of keys is + irrelevant.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HashTrie

        +
        public HashTrie()
        +
        Creates a new empty, unsorted trie, which stores the successors of nodes in hash maps.
        +
      • +
      + + + +
        +
      • +

        HashTrie

        +
        public HashTrie(@NotNull
        +                @NotNull java.util.Map<SequenceType,ValueType> map)
        +
        Creates a new unsorted trie, which contains all key-value pairs that are contained by a map.
        +
        +
        Parameters:
        +
        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
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + + + + + + + +
        +
      • +

        subTrie

        +
        @NotNull
        +public @NotNull HashTrie<SequenceType,ValueType> subTrie(@Nullable
        +                                                                  SequenceType sequence)
        +
        Description copied from interface: Trie
        +
        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). If the given + sequence corresponds to a key, the key is not included in the subtree. If the given sequence + is not contained by the trie, a 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.

        +
        +
        Parameters:
        +
        sequence - The sequence as an instance of the generic type SequenceType
        +
        Returns:
        +
        The subtree of the node, which corresponds to the given sequence, as an instance of + the type Trie. The subtree may not be null
        +
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public final java.lang.String toString()
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/Node.html b/doc/javadoc/de/mrapp/tries/Node.html new file mode 100644 index 0000000..decfd56 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/Node.html @@ -0,0 +1,826 @@ + + + + + +Node + + + + + + + + + + + + +
+
de.mrapp.tries
+

Interface Node<KeyType,ValueType>

+
+
+
+
    +
  • +
    +
    Type Parameters:
    +
    KeyType - The type of the keys, which are associated with the node's successors
    +
    ValueType - The type of the node's value
    +
    +
    +
    All Superinterfaces:
    +
    java.lang.Cloneable, java.lang.Iterable<KeyType>, java.io.Serializable
    +
    +
    +
    All Known Implementing Classes:
    +
    AbstractNode, HashNode, SortedListNode, StringNodeWrapper, UnmodifiableNode
    +
    +
    +
    +
    public interface Node<KeyType,ValueType>
    +extends java.lang.Iterable<KeyType>, java.io.Serializable, java.lang.Cloneable
    +
    Defines the interface, a node of a trie must implement. It extends the interface 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.

    +
    +
    Since:
    +
    1.0.0
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getNodeValue

        +
        @Nullable
        +@Nullable NodeValue<ValueType> getNodeValue()
        +
        Returns the value of the node.
        +
        +
        Returns:
        +
        The value of the node encapsulated by a NodeValue wrapper or null, if the + node does not correspond to a key, which has been put into the trie
        +
        +
      • +
      + + + +
        +
      • +

        setNodeValue

        +
        @Nullable
        +@Nullable NodeValue<ValueType> setNodeValue(@Nullable
        +                                                      @Nullable NodeValue<ValueType> nodeValue)
        +
        Sets the value of the node.
        +
        +
        Parameters:
        +
        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 trie
        +
        Returns:
        +
        The previous value of the node as an instance of the class NodeValue or null, + if no value was set
        +
        +
      • +
      + + + +
        +
      • +

        getValue

        +
        default ValueType getValue()
        +
        Returns the unboxed value of the node, i.e. null, if getNodeValue() returns null, or + the encapsulated value of the returned NodeValue otherwise.
        +
        +
        Returns:
        +
        The unboxed value of the node as an instance of the generic type ValueType
        +
        +
      • +
      + + + +
        +
      • +

        isValueSet

        +
        default boolean isValueSet()
        +
        Returns, whether a value is set for the node, or not. If a value is set, the node corresponds + to a key, which has been put into the trie.
        +
        +
        Returns:
        +
        True, if a value is set for the node, false otherwise
        +
        +
      • +
      + + + +
        +
      • +

        getSuccessorCount

        +
        int getSuccessorCount()
        +
        Returns the number of the node's successors.
        +
        +
        Returns:
        +
        The number of the node's successor as an Integer value
        +
        +
      • +
      + + + +
        +
      • +

        hasSuccessors

        +
        default boolean hasSuccessors()
        +
        Returns, whether the node has successors, or not.
        +
        +
        Returns:
        +
        True, if the node has successors, false otherwise
        +
        +
      • +
      + + + + + +
        +
      • +

        getSuccessor

        +
        @Nullable
        +@Nullable Node<KeyType,ValueType> getSuccessor(@NotNull
        +                                                         KeyType key)
        +
        Returns the successor of the node, which corresponds to a specific key.
        +
        +
        Parameters:
        +
        key - The key of the successor, which should be returned, as an instance of the generic + type KeyType. The key may not be null
        +
        Returns:
        +
        The successor, which corresponds to the given key, as an instance of the type Node or null, if no successor corresponds to the given key
        +
        +
      • +
      + + + + + +
        +
      • +

        addSuccessor

        +
        @NotNull
        +default @NotNull Node<KeyType,ValueType> addSuccessor(@NotNull
        +                                                               KeyType key)
        +
        Creates a new successor and adds it to the node.
        +
        +
        Parameters:
        +
        key - The key, which corresponds to the successor to be created, as an instance of the + generic type KeyType. The key may not be null
        +
        Returns:
        +
        The successor, which has been added, as an instance of the type Node. The + successor may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        addSuccessor

        +
        @NotNull
        +@NotNull Node<KeyType,ValueType> addSuccessor(@NotNull
        +                                                       KeyType key,
        +                                                       @Nullable
        +                                                       @Nullable Node<KeyType,ValueType> successor)
        +
        Adds a specific successor to the node.
        +
        +
        Parameters:
        +
        key - The key, which corresponds to the successor to be created, as an instance of + the generic type KeyType. The key may not be null
        +
        successor - The successor, which should be added, as an instance of the type Node or null, if the successor should be created
        +
        Returns:
        +
        The successor, which has been added, as an instance of the type Node. The + successor may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        removeSuccessor

        +
        void removeSuccessor(@NotNull
        +                     KeyType key)
        +
        Removes the successor, which corresponds to a specific key.
        +
        +
        Parameters:
        +
        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 null
        +
        +
      • +
      + + + +
        +
      • +

        removeSuccessor

        +
        default void removeSuccessor(int index)
        +
        Removes the successor at a specific index. If the index is invalid, an IndexOutOfBoundsException is thrown. If the node's successors are not sorted, an UnsupportedOperationException is thrown.
        +
        +
        Parameters:
        +
        index - The index of the successor, which should be removed, as an Integer + value
        +
        +
      • +
      + + + +
        +
      • +

        getSuccessorValueCount

        +
        int getSuccessorValueCount()
        +
        Returns the number of successors for which values are set, i.e. isValueSet() returns + true. All successors of the node are taken into account recursively down to the + leaf nodes.
        +
        +
        Returns:
        +
        The number of successor, for which values are set, as an Integer value
        +
        +
      • +
      + + + +
        +
      • +

        getSuccessorKey

        +
        @NotNull
        +default KeyType getSuccessorKey(int index)
        +
        Returns the key, which corresponds to the successor at a specific index. If the index is + invalid, an IndexOutOfBoundsException is thrown. If the node's successor or are not + sorted, an UnsupportedOperationException is thrown.
        +
        +
        Parameters:
        +
        index - The index of the key, which should be returned, as an Integer value
        +
        Returns:
        +
        The key of the successor at the given index as an instance of the generic type KeyType. The key may not be null
        +
        +
      • +
      + + + +
        +
      • +

        getFirstSuccessorKey

        +
        @Nullable
        +default KeyType getFirstSuccessorKey()
        +
        Returns the key, which corresponds to the first successor. If the node's successors are not + sorted, an UnsupportedOperationException is thrown.
        +
        +
        Returns:
        +
        The key of the first successor as an instance of the generic type KeyType or + null, if the node does not have any successors
        +
        +
      • +
      + + + +
        +
      • +

        getLastSuccessorKey

        +
        @Nullable
        +default KeyType getLastSuccessorKey()
        +
        Returns the key, which corresponds to the last successor. If the node's successors are not + sorted, an UnsupportedOperationException is thrown.
        +
        +
        Returns:
        +
        The key of the last successor as an instance of the generic type KeyType or + null, if the node does not have any successors
        +
        +
      • +
      + + + +
        +
      • +

        getSuccessor

        +
        @NotNull
        +default @NotNull Node<KeyType,ValueType> getSuccessor(int index)
        +
        Returns the successor at a specific index. If the index is invalid, an IndexOutOfBoundsException is thrown. If the node's successors are not sorted, an UnsupportedOperationException is thrown.
        +
        +
        Parameters:
        +
        index - The index of the successor, which which should be returned, as an Integer value
        +
        Returns:
        +
        The successor at the given index as an instance of the type Node. The + successor may not be null
        +
        +
      • +
      + + + +
        +
      • +

        getFirstSuccessor

        +
        @Nullable
        +default @Nullable Node<KeyType,ValueType> getFirstSuccessor()
        +
        Returns the first successor. If the node's successors are not sorted, an UnsupportedOperationException is thrown.
        +
        +
        Returns:
        +
        The first successor as an instance of the type Node or null, if the node does + not have any successors
        +
        +
      • +
      + + + +
        +
      • +

        getLastSuccessor

        +
        @Nullable
        +default @Nullable Node<KeyType,ValueType> getLastSuccessor()
        +
        Returns the last successor. If the node's successors are not sorted, an UnsupportedOperationException is thrown.
        +
        +
        Returns:
        +
        The last successor as an instance of the type Node or null, if the node does + not have any successors
        +
        +
      • +
      + + + + + +
        +
      • +

        indexOf

        +
        default int indexOf(@NotNull
        +                    KeyType key)
        +
        Returns the index of the successor, which corresponds to a specific key. If the node's + successors are not sorted, an UnsupportedOperationException is thrown.
        +
        +
        Parameters:
        +
        key - The key of the successor, whose index should be returned, as an instance of the + type KeyType. The key may not be null
        +
        Returns:
        +
        The index of the successor, which corresponds to the given key, as an Integer + value or -1, if no such successor is available
        +
        +
      • +
      + + + + + +
        +
      • +

        indexOfFirstElement

        +
        default int indexOfFirstElement(@NotNull
        +                                KeyType key)
        +
        Returns the index of the successor, whose key starts with the first element of another key. + The index is obtained by using a binary search. If the node's successors are not sorted, an + UnsupportedOperationException is thrown.
        +
        +
        Parameters:
        +
        key - The key, whose first element should be searched, as an instance of the generic + type KeyType. The key may not be null
        +
        Returns:
        +
        The index of the successor, whose key starts with the first element of the given key, + as an Integer value or -1, if no such successor is available
        +
        +
      • +
      + + + +
        +
      • +

        increaseSuccessorValueCount

        +
        void increaseSuccessorValueCount(int by)
        +
        Increases the number of successors for which values are set by a specific amount. This causes + the number of successors of the node's predecessors to be increased recursively as well.
        +
        +
        Parameters:
        +
        by - The amount, the number of successor should be increased by, as an Integer + value. The amount must be at least 0
        +
        +
      • +
      + + + +
        +
      • +

        decreaseSuccessorValueCount

        +
        void decreaseSuccessorValueCount(int by)
        +
        Decreases the number of successors for which values are set by a specific amount. This causes + the number of successors of the node's predecessors to be decreased recursively as well.
        +
        +
        Parameters:
        +
        by - The amount, the number of successor should be decreased by, as an Integer + value. The amount must be at least 0
        +
        +
      • +
      + + + +
        +
      • +

        getPredecessor

        +
        @Nullable
        +java.util.Map.Entry<KeyType,Node<KeyType,ValueType>> getPredecessor()
        +
        Returns the predecessor of the node.
        +
        +
        Returns:
        +
        An entry, which contains the predecessor of this node, 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 is set
        +
        +
      • +
      + + + +
        +
      • +

        setPredecessor

        +
        void setPredecessor(@Nullable
        +                    java.util.Map.Entry<KeyType,Node<KeyType,ValueType>> predecessor)
        +
        Sets the predecessor of the node.
        +
        +
        Parameters:
        +
        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
        +
        +
      • +
      + + + +
        +
      • +

        clone

        +
        Node<KeyType,ValueType> clone()
        +
        Creates and returns a deep copy of the node and its successors.
        +
        +
        Returns:
        +
        The copy, which has been created, as an instance of the type Node
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/NodeValue.html b/doc/javadoc/de/mrapp/tries/NodeValue.html new file mode 100644 index 0000000..065bf4a --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/NodeValue.html @@ -0,0 +1,376 @@ + + + + + +NodeValue + + + + + + + + + + + + +
+
de.mrapp.tries
+

Class NodeValue<T>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • de.mrapp.tries.NodeValue<T>
    • +
    +
  • +
+
+
    +
  • +
    +
    Type Parameters:
    +
    T - The type of the value
    +
    +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Cloneable
    +
    +
    +
    +
    public class NodeValue<T>
    +extends java.lang.Object
    +implements java.io.Serializable, java.lang.Cloneable
    +
    A wrapper, which encapsulates the value of a trie's node. A wrapper class for a node's value is + needed to distinguish between nodes that correspond to one of the keys, which have been put into + the trie, but are associated with the value null and those that do not correspond to + a key.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      NodeValue(T value) +
      Creates a new wrapper, which encapsulates the value of a trie's node.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      NodeValue<T>clone() 
      booleanequals(java.lang.Object obj) 
      TgetValue() +
      Returns the encapsulated value.
      +
      inthashCode() 
      java.lang.StringtoString() 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +finalize, getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + + + +
        +
      • +

        NodeValue

        +
        public NodeValue(@Nullable
        +                 T value)
        +
        Creates a new wrapper, which encapsulates the value of a trie's node.
        +
        +
        Parameters:
        +
        value - The encapsulated value as an instance of the generic type T or null, if + the encapsulated value is null
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getValue

        +
        @Nullable
        +public T getValue()
        +
        Returns the encapsulated value.
        +
        +
        Returns:
        +
        The encapsulated value as an instance of the generic type T or null, if the + encapsulated value is null
        +
        +
      • +
      + + + +
        +
      • +

        clone

        +
        public final NodeValue<T> clone()
        +
        +
        Overrides:
        +
        clone in class java.lang.Object
        +
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public final java.lang.String toString()
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      + + + +
        +
      • +

        hashCode

        +
        public final int hashCode()
        +
        +
        Overrides:
        +
        hashCode in class java.lang.Object
        +
        +
      • +
      + + + +
        +
      • +

        equals

        +
        public final boolean equals(java.lang.Object obj)
        +
        +
        Overrides:
        +
        equals in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/PatriciaStringTrie.html b/doc/javadoc/de/mrapp/tries/PatriciaStringTrie.html new file mode 100644 index 0000000..43710eb --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/PatriciaStringTrie.html @@ -0,0 +1,463 @@ + + + + + +PatriciaStringTrie + + + + + + + + + + + + +
+
de.mrapp.tries
+

Class PatriciaStringTrie<ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    SortedStringTrie<ValueType>, StringTrie<ValueType>, java.io.Serializable, java.util.Map<java.lang.String,ValueType>, java.util.NavigableMap<java.lang.String,ValueType>, java.util.SortedMap<java.lang.String,ValueType>
    +
    +
    +
    +
    public class PatriciaStringTrie<ValueType>
    +extends SortedStringTrieWrapper<ValueType>
    +
    A sorted trie, which stores the successors of nodes in sorted lists. It is the pendant of the + class 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.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        PatriciaStringTrie

        +
        public PatriciaStringTrie()
        +
        Creates a new empty, sorted trie for storing character sequences, which uses sorted lists for + storing the successors of nodes. Subsequent nodes that only have a single successor are + merged to a single node to reduce space complexity. For comparing keys with each other, the + natural ordering of the keys is used.
        +
      • +
      + + + +
        +
      • +

        PatriciaStringTrie

        +
        public PatriciaStringTrie(@Nullable
        +                          @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. Subsequent nodes that only have a single successor are + merged to a single node to reduce space complexity.
        +
        +
        Parameters:
        +
        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 used
        +
        +
      • +
      + + + +
        +
      • +

        PatriciaStringTrie

        +
        public PatriciaStringTrie(@NotNull
        +                          @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. + Subsequent nodes that only have a single successor are merged to a single node to reduce + space complexity. For comparing keys with each other, the natural ordering of the keys is + used.
        +
        +
        Parameters:
        +
        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
        +
        +
      • +
      + + + +
        +
      • +

        PatriciaStringTrie

        +
        public PatriciaStringTrie(@Nullable
        +                          @Nullable java.util.Comparator<? super java.lang.String> comparator,
        +                          @NotNull
        +                          @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. + Subsequent nodes that only have a single successor are merged to a single node to reduce + space complexity.
        +
        +
        Parameters:
        +
        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 used
        +
        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
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        toString

        +
        public final java.lang.String toString()
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/PatriciaTrie.html b/doc/javadoc/de/mrapp/tries/PatriciaTrie.html new file mode 100644 index 0000000..50f7d5a --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/PatriciaTrie.html @@ -0,0 +1,569 @@ + + + + + +PatriciaTrie + + + + + + + + + + + + +
+
de.mrapp.tries
+

Class PatriciaTrie<SequenceType extends Sequence,ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    SortedTrie<SequenceType,ValueType>, Trie<SequenceType,ValueType>, java.io.Serializable, java.util.Map<SequenceType,ValueType>, java.util.NavigableMap<SequenceType,ValueType>, java.util.SortedMap<SequenceType,ValueType>
    +
    +
    +
    +
    public class PatriciaTrie<SequenceType extends Sequence,ValueType>
    +extends AbstractSortedTrie<SequenceType,ValueType>
    +
    A sorted trie, which stores the successor of nodes in sorted lists. In contrast to a 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.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        PatriciaTrie

        +
        protected PatriciaTrie(@Nullable
        +                       @Nullable Node<SequenceType,ValueType> rootNode,
        +                       @Nullable
        +                       @Nullable java.util.Comparator<? super SequenceType> comparator)
        +
        Creates a new Patricia trie.
        +
        +
        Parameters:
        +
        rootNode - The root node of the trie as an instance of the type Node or null, + if the trie should be empty
        +
        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 used
        +
        +
      • +
      + + + +
        +
      • +

        PatriciaTrie

        +
        public PatriciaTrie()
        +
        Creates a new, empty Patricia trie.
        +
      • +
      + + + +
        +
      • +

        PatriciaTrie

        +
        public PatriciaTrie(@NotNull
        +                    @NotNull java.util.Map<SequenceType,ValueType> map)
        +
        Creates a new Patricia trie, which contains all key-value pairs that are contained by a map. + For comparing keys with each other, the natural ordering of the keys is used.
        +
        +
        Parameters:
        +
        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
        +
        +
      • +
      + + + +
        +
      • +

        PatriciaTrie

        +
        public PatriciaTrie(@Nullable
        +                    @Nullable java.util.Comparator<? super SequenceType> comparator)
        +
        Creates a new, empty Patricia trie.
        +
        +
        Parameters:
        +
        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 used
        +
        +
      • +
      + + + +
        +
      • +

        PatriciaTrie

        +
        public PatriciaTrie(@Nullable
        +                    @Nullable java.util.Comparator<? super SequenceType> comparator,
        +                    @NotNull
        +                    @NotNull java.util.Map<SequenceType,ValueType> map)
        +
        Creates a new Patrica trie, which contains all key-value pairs that are contained by a map.
        +
        +
        Parameters:
        +
        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 used
        +
        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
        +
        +
      • +
      +
    • +
    + + +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/Sequence.html b/doc/javadoc/de/mrapp/tries/Sequence.html new file mode 100644 index 0000000..cbe2cf5 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/Sequence.html @@ -0,0 +1,350 @@ + + + + + +Sequence + + + + + + + + + + + + +
+
de.mrapp.tries
+

Interface Sequence

+
+
+
+
    +
  • +
    +
    All Superinterfaces:
    +
    java.io.Serializable
    +
    +
    +
    All Known Implementing Classes:
    +
    StringSequence
    +
    +
    +
    +
    public interface Sequence
    +extends java.io.Serializable
    +
    Defines the interface, a sequence, which can be used as the keys of a 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.

    +
    +
    Since:
    +
    1.0.0
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and TypeMethod and Description
      Sequenceconcat(@NotNull Sequence sequence) +
      Concatenates this sequence with another one.
      +
      default booleanisEmpty() +
      Returns, whether the sequence is empty, i.e.
      +
      intlength() +
      Returns the length of the sequence.
      +
      default Sequencesubsequence(int start) +
      Returns a new sequence, which is a subsequence of this sequence, starting at a specific index + and spanning to the end.
      +
      Sequencesubsequence(int start, + int end) +
      Returns a new sequence, which is a subsequence of this sequence.
      +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        subsequence

        +
        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.
        +
        +
        Parameters:
        +
        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 thrown
        +
        Returns:
        +
        A new sequence, which consists of the elements within the specified range, as an + instance of the type Sequence. The returned sequence must be a new immutable object + and its class must be the same as the class of the original sequence
        +
        +
      • +
      + + + +
        +
      • +

        subsequence

        +
        Sequence subsequence(int start,
        +                     int end)
        +
        Returns a new sequence, which is a subsequence of this sequence.
        +
        +
        Parameters:
        +
        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 thrown
        +
        end - Specifies the index of the last element to be included (exclusive) as an Integer value. If the index is invalid, an IndexOutOfBoundsException + may be thrown
        +
        Returns:
        +
        A new sequence, which consists of the elements within the specified range, as an + instance of the type Sequence. The returned sequence must be a new immutable object + and its class must be the same as the class of the original sequence
        +
        +
      • +
      + + + +
        +
      • +

        concat

        +
        Sequence concat(@NotNull
        +                @NotNull Sequence sequence)
        +
        Concatenates this sequence with another one.
        +
        +
        Parameters:
        +
        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 thrown
        +
        Returns:
        +
        A new sequence, which contains this sequences as a prefix and the given one as a + suffix, as an instance of the type Sequence. The returned sequence must be a new + immutable object and its class must be the same as the class of the original sequence
        +
        +
      • +
      + + + +
        +
      • +

        isEmpty

        +
        default boolean isEmpty()
        +
        Returns, whether the sequence is empty, i.e. its length is 0, or not.
        +
        +
        Returns:
        +
        True, if the sequence is empty, false otherwise
        +
        +
      • +
      + + + +
        +
      • +

        length

        +
        int length()
        +
        Returns the length of the sequence.
        +
        +
        Returns:
        +
        The length of the sequence as an Integer value. The length must be at least 0
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/SortedListStringTrie.html b/doc/javadoc/de/mrapp/tries/SortedListStringTrie.html new file mode 100644 index 0000000..8d69821 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/SortedListStringTrie.html @@ -0,0 +1,458 @@ + + + + + +SortedListStringTrie + + + + + + + + + + + + +
+
de.mrapp.tries
+

Class SortedListStringTrie<ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    SortedStringTrie<ValueType>, StringTrie<ValueType>, java.io.Serializable, java.util.Map<java.lang.String,ValueType>, java.util.NavigableMap<java.lang.String,ValueType>, java.util.SortedMap<java.lang.String,ValueType>
    +
    +
    +
    +
    public class SortedListStringTrie<ValueType>
    +extends SortedStringTrieWrapper<ValueType>
    +
    A sorted trie, which stores the successors of nodes in sorted lists. It is the pendant of the + class 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.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SortedListStringTrie

        +
        public SortedListStringTrie()
        +
        Creates a new empty, sorted trie for storing character sequences, which uses sorted lists for + storing the successors of nodes. For comparing keys with each other, the natural ordering of + the keys is used.
        +
      • +
      + + + +
        +
      • +

        SortedListStringTrie

        +
        public SortedListStringTrie(@Nullable
        +                            @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.
        +
        +
        Parameters:
        +
        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 used
        +
        +
      • +
      + + + +
        +
      • +

        SortedListStringTrie

        +
        public SortedListStringTrie(@NotNull
        +                            @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. + For comparing keys with each other, the natural ordering of the keys is used.
        +
        +
        Parameters:
        +
        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
        +
        +
      • +
      + + + +
        +
      • +

        SortedListStringTrie

        +
        public SortedListStringTrie(@Nullable
        +                            @Nullable java.util.Comparator<? super java.lang.String> comparator,
        +                            @NotNull
        +                            @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.
        +
        +
        Parameters:
        +
        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 used
        +
        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
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        toString

        +
        public final java.lang.String toString()
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/SortedListTrie.html b/doc/javadoc/de/mrapp/tries/SortedListTrie.html new file mode 100644 index 0000000..569e5a9 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/SortedListTrie.html @@ -0,0 +1,542 @@ + + + + + +SortedListTrie + + + + + + + + + + + + +
+
de.mrapp.tries
+

Class SortedListTrie<SequenceType extends Sequence,ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    SortedTrie<SequenceType,ValueType>, Trie<SequenceType,ValueType>, java.io.Serializable, java.util.Map<SequenceType,ValueType>, java.util.NavigableMap<SequenceType,ValueType>, java.util.SortedMap<SequenceType,ValueType>
    +
    +
    +
    +
    public class SortedListTrie<SequenceType extends Sequence,ValueType>
    +extends AbstractSortedTrie<SequenceType,ValueType>
    +
    A sorted trie, which stores the successors of nodes in sorted lists. The edges between nodes + always correspond to exactly one element of a sequence. Therefore, even if a subsequence of + length n is not shared between multiple keys, the trie contains n nodes to store that + subsequence. Successors are looked up using binary search, resulting in logarithmic complexity. + Although this is worse than the constant complexity provided by a HashTrie, this trie + implementation should be preferred, if the order of keys is relevant.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SortedListTrie

        +
        public SortedListTrie()
        +
        Creates a new empty, sorted trie, which stores the successors of nodes in sorted lists. For + comparing keys with each other, the natural ordering of the keys is used.
        +
      • +
      + + + +
        +
      • +

        SortedListTrie

        +
        public SortedListTrie(@NotNull
        +                      @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. For comparing keys with each other, the + natural ordering of the keys is used.
        +
        +
        Parameters:
        +
        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
        +
        +
      • +
      + + + +
        +
      • +

        SortedListTrie

        +
        public SortedListTrie(@Nullable
        +                      @Nullable java.util.Comparator<? super SequenceType> comparator)
        +
        Creates a new empty, sorted trie, which stores the successors of nodes in sorted lists.
        +
        +
        Parameters:
        +
        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 used
        +
        +
      • +
      + + + +
        +
      • +

        SortedListTrie

        +
        public SortedListTrie(@Nullable
        +                      @Nullable java.util.Comparator<? super SequenceType> comparator,
        +                      @NotNull
        +                      @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.
        +
        +
        Parameters:
        +
        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 used
        +
        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
        +
        +
      • +
      +
    • +
    + + +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/SortedStringTrie.html b/doc/javadoc/de/mrapp/tries/SortedStringTrie.html new file mode 100644 index 0000000..e6ceb66 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/SortedStringTrie.html @@ -0,0 +1,291 @@ + + + + + +SortedStringTrie + + + + + + + + + + + + +
+
de.mrapp.tries
+

Interface SortedStringTrie<ValueType>

+
+
+
+
    +
  • +
    +
    Type Parameters:
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Superinterfaces:
    +
    java.util.Map<java.lang.String,ValueType>, java.util.NavigableMap<java.lang.String,ValueType>, java.io.Serializable, java.util.SortedMap<java.lang.String,ValueType>, StringTrie<ValueType>
    +
    +
    +
    All Known Implementing Classes:
    +
    PatriciaStringTrie, SortedListStringTrie, SortedStringTrieWrapper, UnmodifiableSortedStringTrie
    +
    +
    +
    +
    public interface SortedStringTrie<ValueType>
    +extends java.util.NavigableMap<java.lang.String,ValueType>, StringTrie<ValueType>
    +
    Defines the interface of a sorted trie, which uses character sequences, represented by the class + 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.
    +
    +
    Since:
    +
    1.0.0
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from interface java.util.Map

        +java.util.Map.Entry<K,V>
      • +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethod and Description
      @NotNull SortedStringTrie<ValueType>subTrie(@Nullable java.lang.String sequence) 
      +
        +
      • + + +

        Methods inherited from interface java.util.NavigableMap

        +ceilingEntry, ceilingKey, descendingKeySet, descendingMap, firstEntry, floorEntry, floorKey, headMap, headMap, higherEntry, higherKey, lastEntry, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, subMap, subMap, tailMap, tailMap
      • +
      +
        +
      • + + +

        Methods inherited from interface java.util.SortedMap

        +comparator, entrySet, firstKey, keySet, lastKey, values
      • +
      +
        +
      • + + +

        Methods inherited from interface java.util.Map

        +clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
      • +
      + +
    • +
    +
  • +
+
+
+ +
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/SortedTrie.html b/doc/javadoc/de/mrapp/tries/SortedTrie.html new file mode 100644 index 0000000..e92019d --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/SortedTrie.html @@ -0,0 +1,304 @@ + + + + + +SortedTrie + + + + + + + + + + + + +
+
de.mrapp.tries
+

Interface SortedTrie<SequenceType extends Sequence,ValueType>

+
+
+
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Superinterfaces:
    +
    java.util.Map<SequenceType,ValueType>, java.util.NavigableMap<SequenceType,ValueType>, java.io.Serializable, java.util.SortedMap<SequenceType,ValueType>, Trie<SequenceType,ValueType>
    +
    +
    +
    All Known Implementing Classes:
    +
    AbstractSortedTrie, EmptySortedTrie, PatriciaTrie, SingletonSortedTrie, SortedListTrie, UnmodifiableSortedTrie
    +
    +
    +
    +
    public interface SortedTrie<SequenceType extends Sequence,ValueType>
    +extends java.util.NavigableMap<SequenceType,ValueType>, Trie<SequenceType,ValueType>
    +
    Defines the interface of a sorted trie. This is a specialization of the interface 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.

    +
    +
    Since:
    +
    1.0.0
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from interface java.util.Map

        +java.util.Map.Entry<K,V>
      • +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethod and Description
      @NotNull SortedTrie<SequenceType,ValueType>subTrie(SequenceType sequence) + +
      +
        +
      • + + +

        Methods inherited from interface java.util.NavigableMap

        +ceilingEntry, ceilingKey, descendingKeySet, descendingMap, firstEntry, floorEntry, floorKey, headMap, headMap, higherEntry, higherKey, lastEntry, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, subMap, subMap, tailMap, tailMap
      • +
      +
        +
      • + + +

        Methods inherited from interface java.util.SortedMap

        +comparator, entrySet, firstKey, keySet, lastKey, values
      • +
      +
        +
      • + + +

        Methods inherited from interface java.util.Map

        +clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
      • +
      + +
    • +
    +
  • +
+
+
+ +
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/StringTrie.html b/doc/javadoc/de/mrapp/tries/StringTrie.html new file mode 100644 index 0000000..17c723a --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/StringTrie.html @@ -0,0 +1,292 @@ + + + + + +StringTrie + + + + + + + + + + + + +
+
de.mrapp.tries
+

Interface StringTrie<ValueType>

+
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from interface java.util.Map

        +java.util.Map.Entry<K,V>
      • +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethod and Description
      @Nullable Node<java.lang.String,ValueType>getRootNode() 
      @NotNull StringTrie<ValueType>subTrie(@Nullable java.lang.String sequence) 
      +
        +
      • + + +

        Methods inherited from interface java.util.Map

        +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
      • +
      +
    • +
    +
  • +
+
+
+ +
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/Trie.html b/doc/javadoc/de/mrapp/tries/Trie.html new file mode 100644 index 0000000..0221491 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/Trie.html @@ -0,0 +1,319 @@ + + + + + +Trie + + + + + + + + + + + + +
+
de.mrapp.tries
+

Interface Trie<SequenceType extends Sequence,ValueType>

+
+
+
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Superinterfaces:
    +
    java.util.Map<SequenceType,ValueType>, java.io.Serializable
    +
    +
    +
    All Known Subinterfaces:
    +
    SortedTrie<SequenceType,ValueType>
    +
    +
    +
    All Known Implementing Classes:
    +
    AbstractEmptyTrie, AbstractSingletonTrie, AbstractSortedTrie, AbstractTrie, AbstractUnmodifiableTrie, EmptySortedTrie, EmptyTrie, HashTrie, PatriciaTrie, SingletonSortedTrie, SingletonTrie, SortedListTrie, UnmodifiableSortedTrie, UnmodifiableTrie
    +
    +
    +
    +
    public interface Trie<SequenceType extends Sequence,ValueType>
    +extends java.util.Map<SequenceType,ValueType>, java.io.Serializable
    +
    Defines the interface of a trie (also called prefix tree, digital tree or radix tree). A trie is + a tree data structure that can be used to store an associative array where the keys are sequences + (e.g. sequences of characters or lists of digits). +

    + 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.

    +
    +
    Since:
    +
    1.0.0
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from interface java.util.Map

        +java.util.Map.Entry<K,V>
      • +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethod 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).
      +
      +
        +
      • + + +

        Methods inherited from interface java.util.Map

        +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
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getRootNode

        +
        @Nullable
        +@Nullable Node<SequenceType,ValueType> getRootNode()
        +
        Returns the root node of the trie. The returned object is not modifiable, i.e. an UnsupportedOperationException will be thrown when attempting to change the state of the + returned node or one of its successors.
        +
        +
        Returns:
        +
        The root node of the trie as an instance of the type Node or null, if the + trie is empty
        +
        +
      • +
      + + + + + +
        +
      • +

        subTrie

        +
        @NotNull
        +@NotNull Trie<SequenceType,ValueType> subTrie(@Nullable
        +                                                       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). If the given + sequence corresponds to a key, the key is not included in the subtree. If the given sequence + is not contained by the trie, a 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.

        +
        +
        Parameters:
        +
        sequence - The sequence as an instance of the generic type SequenceType
        +
        Returns:
        +
        The subtree of the node, which corresponds to the given sequence, as an instance of + the type Trie. The subtree may not be null
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/Tries.html b/doc/javadoc/de/mrapp/tries/Tries.html new file mode 100644 index 0000000..181a352 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/Tries.html @@ -0,0 +1,715 @@ + + + + + +Tries + + + + + + + + + + + + +
+
de.mrapp.tries
+

Class Tries

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • de.mrapp.tries.Tries
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public final class Tries
    +extends java.lang.Object
    +
    This class consists exclusively of static methods that operate on or return tries. It can be + considered as the trie-related pendant of the utility class Collections.
    +
    +
    Since:
    +
    1.0.0
    +
    +
  • +
+
+
+ +
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        emptyTrie

        +
        @NotNull
        +public static <K extends Sequence,V> @NotNull Trie<K,V> emptyTrie()
        +
        Returns the empty Trie (immutable). The returned trie is serializable.
        +
        +
        Type Parameters:
        +
        K - The type of the sequences, which are used as the trie's keys
        +
        V - The type of the values, which are stored by the trie
        +
        Returns:
        +
        The empty trie as an instance of the type Trie. The trie may not be null
        +
        See Also:
        +
        EMPTY_TRIE
        +
        +
      • +
      + + + +
        +
      • +

        emptySortedTrie

        +
        @NotNull
        +public static <K extends Sequence,V> @NotNull SortedTrie<K,V> emptySortedTrie()
        +
        Returns the empty SortedTrie (immutable). The returned trie is serializable.
        +
        +
        Type Parameters:
        +
        K - The type of the sequences, which are used as the trie's keys
        +
        V - The type of the values, which are stored by the trie
        +
        Returns:
        +
        The empty trie as an instance of the type SortedTrie. The trie may not be + null
        +
        See Also:
        +
        EMPTY_SORTED_TRIE
        +
        +
      • +
      + + + +
        +
      • +

        emptyStringTrie

        +
        @NotNull
        +public static <V> @NotNull StringTrie<V> emptyStringTrie()
        +
        Returns the empty StringTrie (immutable). The returned trie is serializable.
        +
        +
        Type Parameters:
        +
        V - The type of the values, which are stored by the trie
        +
        Returns:
        +
        The empty trie as an instance of the type StringTrie. The trie may not be + null
        +
        See Also:
        +
        EMPTY_STRING_TRIE
        +
        +
      • +
      + + + +
        +
      • +

        emptySortedStringTrie

        +
        @NotNull
        +public static <V> @NotNull SortedStringTrie<V> emptySortedStringTrie()
        +
        Returns the empty SortedStringTrie (immutable). The returned trie is serializable.
        +
        +
        Type Parameters:
        +
        V - The type of the values, which are stored by the trie
        +
        Returns:
        +
        The empty trie as an instance of the type SortedStringTrie. The trie may not + be null
        +
        See Also:
        +
        EMPTY_SORTED_STRING_TRIE
        +
        +
      • +
      + + + + + +
        +
      • +

        singletonTrie

        +
        @NotNull
        +public static <K extends Sequence,V> @NotNull Trie<K,V> singletonTrie(@Nullable
        +                                                                               K key,
        +                                                                               @Nullable
        +                                                                               V value)
        +
        Returns an immutable Trie, which only contains a single entry. The returned trie is + serializable.
        +
        +
        Type Parameters:
        +
        K - The type of the sequences, which are used as the trie's keys
        +
        V - The type of the values, which are stored by the trie
        +
        Parameters:
        +
        key - The key of the entry, which should be stored in the trie, as an instance of the + generic type K or null
        +
        value - The value of the entry, which should be stored in the trie, as an instance of + the generic type V or null
        +
        Returns:
        +
        An immutable trie, which contains the given key-value mapping, as an instance of the + type Trie. The trie may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        singletonSortedTrie

        +
        @NotNull
        +public static <K extends Sequence,V> @NotNull SortedTrie<K,V> singletonSortedTrie(@Nullable
        +                                                                                           K key,
        +                                                                                           @Nullable
        +                                                                                           V value)
        +
        Returns an immutable SortedTrie, which only contains a single entry. The returned + trie is serializable.
        +
        +
        Type Parameters:
        +
        K - The type of the sequences, which are used as the trie's keys
        +
        V - The type of the values, which are stored by the trie
        +
        Parameters:
        +
        key - The key of the entry, which should be stored in the trie, as an instance of the + generic type K or null
        +
        value - The value of the entry, which should be stored in the trie, as an instance of + the generic type V or null
        +
        Returns:
        +
        An immutable trie, which contains the given key-value mapping, as an instance of the + type SortedTrie. The trie may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        singletonStringTrie

        +
        @NotNull
        +public static <V> @NotNull StringTrie<V> singletonStringTrie(@Nullable
        +                                                                      @Nullable java.lang.String key,
        +                                                                      @Nullable
        +                                                                      V value)
        +
        Returns an immutable StringTrie, which only contains a single entry. The returned + trie is serializable.
        +
        +
        Type Parameters:
        +
        V - The type of the values, which are stored by the trie
        +
        Parameters:
        +
        key - The key of the entry, which should be stored in the trie, as a String or + null
        +
        value - The value of the entry, which should be stored in the trie, as an instance of + the generic type V or null
        +
        Returns:
        +
        An immutable trie, which contains the given key-value mapping, as an instance of the + type StringTrie. The trie may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        singletonSortedStringTrie

        +
        @NotNull
        +public static <V> @NotNull SortedStringTrie<V> singletonSortedStringTrie(@Nullable
        +                                                                                  @Nullable java.lang.String key,
        +                                                                                  @Nullable
        +                                                                                  V value)
        +
        Returns an immutable SortedStringTrie, which only contains a single entry. The + returned trie is serializable.
        +
        +
        Type Parameters:
        +
        V - The type of the values, which are stored by the trie
        +
        Parameters:
        +
        key - The key of the entry, which should be stored in the trie, as a String or + null
        +
        value - The value of the entry, which should be stored in the trie, as an instance of + the generic type V or null
        +
        Returns:
        +
        An immutable trie, which contains the given key-value mapping, as an instance of the + type SortedStringTrie. The trie may not be null
        +
        +
      • +
      + + + +
        +
      • +

        unmodifiableTrie

        +
        @NotNull
        +public static <K extends Sequence,V> @NotNull Trie<K,V> unmodifiableTrie(@NotNull
        +                                                                                  @NotNull Trie<K,V> trie)
        +
        Returns an unmodifiable view of a specific 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.

        +
        +
        Type Parameters:
        +
        K - The type of the sequences, which are used as the trie's keys
        +
        V - The type of the values, which are stored by the trie
        +
        Parameters:
        +
        trie - The trie for which an unmodifiable view should be returned as an instance of the + type Trie. The trie may not be null
        +
        Returns:
        +
        An unmodifiable view of the given trie as an instance of the type Trie. The + view may not be null
        +
        +
      • +
      + + + +
        +
      • +

        unmodifiableSortedTrie

        +
        @NotNull
        +public static <K extends Sequence,V> @NotNull SortedTrie<K,V> unmodifiableSortedTrie(@NotNull
        +                                                                                              @NotNull SortedTrie<K,V> trie)
        +
        Returns an unmodifiable view of a specific 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.

        +
        +
        Type Parameters:
        +
        K - The type of the sequences, which are used as the trie's keys
        +
        V - The type of the values, which are stored by the trie
        +
        Parameters:
        +
        trie - The trie for which an unmodifiable view should be returned as an instance of the + type SortedTrie. The trie may not be null
        +
        Returns:
        +
        An unmodifiable view of the given trie as an instance of the type SortedTrie. + The view may not be null
        +
        +
      • +
      + + + +
        +
      • +

        unmodifiableStringTrie

        +
        @NotNull
        +public static <V> @NotNull StringTrie<V> unmodifiableStringTrie(@NotNull
        +                                                                         @NotNull StringTrie<V> trie)
        +
        Returns an unmodifiable view of a specific 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.

        +
        +
        Type Parameters:
        +
        V - The type of the values, which are stored by the trie
        +
        Parameters:
        +
        trie - The trie for which an unmodifiable view should be returned as an instance of the + type StringTrie. The trie may not be null
        +
        Returns:
        +
        An unmodifiable view of the given trie as an instance of the type StringTrie. + The view may not be null
        +
        +
      • +
      + + + +
        +
      • +

        unmodifiableSortedStringTrie

        +
        @NotNull
        +public static <V> @NotNull SortedStringTrie<V> unmodifiableSortedStringTrie(@NotNull
        +                                                                                     @NotNull SortedStringTrie<V> trie)
        +
        Returns an unmodifiable view of a specific 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.

        +
        +
        Type Parameters:
        +
        V - The type of the values, which are stored by the trie
        +
        Parameters:
        +
        trie - The trie for which an unmodifiable view should be returned as an instance of the + type SortedStringTrie. The trie may not be null
        +
        Returns:
        +
        An unmodifiable view of the given trie as an instance of the type SortedStringTrie. The view may not be null
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/AbstractEmptyTrie.html b/doc/javadoc/de/mrapp/tries/datastructure/AbstractEmptyTrie.html new file mode 100644 index 0000000..3445f7f --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/AbstractEmptyTrie.html @@ -0,0 +1,544 @@ + + + + + +AbstractEmptyTrie + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class AbstractEmptyTrie<SequenceType extends Sequence,ValueType>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • de.mrapp.tries.datastructure.AbstractEmptyTrie<SequenceType,ValueType>
    • +
    +
  • +
+
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    Trie<SequenceType,ValueType>, java.io.Serializable, java.util.Map<SequenceType,ValueType>
    +
    +
    +
    Direct Known Subclasses:
    +
    EmptySortedTrie, EmptyTrie
    +
    +
    +
    +
    public abstract class AbstractEmptyTrie<SequenceType extends Sequence,ValueType>
    +extends java.lang.Object
    +implements Trie<SequenceType,ValueType>
    +
    An abstract base class for all immutable and empty tries.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+ +
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/AbstractSingletonTrie.html b/doc/javadoc/de/mrapp/tries/datastructure/AbstractSingletonTrie.html new file mode 100644 index 0000000..9df51dc --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/AbstractSingletonTrie.html @@ -0,0 +1,598 @@ + + + + + +AbstractSingletonTrie + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class AbstractSingletonTrie<SequenceType extends Sequence,ValueType>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • de.mrapp.tries.datastructure.AbstractSingletonTrie<SequenceType,ValueType>
    • +
    +
  • +
+
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    Trie<SequenceType,ValueType>, java.io.Serializable, java.util.Map<SequenceType,ValueType>
    +
    +
    +
    Direct Known Subclasses:
    +
    SingletonSortedTrie, SingletonTrie
    +
    +
    +
    +
    public abstract class AbstractSingletonTrie<SequenceType extends Sequence,ValueType>
    +extends java.lang.Object
    +implements Trie<SequenceType,ValueType>
    +
    An abstract base class for all immutable tries, which contains only a single entry.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + + + +
        +
      • +

        AbstractSingletonTrie

        +
        public AbstractSingletonTrie(@Nullable
        +                             SequenceType key,
        +                             @Nullable
        +                             ValueType value)
        +
        Creates a new immutable trie, which only contains a single entry.
        +
        +
        Parameters:
        +
        key - The key of the entry as an instance of the generic type SequenceType or + null
        +
        value - The value of the entry as an instance of the generic type ValueType or + null
        +
        +
      • +
      +
    • +
    + + +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/AbstractSortedTrie.html b/doc/javadoc/de/mrapp/tries/datastructure/AbstractSortedTrie.html new file mode 100644 index 0000000..1269e75 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/AbstractSortedTrie.html @@ -0,0 +1,918 @@ + + + + + +AbstractSortedTrie + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class AbstractSortedTrie<SequenceType extends Sequence,ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    SortedTrie<SequenceType,ValueType>, Trie<SequenceType,ValueType>, java.io.Serializable, java.util.Map<SequenceType,ValueType>, java.util.NavigableMap<SequenceType,ValueType>, java.util.SortedMap<SequenceType,ValueType>
    +
    +
    +
    Direct Known Subclasses:
    +
    PatriciaTrie, SortedListTrie
    +
    +
    +
    +
    public abstract class AbstractSortedTrie<SequenceType extends Sequence,ValueType>
    +extends AbstractTrie<SortedStructure<SequenceType,ValueType>,SequenceType,ValueType>
    +implements SortedTrie<SequenceType,ValueType>
    +
    An abstract base class for all sorted tries, whose nodes are ordered by their keys. It implements + the methods of the interface NavigableMap. Subclasses must provide an implementation of + the interface SortedStructure, which adjusts the structure of the trie, when retrieving, + inserting or removing keys.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+ +
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/AbstractStringTrieWrapper.html b/doc/javadoc/de/mrapp/tries/datastructure/AbstractStringTrieWrapper.html new file mode 100644 index 0000000..7bc7ca5 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/AbstractStringTrieWrapper.html @@ -0,0 +1,582 @@ + + + + + +AbstractStringTrieWrapper + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class AbstractStringTrieWrapper<TrieType extends Trie<StringSequence,ValueType>,ValueType>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • de.mrapp.tries.datastructure.AbstractStringTrieWrapper<TrieType,ValueType>
    • +
    +
  • +
+
+
    +
  • +
    +
    Type Parameters:
    +
    TrieType - The type of the encapsulated trie
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    StringTrie<ValueType>, java.io.Serializable, java.util.Map<java.lang.String,ValueType>
    +
    +
    +
    Direct Known Subclasses:
    +
    SortedStringTrieWrapper, StringTrieWrapper
    +
    +
    +
    +
    public abstract class AbstractStringTrieWrapper<TrieType extends Trie<StringSequence,ValueType>,ValueType>
    +extends java.lang.Object
    +implements StringTrie<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.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from interface java.util.Map

        +java.util.Map.Entry<K,V>
      • +
      +
    • +
    + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      protected TrieTypetrie +
      The encapsulated trie.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidclear() 
      booleancontainsKey(java.lang.Object key) 
      booleancontainsValue(java.lang.Object value) 
      @NotNull java.util.Set<java.util.Map.Entry<java.lang.String,ValueType>>entrySet() 
      booleanequals(java.lang.Object obj) 
      ValueTypeget(java.lang.Object key) 
      @Nullable Node<java.lang.String,ValueType>getRootNode() 
      inthashCode() 
      booleanisEmpty() 
      @NotNull java.util.Set<java.lang.String>keySet() 
      ValueTypeput(java.lang.String key, + ValueType value) 
      voidputAll(@NotNull java.util.Map<? extends java.lang.String,? extends ValueType> map) 
      ValueTyperemove(java.lang.Object key) 
      intsize() 
      @NotNull java.util.Collection<ValueType>values() 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • +
      + +
        +
      • + + +

        Methods inherited from interface java.util.Map

        +compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        size

        +
        public final int size()
        +
        +
        Specified by:
        +
        size in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        isEmpty

        +
        public final boolean isEmpty()
        +
        +
        Specified by:
        +
        isEmpty in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        containsKey

        +
        public final boolean containsKey(java.lang.Object key)
        +
        +
        Specified by:
        +
        containsKey in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        containsValue

        +
        public final boolean containsValue(java.lang.Object value)
        +
        +
        Specified by:
        +
        containsValue in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        get

        +
        public final ValueType get(java.lang.Object key)
        +
        +
        Specified by:
        +
        get in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + + + +
        +
      • +

        put

        +
        public final ValueType put(java.lang.String key,
        +                           ValueType value)
        +
        +
        Specified by:
        +
        put in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        remove

        +
        public final ValueType remove(java.lang.Object key)
        +
        +
        Specified by:
        +
        remove in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        putAll

        +
        public final void putAll(@NotNull
        +                         @NotNull java.util.Map<? extends java.lang.String,? extends ValueType> map)
        +
        +
        Specified by:
        +
        putAll in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        clear

        +
        public final void clear()
        +
        +
        Specified by:
        +
        clear in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        keySet

        +
        @NotNull
        +public final @NotNull java.util.Set<java.lang.String> keySet()
        +
        +
        Specified by:
        +
        keySet in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        values

        +
        @NotNull
        +public final @NotNull java.util.Collection<ValueType> values()
        +
        +
        Specified by:
        +
        values in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        entrySet

        +
        @NotNull
        +public final @NotNull java.util.Set<java.util.Map.Entry<java.lang.String,ValueType>> entrySet()
        +
        +
        Specified by:
        +
        entrySet in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + + + + + +
        +
      • +

        hashCode

        +
        public final int hashCode()
        +
        +
        Specified by:
        +
        hashCode in interface java.util.Map<java.lang.String,ValueType>
        +
        Overrides:
        +
        hashCode in class java.lang.Object
        +
        +
      • +
      + + + +
        +
      • +

        equals

        +
        public final boolean equals(java.lang.Object obj)
        +
        +
        Specified by:
        +
        equals in interface java.util.Map<java.lang.String,ValueType>
        +
        Overrides:
        +
        equals in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/AbstractTrie.AbstractKeySet.html b/doc/javadoc/de/mrapp/tries/datastructure/AbstractTrie.AbstractKeySet.html new file mode 100644 index 0000000..add6e1d --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/AbstractTrie.AbstractKeySet.html @@ -0,0 +1,390 @@ + + + + + +AbstractTrie.AbstractKeySet + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class AbstractTrie.AbstractKeySet<K extends Sequence,MapType extends java.util.Map<K,?>>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.util.AbstractCollection<E>
    • +
    • +
        +
      • java.util.AbstractSet<K>
      • +
      • +
          +
        • de.mrapp.tries.datastructure.AbstractTrie.AbstractKeySet<K,MapType>
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    Type Parameters:
    +
    K - The type of the keys, which are contained by the key set
    +
    MapType - The type of the map
    +
    +
    +
    All Implemented Interfaces:
    +
    java.lang.Iterable<K>, java.util.Collection<K>, java.util.Set<K>
    +
    +
    +
    Direct Known Subclasses:
    +
    AbstractTrie.KeySet
    +
    +
    +
    Enclosing class:
    +
    AbstractTrie<StructureType extends Structure<SequenceType,ValueType>,SequenceType extends Sequence,ValueType>
    +
    +
    +
    +
    protected abstract static class AbstractTrie.AbstractKeySet<K extends Sequence,MapType extends java.util.Map<K,?>>
    +extends java.util.AbstractSet<K>
    +
    An abstract base class for all key sets as returned by the Map.keySet() method.
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidclear() 
      booleancontains(java.lang.Object o) 
      booleanisEmpty() 
      booleanremove(java.lang.Object o) 
      intsize() 
      +
        +
      • + + +

        Methods inherited from class java.util.AbstractSet

        +equals, hashCode, removeAll
      • +
      +
        +
      • + + +

        Methods inherited from class java.util.AbstractCollection

        +add, addAll, containsAll, iterator, retainAll, toArray, toArray, toString
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.util.Set

        +add, addAll, containsAll, iterator, retainAll, spliterator, toArray, toArray
      • +
      +
        +
      • + + +

        Methods inherited from interface java.util.Collection

        +parallelStream, removeIf, stream
      • +
      +
        +
      • + + +

        Methods inherited from interface java.lang.Iterable

        +forEach
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        size

        +
        public final int size()
        +
        +
        Specified by:
        +
        size in interface java.util.Collection<K extends Sequence>
        +
        Specified by:
        +
        size in interface java.util.Set<K extends Sequence>
        +
        Specified by:
        +
        size in class java.util.AbstractCollection<K extends Sequence>
        +
        +
      • +
      + + + +
        +
      • +

        isEmpty

        +
        public final boolean isEmpty()
        +
        +
        Specified by:
        +
        isEmpty in interface java.util.Collection<K extends Sequence>
        +
        Specified by:
        +
        isEmpty in interface java.util.Set<K extends Sequence>
        +
        Overrides:
        +
        isEmpty in class java.util.AbstractCollection<K extends Sequence>
        +
        +
      • +
      + + + +
        +
      • +

        contains

        +
        public final boolean contains(java.lang.Object o)
        +
        +
        Specified by:
        +
        contains in interface java.util.Collection<K extends Sequence>
        +
        Specified by:
        +
        contains in interface java.util.Set<K extends Sequence>
        +
        Overrides:
        +
        contains in class java.util.AbstractCollection<K extends Sequence>
        +
        +
      • +
      + + + +
        +
      • +

        clear

        +
        public final void clear()
        +
        +
        Specified by:
        +
        clear in interface java.util.Collection<K extends Sequence>
        +
        Specified by:
        +
        clear in interface java.util.Set<K extends Sequence>
        +
        Overrides:
        +
        clear in class java.util.AbstractCollection<K extends Sequence>
        +
        +
      • +
      + + + +
        +
      • +

        remove

        +
        public final boolean remove(java.lang.Object o)
        +
        +
        Specified by:
        +
        remove in interface java.util.Collection<K extends Sequence>
        +
        Specified by:
        +
        remove in interface java.util.Set<K extends Sequence>
        +
        Overrides:
        +
        remove in class java.util.AbstractCollection<K extends Sequence>
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/AbstractTrie.KeySet.html b/doc/javadoc/de/mrapp/tries/datastructure/AbstractTrie.KeySet.html new file mode 100644 index 0000000..0871dae --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/AbstractTrie.KeySet.html @@ -0,0 +1,317 @@ + + + + + +AbstractTrie.KeySet + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class AbstractTrie.KeySet<K extends Sequence>

+
+
+ +
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      @NotNull java.util.Iterator<K>iterator() 
      + +
        +
      • + + +

        Methods inherited from class java.util.AbstractSet

        +equals, hashCode, removeAll
      • +
      +
        +
      • + + +

        Methods inherited from class java.util.AbstractCollection

        +add, addAll, containsAll, retainAll, toArray, toArray, toString
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.util.Set

        +add, addAll, containsAll, retainAll, spliterator, toArray, toArray
      • +
      +
        +
      • + + +

        Methods inherited from interface java.util.Collection

        +parallelStream, removeIf, stream
      • +
      +
        +
      • + + +

        Methods inherited from interface java.lang.Iterable

        +forEach
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        iterator

        +
        @NotNull
        +public @NotNull java.util.Iterator<K> iterator()
        +
        +
        Specified by:
        +
        iterator in interface java.lang.Iterable<K extends Sequence>
        +
        Specified by:
        +
        iterator in interface java.util.Collection<K extends Sequence>
        +
        Specified by:
        +
        iterator in interface java.util.Set<K extends Sequence>
        +
        Specified by:
        +
        iterator in class java.util.AbstractCollection<K extends Sequence>
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/AbstractTrie.html b/doc/javadoc/de/mrapp/tries/datastructure/AbstractTrie.html new file mode 100644 index 0000000..5f16f60 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/AbstractTrie.html @@ -0,0 +1,784 @@ + + + + + +AbstractTrie + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class AbstractTrie<StructureType extends Structure<SequenceType,ValueType>,SequenceType extends Sequence,ValueType>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • de.mrapp.tries.datastructure.AbstractTrie<StructureType,SequenceType,ValueType>
    • +
    +
  • +
+
+
    +
  • +
    +
    Type Parameters:
    +
    StructureType - The type of the implementation of the interface Structure, which + defines the structure of the trie
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    Trie<SequenceType,ValueType>, java.io.Serializable, java.util.Map<SequenceType,ValueType>
    +
    +
    +
    Direct Known Subclasses:
    +
    AbstractSortedTrie, HashTrie
    +
    +
    +
    +
    public abstract class AbstractTrie<StructureType extends Structure<SequenceType,ValueType>,SequenceType extends Sequence,ValueType>
    +extends java.lang.Object
    +implements Trie<SequenceType,ValueType>
    +
    An abstract base class for all tries. It implements the methods of the interface 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.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        AbstractTrie

        +
        protected AbstractTrie(@Nullable
        +                       @Nullable Node<SequenceType,ValueType> rootNode)
        +
        Creates a new trie.
        +
        +
        Parameters:
        +
        rootNode - The root node of the trie as an instance of the type Node or null, if + the trie should be empty
        +
        +
      • +
      + + + +
        +
      • +

        AbstractTrie

        +
        public AbstractTrie()
        +
        Creates a new empty trie.
        +
      • +
      + + + +
        +
      • +

        AbstractTrie

        +
        public AbstractTrie(@NotNull
        +                    @NotNull java.util.Map<SequenceType,ValueType> map)
        +
        Creates a new trie, which contains all key-value pairs that are contained in a map.
        +
        +
        Parameters:
        +
        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
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        createRootNode

        +
        @NotNull
        +protected abstract @NotNull Node<SequenceType,ValueType> createRootNode()
        +
        The method, which is invoked on subclasses in order to create the trie's root node.
        +
        +
        Returns:
        +
        The root node, which has been created, as an instance of the type Node. The + root node may not be null
        +
        +
      • +
      + + + +
        +
      • +

        createStructure

        +
        @NotNull
        +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.
        +
        +
        Returns:
        +
        The implementation of the interface Structure as an instance of the generic + type StructureType. The implementation may not be null
        +
        +
      • +
      + + + +
        +
      • +

        getNode

        +
        @Nullable
        +protected final @Nullable Node<SequenceType,ValueType> getNode(java.lang.Object key)
        +
        Traverses the trie in order to returns the node, which corresponds to a specific key.
        +
        +
        Parameters:
        +
        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 thrown
        +
        Returns:
        +
        The node, which corresponds to the given key, as an instance of the type Node + or null, if no such node is available
        +
        +
      • +
      + + + +
        +
      • +

        getRootNode

        +
        @Nullable
        +public final @Nullable Node<SequenceType,ValueType> getRootNode()
        +
        Description copied from interface: Trie
        +
        Returns the root node of the trie. The returned object is not modifiable, i.e. an UnsupportedOperationException will be thrown when attempting to change the state of the + returned node or one of its successors.
        +
        +
        Specified by:
        +
        getRootNode in interface Trie<SequenceType extends Sequence,ValueType>
        +
        Returns:
        +
        The root node of the trie as an instance of the type Node or null, if the + trie is empty
        +
        +
      • +
      + + + +
        +
      • +

        isEmpty

        +
        public final boolean isEmpty()
        +
        +
        Specified by:
        +
        isEmpty in interface java.util.Map<SequenceType extends Sequence,ValueType>
        +
        +
      • +
      + + + + + + + +
        +
      • +

        containsKey

        +
        public final boolean containsKey(java.lang.Object key)
        +
        +
        Specified by:
        +
        containsKey in interface java.util.Map<SequenceType extends Sequence,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        containsValue

        +
        public final boolean containsValue(java.lang.Object value)
        +
        +
        Specified by:
        +
        containsValue in interface java.util.Map<SequenceType extends Sequence,ValueType>
        +
        +
      • +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +
      • +

        hashCode

        +
        public final int hashCode()
        +
        +
        Specified by:
        +
        hashCode in interface java.util.Map<SequenceType extends Sequence,ValueType>
        +
        Overrides:
        +
        hashCode in class java.lang.Object
        +
        +
      • +
      + + + +
        +
      • +

        equals

        +
        public final boolean equals(java.lang.Object obj)
        +
        +
        Specified by:
        +
        equals in interface java.util.Map<SequenceType extends Sequence,ValueType>
        +
        Overrides:
        +
        equals in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/AbstractUnmodifiableStringTrie.html b/doc/javadoc/de/mrapp/tries/datastructure/AbstractUnmodifiableStringTrie.html new file mode 100644 index 0000000..7c250ee --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/AbstractUnmodifiableStringTrie.html @@ -0,0 +1,604 @@ + + + + + +AbstractUnmodifiableStringTrie + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class AbstractUnmodifiableStringTrie<ValueType,TrieType extends StringTrie<ValueType>>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • de.mrapp.tries.datastructure.AbstractUnmodifiableStringTrie<ValueType,TrieType>
    • +
    +
  • +
+
+
    +
  • +
    +
    Type Parameters:
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    StringTrie<ValueType>, java.io.Serializable, java.util.Map<java.lang.String,ValueType>
    +
    +
    +
    Direct Known Subclasses:
    +
    UnmodifiableSortedStringTrie, UnmodifiableStringTrie
    +
    +
    +
    +
    public abstract class AbstractUnmodifiableStringTrie<ValueType,TrieType extends StringTrie<ValueType>>
    +extends java.lang.Object
    +implements StringTrie<ValueType>
    +
    An abstract base class for all string tries, which forward read-only method calls to an + encapsulated trie and throw UnsupportedOperationExceptions when calling a method, which + attempts to change the trie's state.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from interface java.util.Map

        +java.util.Map.Entry<K,V>
      • +
      +
    • +
    + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidclear() 
      booleancontainsKey(java.lang.Object key) 
      booleancontainsValue(java.lang.Object value) 
      @NotNull java.util.Set<java.util.Map.Entry<java.lang.String,ValueType>>entrySet() 
      booleanequals(java.lang.Object obj) 
      ValueTypeget(java.lang.Object key) 
      @Nullable Node<java.lang.String,ValueType>getRootNode() 
      inthashCode() 
      booleanisEmpty() 
      @NotNull java.util.Set<java.lang.String>keySet() 
      ValueTypeput(java.lang.String key, + ValueType value) 
      voidputAll(@NotNull java.util.Map<? extends java.lang.String,? extends ValueType> map) 
      ValueTyperemove(java.lang.Object key) 
      intsize() 
      java.lang.StringtoString() 
      @NotNull java.util.Collection<ValueType>values() 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • +
      + +
        +
      • + + +

        Methods inherited from interface java.util.Map

        +compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + + + +
        +
      • +

        AbstractUnmodifiableStringTrie

        +
        public AbstractUnmodifiableStringTrie(@NotNull
        +                                      TrieType trie)
        +
        Creates a new immutable string trie.
        +
        +
        Parameters:
        +
        trie - The trie, which should be encapsulated, as an instance of the generic type TrieType. The trie may not be null
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        size

        +
        public final int size()
        +
        +
        Specified by:
        +
        size in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        isEmpty

        +
        public final boolean isEmpty()
        +
        +
        Specified by:
        +
        isEmpty in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        containsKey

        +
        public final boolean containsKey(java.lang.Object key)
        +
        +
        Specified by:
        +
        containsKey in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        containsValue

        +
        public final boolean containsValue(java.lang.Object value)
        +
        +
        Specified by:
        +
        containsValue in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        get

        +
        public final ValueType get(java.lang.Object key)
        +
        +
        Specified by:
        +
        get in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + + + +
        +
      • +

        put

        +
        public final ValueType put(java.lang.String key,
        +                           ValueType value)
        +
        +
        Specified by:
        +
        put in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        remove

        +
        public final ValueType remove(java.lang.Object key)
        +
        +
        Specified by:
        +
        remove in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        putAll

        +
        public final void putAll(@NotNull
        +                         @NotNull java.util.Map<? extends java.lang.String,? extends ValueType> map)
        +
        +
        Specified by:
        +
        putAll in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        clear

        +
        public final void clear()
        +
        +
        Specified by:
        +
        clear in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        keySet

        +
        @NotNull
        +public final @NotNull java.util.Set<java.lang.String> keySet()
        +
        +
        Specified by:
        +
        keySet in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        values

        +
        @NotNull
        +public final @NotNull java.util.Collection<ValueType> values()
        +
        +
        Specified by:
        +
        values in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        entrySet

        +
        @NotNull
        +public final @NotNull java.util.Set<java.util.Map.Entry<java.lang.String,ValueType>> entrySet()
        +
        +
        Specified by:
        +
        entrySet in interface java.util.Map<java.lang.String,ValueType>
        +
        +
      • +
      + + + + + + + +
        +
      • +

        toString

        +
        public final java.lang.String toString()
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      + + + +
        +
      • +

        hashCode

        +
        public final int hashCode()
        +
        +
        Specified by:
        +
        hashCode in interface java.util.Map<java.lang.String,ValueType>
        +
        Overrides:
        +
        hashCode in class java.lang.Object
        +
        +
      • +
      + + + +
        +
      • +

        equals

        +
        public final boolean equals(java.lang.Object obj)
        +
        +
        Specified by:
        +
        equals in interface java.util.Map<java.lang.String,ValueType>
        +
        Overrides:
        +
        equals in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/AbstractUnmodifiableTrie.html b/doc/javadoc/de/mrapp/tries/datastructure/AbstractUnmodifiableTrie.html new file mode 100644 index 0000000..b39bdde --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/AbstractUnmodifiableTrie.html @@ -0,0 +1,611 @@ + + + + + +AbstractUnmodifiableTrie + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class AbstractUnmodifiableTrie<SequenceType extends Sequence,ValueType,TrieType extends Trie<SequenceType,ValueType>>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • de.mrapp.tries.datastructure.AbstractUnmodifiableTrie<SequenceType,ValueType,TrieType>
    • +
    +
  • +
+
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    Trie<SequenceType,ValueType>, java.io.Serializable, java.util.Map<SequenceType,ValueType>
    +
    +
    +
    Direct Known Subclasses:
    +
    UnmodifiableSortedTrie, UnmodifiableTrie
    +
    +
    +
    +
    public abstract class AbstractUnmodifiableTrie<SequenceType extends Sequence,ValueType,TrieType extends Trie<SequenceType,ValueType>>
    +extends java.lang.Object
    +implements Trie<SequenceType,ValueType>
    +
    An abstract base class for all tries, which forward read-only method calls to an encapsulated + trie and throw UnsupportedOperationExceptions when calling a method, which attempts to + change the trie's state.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + + + +
        +
      • +

        AbstractUnmodifiableTrie

        +
        public AbstractUnmodifiableTrie(@NotNull
        +                                TrieType trie)
        +
        Creates a new immutable trie.
        +
        +
        Parameters:
        +
        trie - The trie, which should be encapsulated, as an instance of the generic type TrieType. The trie may not be null
        +
        +
      • +
      +
    • +
    + + +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/EmptySortedTrie.html b/doc/javadoc/de/mrapp/tries/datastructure/EmptySortedTrie.html new file mode 100644 index 0000000..7351557 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/EmptySortedTrie.html @@ -0,0 +1,827 @@ + + + + + +EmptySortedTrie + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class EmptySortedTrie<SequenceType extends Sequence,ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    SortedTrie<SequenceType,ValueType>, Trie<SequenceType,ValueType>, java.io.Serializable, java.util.Map<SequenceType,ValueType>, java.util.NavigableMap<SequenceType,ValueType>, java.util.SortedMap<SequenceType,ValueType>
    +
    +
    +
    +
    public class EmptySortedTrie<SequenceType extends Sequence,ValueType>
    +extends AbstractEmptyTrie<SequenceType,ValueType>
    +implements SortedTrie<SequenceType,ValueType>
    +
    An unmodifiable and empty sorted trie.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+ +
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/EmptyTrie.html b/doc/javadoc/de/mrapp/tries/datastructure/EmptyTrie.html new file mode 100644 index 0000000..1369b97 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/EmptyTrie.html @@ -0,0 +1,358 @@ + + + + + +EmptyTrie + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class EmptyTrie<SequenceType extends Sequence,ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    Trie<SequenceType,ValueType>, java.io.Serializable, java.util.Map<SequenceType,ValueType>
    +
    +
    +
    +
    public class EmptyTrie<SequenceType extends Sequence,ValueType>
    +extends AbstractEmptyTrie<SequenceType,ValueType>
    +
    An immutable and empty trie.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Nested Class Summary

      +
        +
      • + + +

        Nested classes/interfaces inherited from interface java.util.Map

        +java.util.Map.Entry<K,V>
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      EmptyTrie() 
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        EmptyTrie

        +
        public EmptyTrie()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        subTrie

        +
        @NotNull
        +public final @NotNull Trie<SequenceType,ValueType> subTrie(@NotNull
        +                                                                    SequenceType sequence)
        +
        Description copied from interface: Trie
        +
        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). If the given + sequence corresponds to a key, the key is not included in the subtree. If the given sequence + is not contained by the trie, a 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.

        +
        +
        Parameters:
        +
        sequence - The sequence as an instance of the generic type SequenceType
        +
        Returns:
        +
        The subtree of the node, which corresponds to the given sequence, as an instance of + the type Trie. The subtree may not be null
        +
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public final java.lang.String toString()
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/SingletonSortedTrie.html b/doc/javadoc/de/mrapp/tries/datastructure/SingletonSortedTrie.html new file mode 100644 index 0000000..766eb6f --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/SingletonSortedTrie.html @@ -0,0 +1,842 @@ + + + + + +SingletonSortedTrie + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class SingletonSortedTrie<SequenceType extends Sequence,ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    SortedTrie<SequenceType,ValueType>, Trie<SequenceType,ValueType>, java.io.Serializable, java.util.Map<SequenceType,ValueType>, java.util.NavigableMap<SequenceType,ValueType>, java.util.SortedMap<SequenceType,ValueType>
    +
    +
    +
    +
    public class SingletonSortedTrie<SequenceType extends Sequence,ValueType>
    +extends AbstractSingletonTrie<SequenceType,ValueType>
    +implements SortedTrie<SequenceType,ValueType>
    +
    An immutable SortedTrie, which contains only a single entry.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+ +
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/SingletonTrie.html b/doc/javadoc/de/mrapp/tries/datastructure/SingletonTrie.html new file mode 100644 index 0000000..8c44734 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/SingletonTrie.html @@ -0,0 +1,374 @@ + + + + + +SingletonTrie + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class SingletonTrie<SequenceType extends Sequence,ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    Trie<SequenceType,ValueType>, java.io.Serializable, java.util.Map<SequenceType,ValueType>
    +
    +
    +
    +
    public class SingletonTrie<SequenceType extends Sequence,ValueType>
    +extends AbstractSingletonTrie<SequenceType,ValueType>
    +
    An immutable Trie, which contains only a single entry.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + + + +
        +
      • +

        SingletonTrie

        +
        public SingletonTrie(@Nullable
        +                     SequenceType key,
        +                     @Nullable
        +                     ValueType value)
        +
        Creates a new immutable Trie, which only contains a single entry.
        +
        +
        Parameters:
        +
        key - The key of the entry as an instance of the generic type SequenceType or + null
        +
        value - The value of the entry as an instance of the generic type ValueType or + null
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        subTrie

        +
        @NotNull
        +public final @NotNull Trie<SequenceType,ValueType> subTrie(@NotNull
        +                                                                    SequenceType sequence)
        +
        Description copied from interface: Trie
        +
        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). If the given + sequence corresponds to a key, the key is not included in the subtree. If the given sequence + is not contained by the trie, a 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.

        +
        +
        Parameters:
        +
        sequence - The sequence as an instance of the generic type SequenceType
        +
        Returns:
        +
        The subtree of the node, which corresponds to the given sequence, as an instance of + the type Trie. The subtree may not be null
        +
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public final java.lang.String toString()
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/SortedStringTrieWrapper.StringSequenceComparatorWrapper.html b/doc/javadoc/de/mrapp/tries/datastructure/SortedStringTrieWrapper.StringSequenceComparatorWrapper.html new file mode 100644 index 0000000..e3f518b --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/SortedStringTrieWrapper.StringSequenceComparatorWrapper.html @@ -0,0 +1,302 @@ + + + + + +SortedStringTrieWrapper.StringSequenceComparatorWrapper + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class SortedStringTrieWrapper.StringSequenceComparatorWrapper

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • de.mrapp.tries.datastructure.SortedStringTrieWrapper.StringSequenceComparatorWrapper
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.util.Comparator<StringSequence>
    +
    +
    +
    Enclosing class:
    +
    SortedStringTrieWrapper<ValueType>
    +
    +
    +
    +
    protected static final class SortedStringTrieWrapper.StringSequenceComparatorWrapper
    +extends java.lang.Object
    +implements java.util.Comparator<StringSequence>
    +
    A comparator, which allows to compare instances of the class StringSequence by + encapsulating a comparator, which compares Strings.
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      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 Strings.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      intcompare(StringSequence o1, + StringSequence o2) 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.util.Comparator

        +comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        StringSequenceComparatorWrapper

        +
        public StringSequenceComparatorWrapper(@NotNull
        +                                       @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 Strings.
        +
        +
        Parameters:
        +
        comparator - The comparator, which should be encapsulated, as an instance of the + type Comparator. The comparator may not be null
        +
        +
      • +
      +
    • +
    + + +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/SortedStringTrieWrapper.html b/doc/javadoc/de/mrapp/tries/datastructure/SortedStringTrieWrapper.html new file mode 100644 index 0000000..aafa926 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/SortedStringTrieWrapper.html @@ -0,0 +1,814 @@ + + + + + +SortedStringTrieWrapper + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class SortedStringTrieWrapper<ValueType>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SortedStringTrieWrapper

        +
        public SortedStringTrieWrapper(@NotNull
        +                               @NotNull SortedTrie<StringSequence,ValueType> trie)
        +
        Creates a new wrapper, which implements the interface SortedStringTrie.
        +
        +
        Parameters:
        +
        trie - The trie, which should be encapsulated, as an instance of the type SortedTrie. The trie may not be null
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        lowerEntry

        +
        public final java.util.Map.Entry<java.lang.String,ValueType> lowerEntry(java.lang.String key)
        +
        +
        Specified by:
        +
        lowerEntry in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        lowerKey

        +
        public final java.lang.String lowerKey(java.lang.String key)
        +
        +
        Specified by:
        +
        lowerKey in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        floorEntry

        +
        public final java.util.Map.Entry<java.lang.String,ValueType> floorEntry(java.lang.String key)
        +
        +
        Specified by:
        +
        floorEntry in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        floorKey

        +
        public final java.lang.String floorKey(java.lang.String key)
        +
        +
        Specified by:
        +
        floorKey in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        ceilingEntry

        +
        public final java.util.Map.Entry<java.lang.String,ValueType> ceilingEntry(java.lang.String key)
        +
        +
        Specified by:
        +
        ceilingEntry in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        ceilingKey

        +
        public final java.lang.String ceilingKey(java.lang.String key)
        +
        +
        Specified by:
        +
        ceilingKey in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        higherEntry

        +
        public final java.util.Map.Entry<java.lang.String,ValueType> higherEntry(java.lang.String key)
        +
        +
        Specified by:
        +
        higherEntry in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        higherKey

        +
        public final java.lang.String higherKey(java.lang.String key)
        +
        +
        Specified by:
        +
        higherKey in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        firstEntry

        +
        public final java.util.Map.Entry<java.lang.String,ValueType> firstEntry()
        +
        +
        Specified by:
        +
        firstEntry in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        lastEntry

        +
        public final java.util.Map.Entry<java.lang.String,ValueType> lastEntry()
        +
        +
        Specified by:
        +
        lastEntry in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        pollFirstEntry

        +
        public final java.util.Map.Entry<java.lang.String,ValueType> pollFirstEntry()
        +
        +
        Specified by:
        +
        pollFirstEntry in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        pollLastEntry

        +
        public final java.util.Map.Entry<java.lang.String,ValueType> pollLastEntry()
        +
        +
        Specified by:
        +
        pollLastEntry in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        descendingMap

        +
        public final java.util.NavigableMap<java.lang.String,ValueType> descendingMap()
        +
        +
        Specified by:
        +
        descendingMap in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        navigableKeySet

        +
        public final java.util.NavigableSet<java.lang.String> navigableKeySet()
        +
        +
        Specified by:
        +
        navigableKeySet in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        descendingKeySet

        +
        public final java.util.NavigableSet<java.lang.String> descendingKeySet()
        +
        +
        Specified by:
        +
        descendingKeySet in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        subMap

        +
        public final java.util.NavigableMap<java.lang.String,ValueType> subMap(java.lang.String fromKey,
        +                                                                       boolean fromInclusive,
        +                                                                       java.lang.String toKey,
        +                                                                       boolean toInclusive)
        +
        +
        Specified by:
        +
        subMap in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        headMap

        +
        public final java.util.NavigableMap<java.lang.String,ValueType> headMap(java.lang.String toKey,
        +                                                                        boolean inclusive)
        +
        +
        Specified by:
        +
        headMap in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        tailMap

        +
        public final java.util.NavigableMap<java.lang.String,ValueType> tailMap(java.lang.String fromKey,
        +                                                                        boolean inclusive)
        +
        +
        Specified by:
        +
        tailMap in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        comparator

        +
        public java.util.Comparator<? super java.lang.String> comparator()
        +
        +
        Specified by:
        +
        comparator in interface java.util.SortedMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        subMap

        +
        @NotNull
        +public final @NotNull java.util.SortedMap<java.lang.String,ValueType> subMap(java.lang.String fromKey,
        +                                                                                      java.lang.String toKey)
        +
        +
        Specified by:
        +
        subMap in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        Specified by:
        +
        subMap in interface java.util.SortedMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        headMap

        +
        @NotNull
        +public final @NotNull java.util.SortedMap<java.lang.String,ValueType> headMap(java.lang.String toKey)
        +
        +
        Specified by:
        +
        headMap in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        Specified by:
        +
        headMap in interface java.util.SortedMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        tailMap

        +
        @NotNull
        +public final @NotNull java.util.SortedMap<java.lang.String,ValueType> tailMap(java.lang.String fromKey)
        +
        +
        Specified by:
        +
        tailMap in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        Specified by:
        +
        tailMap in interface java.util.SortedMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        firstKey

        +
        public final java.lang.String firstKey()
        +
        +
        Specified by:
        +
        firstKey in interface java.util.SortedMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        lastKey

        +
        public final java.lang.String lastKey()
        +
        +
        Specified by:
        +
        lastKey in interface java.util.SortedMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + + +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/StringNodeWrapper.html b/doc/javadoc/de/mrapp/tries/datastructure/StringNodeWrapper.html new file mode 100644 index 0000000..b0e75d3 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/StringNodeWrapper.html @@ -0,0 +1,684 @@ + + + + + +StringNodeWrapper + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class StringNodeWrapper<ValueType>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • de.mrapp.tries.datastructure.StringNodeWrapper<ValueType>
    • +
    +
  • +
+
+
    +
  • +
    +
    Type Parameters:
    +
    ValueType - The type of the node's value
    +
    +
    +
    All Implemented Interfaces:
    +
    Node<java.lang.String,ValueType>, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.lang.String>
    +
    +
    +
    +
    public class StringNodeWrapper<ValueType>
    +extends java.lang.Object
    +implements Node<java.lang.String,ValueType>
    +
    An implementation of the interface Node, where predecessors correspond to keys of the + type String. It forwards read-only method calls to an encapsulated node by mapping Strings to StringSequences and throws UnsupportedOperationExceptions when + calling a method, which attempts to change the node's state.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        StringNodeWrapper

        +
        public StringNodeWrapper(@NotNull
        +                         @NotNull Node<StringSequence,ValueType> node)
        +
        Creates a new implementation of the interface Node, where predecessors correspond to + keys of the type String.
        +
        +
        Parameters:
        +
        node - The node, which should be encapsulated, as an instance of the type Node. + The node may not be null
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getNodeValue

        +
        @Nullable
        +public final @Nullable NodeValue<ValueType> getNodeValue()
        +
        Description copied from interface: Node
        +
        Returns the value of the node.
        +
        +
        Specified by:
        +
        getNodeValue in interface Node<java.lang.String,ValueType>
        +
        Returns:
        +
        The value of the node encapsulated by a NodeValue wrapper or null, if the + node does not correspond to a key, which has been put into the trie
        +
        +
      • +
      + + + +
        +
      • +

        setNodeValue

        +
        @Nullable
        +public final @Nullable NodeValue<ValueType> setNodeValue(@Nullable
        +                                                                   @Nullable NodeValue<ValueType> nodeValue)
        +
        Description copied from interface: Node
        +
        Sets the value of the node.
        +
        +
        Specified by:
        +
        setNodeValue in interface Node<java.lang.String,ValueType>
        +
        Parameters:
        +
        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 trie
        +
        Returns:
        +
        The previous value of the node as an instance of the class NodeValue or null, + if no value was set
        +
        +
      • +
      + + + +
        +
      • +

        getSuccessorCount

        +
        public final int getSuccessorCount()
        +
        Description copied from interface: Node
        +
        Returns the number of the node's successors.
        +
        +
        Specified by:
        +
        getSuccessorCount in interface Node<java.lang.String,ValueType>
        +
        Returns:
        +
        The number of the node's successor as an Integer value
        +
        +
      • +
      + + + +
        +
      • +

        getSuccessor

        +
        @Nullable
        +public final @Nullable Node<java.lang.String,ValueType> getSuccessor(@NotNull
        +                                                                               @NotNull java.lang.String key)
        +
        Description copied from interface: Node
        +
        Returns the successor of the node, which corresponds to a specific key.
        +
        +
        Specified by:
        +
        getSuccessor in interface Node<java.lang.String,ValueType>
        +
        Parameters:
        +
        key - The key of the successor, which should be returned, as an instance of the generic + type KeyType. The key may not be null
        +
        Returns:
        +
        The successor, which corresponds to the given key, as an instance of the type Node or null, if no successor corresponds to the given key
        +
        +
      • +
      + + + +
        +
      • +

        addSuccessor

        +
        @NotNull
        +public final @NotNull Node<java.lang.String,ValueType> addSuccessor(@NotNull
        +                                                                             @NotNull java.lang.String key,
        +                                                                             @Nullable
        +                                                                             @Nullable Node<java.lang.String,ValueType> successor)
        +
        Description copied from interface: Node
        +
        Adds a specific successor to the node.
        +
        +
        Specified by:
        +
        addSuccessor in interface Node<java.lang.String,ValueType>
        +
        Parameters:
        +
        key - The key, which corresponds to the successor to be created, as an instance of + the generic type KeyType. The key may not be null
        +
        successor - The successor, which should be added, as an instance of the type Node or null, if the successor should be created
        +
        Returns:
        +
        The successor, which has been added, as an instance of the type Node. The + successor may not be null
        +
        +
      • +
      + + + +
        +
      • +

        removeSuccessor

        +
        public final void removeSuccessor(@NotNull
        +                                  @NotNull java.lang.String key)
        +
        Description copied from interface: Node
        +
        Removes the successor, which corresponds to a specific key.
        +
        +
        Specified by:
        +
        removeSuccessor in interface Node<java.lang.String,ValueType>
        +
        Parameters:
        +
        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 null
        +
        +
      • +
      + + + +
        +
      • +

        getSuccessorValueCount

        +
        public final int getSuccessorValueCount()
        +
        Description copied from interface: Node
        +
        Returns the number of successors for which values are set, i.e. Node.isValueSet() returns + true. All successors of the node are taken into account recursively down to the + leaf nodes.
        +
        +
        Specified by:
        +
        getSuccessorValueCount in interface Node<java.lang.String,ValueType>
        +
        Returns:
        +
        The number of successor, for which values are set, as an Integer value
        +
        +
      • +
      + + + +
        +
      • +

        increaseSuccessorValueCount

        +
        public final void increaseSuccessorValueCount(int by)
        +
        Description copied from interface: Node
        +
        Increases the number of successors for which values are set by a specific amount. This causes + the number of successors of the node's predecessors to be increased recursively as well.
        +
        +
        Specified by:
        +
        increaseSuccessorValueCount in interface Node<java.lang.String,ValueType>
        +
        Parameters:
        +
        by - The amount, the number of successor should be increased by, as an Integer + value. The amount must be at least 0
        +
        +
      • +
      + + + +
        +
      • +

        decreaseSuccessorValueCount

        +
        public final void decreaseSuccessorValueCount(int by)
        +
        Description copied from interface: Node
        +
        Decreases the number of successors for which values are set by a specific amount. This causes + the number of successors of the node's predecessors to be decreased recursively as well.
        +
        +
        Specified by:
        +
        decreaseSuccessorValueCount in interface Node<java.lang.String,ValueType>
        +
        Parameters:
        +
        by - The amount, the number of successor should be decreased by, as an Integer + value. The amount must be at least 0
        +
        +
      • +
      + + + +
        +
      • +

        getPredecessor

        +
        @Nullable
        +public final java.util.Map.Entry<java.lang.String,Node<java.lang.String,ValueType>> getPredecessor()
        +
        Description copied from interface: Node
        +
        Returns the predecessor of the node.
        +
        +
        Specified by:
        +
        getPredecessor in interface Node<java.lang.String,ValueType>
        +
        Returns:
        +
        An entry, which contains the predecessor of this node, 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 is set
        +
        +
      • +
      + + + +
        +
      • +

        setPredecessor

        +
        public final void setPredecessor(@Nullable
        +                                 java.util.Map.Entry<java.lang.String,Node<java.lang.String,ValueType>> predecessor)
        +
        Description copied from interface: Node
        +
        Sets the predecessor of the node.
        +
        +
        Specified by:
        +
        setPredecessor in interface Node<java.lang.String,ValueType>
        +
        Parameters:
        +
        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
        +
        +
      • +
      + + + +
        +
      • +

        clone

        +
        public final Node<java.lang.String,ValueType> clone()
        +
        Description copied from interface: Node
        +
        Creates and returns a deep copy of the node and its successors.
        +
        +
        Specified by:
        +
        clone in interface Node<java.lang.String,ValueType>
        +
        Overrides:
        +
        clone in class java.lang.Object
        +
        Returns:
        +
        The copy, which has been created, as an instance of the type Node
        +
        +
      • +
      + + + +
        +
      • +

        iterator

        +
        @NotNull
        +public final @NotNull java.util.Iterator<java.lang.String> iterator()
        +
        +
        Specified by:
        +
        iterator in interface java.lang.Iterable<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public final java.lang.String toString()
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      + + + +
        +
      • +

        hashCode

        +
        public final int hashCode()
        +
        +
        Overrides:
        +
        hashCode in class java.lang.Object
        +
        +
      • +
      + + + +
        +
      • +

        equals

        +
        public final boolean equals(java.lang.Object obj)
        +
        +
        Overrides:
        +
        equals in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/StringTrieWrapper.html b/doc/javadoc/de/mrapp/tries/datastructure/StringTrieWrapper.html new file mode 100644 index 0000000..61d7eb8 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/StringTrieWrapper.html @@ -0,0 +1,363 @@ + + + + + +StringTrieWrapper + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class StringTrieWrapper<ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    StringTrie<ValueType>, java.io.Serializable, java.util.Map<java.lang.String,ValueType>
    +
    +
    +
    Direct Known Subclasses:
    +
    HashStringTrie
    +
    +
    +
    +
    public class StringTrieWrapper<ValueType>
    +extends AbstractStringTrieWrapper<Trie<StringSequence,ValueType>,ValueType>
    +implements StringTrie<ValueType>
    +
    A wrapper, which implements the interface StringTrie by delegating all method calls to an + encapsulated Trie.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+ +
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/UnmodifiableSortedStringTrie.html b/doc/javadoc/de/mrapp/tries/datastructure/UnmodifiableSortedStringTrie.html new file mode 100644 index 0000000..dbab050 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/UnmodifiableSortedStringTrie.html @@ -0,0 +1,780 @@ + + + + + +UnmodifiableSortedStringTrie + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class UnmodifiableSortedStringTrie<ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    SortedStringTrie<ValueType>, StringTrie<ValueType>, java.io.Serializable, java.util.Map<java.lang.String,ValueType>, java.util.NavigableMap<java.lang.String,ValueType>, java.util.SortedMap<java.lang.String,ValueType>
    +
    +
    +
    +
    public class UnmodifiableSortedStringTrie<ValueType>
    +extends AbstractUnmodifiableStringTrie<ValueType,SortedStringTrie<ValueType>>
    +implements SortedStringTrie<ValueType>
    +
    An immutable SortedStringTrie.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        UnmodifiableSortedStringTrie

        +
        public UnmodifiableSortedStringTrie(@NotNull
        +                                    @NotNull SortedStringTrie<ValueType> trie)
        +
        Creates a new unmodifiable sorted string trie.
        +
        +
        Parameters:
        +
        trie - The trie, which should be encapsulated, as an instance of the generic type SortedStringTrie. The trie may not be null
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        lowerEntry

        +
        public final java.util.Map.Entry<java.lang.String,ValueType> lowerEntry(java.lang.String key)
        +
        +
        Specified by:
        +
        lowerEntry in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        lowerKey

        +
        public final java.lang.String lowerKey(java.lang.String key)
        +
        +
        Specified by:
        +
        lowerKey in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        floorEntry

        +
        public final java.util.Map.Entry<java.lang.String,ValueType> floorEntry(java.lang.String key)
        +
        +
        Specified by:
        +
        floorEntry in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        floorKey

        +
        public final java.lang.String floorKey(java.lang.String key)
        +
        +
        Specified by:
        +
        floorKey in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        ceilingEntry

        +
        public final java.util.Map.Entry<java.lang.String,ValueType> ceilingEntry(java.lang.String key)
        +
        +
        Specified by:
        +
        ceilingEntry in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        ceilingKey

        +
        public final java.lang.String ceilingKey(java.lang.String key)
        +
        +
        Specified by:
        +
        ceilingKey in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        higherEntry

        +
        public final java.util.Map.Entry<java.lang.String,ValueType> higherEntry(java.lang.String key)
        +
        +
        Specified by:
        +
        higherEntry in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        higherKey

        +
        public final java.lang.String higherKey(java.lang.String key)
        +
        +
        Specified by:
        +
        higherKey in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        firstEntry

        +
        public final java.util.Map.Entry<java.lang.String,ValueType> firstEntry()
        +
        +
        Specified by:
        +
        firstEntry in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        lastEntry

        +
        public final java.util.Map.Entry<java.lang.String,ValueType> lastEntry()
        +
        +
        Specified by:
        +
        lastEntry in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        pollFirstEntry

        +
        public final java.util.Map.Entry<java.lang.String,ValueType> pollFirstEntry()
        +
        +
        Specified by:
        +
        pollFirstEntry in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        pollLastEntry

        +
        public final java.util.Map.Entry<java.lang.String,ValueType> pollLastEntry()
        +
        +
        Specified by:
        +
        pollLastEntry in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        descendingMap

        +
        public final java.util.NavigableMap<java.lang.String,ValueType> descendingMap()
        +
        +
        Specified by:
        +
        descendingMap in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        navigableKeySet

        +
        @NotNull
        +public final @NotNull java.util.NavigableSet<java.lang.String> navigableKeySet()
        +
        +
        Specified by:
        +
        navigableKeySet in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        descendingKeySet

        +
        public final java.util.NavigableSet<java.lang.String> descendingKeySet()
        +
        +
        Specified by:
        +
        descendingKeySet in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        subMap

        +
        public final java.util.NavigableMap<java.lang.String,ValueType> subMap(java.lang.String fromKey,
        +                                                                       boolean fromInclusive,
        +                                                                       java.lang.String toKey,
        +                                                                       boolean toInclusive)
        +
        +
        Specified by:
        +
        subMap in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        headMap

        +
        public final java.util.NavigableMap<java.lang.String,ValueType> headMap(java.lang.String toKey,
        +                                                                        boolean inclusive)
        +
        +
        Specified by:
        +
        headMap in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        tailMap

        +
        public final java.util.NavigableMap<java.lang.String,ValueType> tailMap(java.lang.String fromKey,
        +                                                                        boolean inclusive)
        +
        +
        Specified by:
        +
        tailMap in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        comparator

        +
        public final java.util.Comparator<? super java.lang.String> comparator()
        +
        +
        Specified by:
        +
        comparator in interface java.util.SortedMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        subMap

        +
        public final java.util.SortedMap<java.lang.String,ValueType> subMap(java.lang.String fromKey,
        +                                                                    java.lang.String toKey)
        +
        +
        Specified by:
        +
        subMap in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        Specified by:
        +
        subMap in interface java.util.SortedMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        headMap

        +
        @NotNull
        +public final @NotNull java.util.SortedMap<java.lang.String,ValueType> headMap(java.lang.String toKey)
        +
        +
        Specified by:
        +
        headMap in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        Specified by:
        +
        headMap in interface java.util.SortedMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        tailMap

        +
        @NotNull
        +public final @NotNull java.util.SortedMap<java.lang.String,ValueType> tailMap(java.lang.String fromKey)
        +
        +
        Specified by:
        +
        tailMap in interface java.util.NavigableMap<java.lang.String,ValueType>
        +
        Specified by:
        +
        tailMap in interface java.util.SortedMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        firstKey

        +
        public final java.lang.String firstKey()
        +
        +
        Specified by:
        +
        firstKey in interface java.util.SortedMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + +
        +
      • +

        lastKey

        +
        public final java.lang.String lastKey()
        +
        +
        Specified by:
        +
        lastKey in interface java.util.SortedMap<java.lang.String,ValueType>
        +
        +
      • +
      + + + + +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/UnmodifiableSortedTrie.html b/doc/javadoc/de/mrapp/tries/datastructure/UnmodifiableSortedTrie.html new file mode 100644 index 0000000..3c596de --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/UnmodifiableSortedTrie.html @@ -0,0 +1,817 @@ + + + + + +UnmodifiableSortedTrie + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class UnmodifiableSortedTrie<SequenceType extends Sequence,ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    SortedTrie<SequenceType,ValueType>, Trie<SequenceType,ValueType>, java.io.Serializable, java.util.Map<SequenceType,ValueType>, java.util.NavigableMap<SequenceType,ValueType>, java.util.SortedMap<SequenceType,ValueType>
    +
    +
    +
    +
    public class UnmodifiableSortedTrie<SequenceType extends Sequence,ValueType>
    +extends AbstractUnmodifiableTrie<SequenceType,ValueType,SortedTrie<SequenceType,ValueType>>
    +implements SortedTrie<SequenceType,ValueType>
    +
    An immutable SortedTrie.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+ +
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/UnmodifiableStringTrie.html b/doc/javadoc/de/mrapp/tries/datastructure/UnmodifiableStringTrie.html new file mode 100644 index 0000000..b0e8271 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/UnmodifiableStringTrie.html @@ -0,0 +1,332 @@ + + + + + +UnmodifiableStringTrie + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class UnmodifiableStringTrie<ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    StringTrie<ValueType>, java.io.Serializable, java.util.Map<java.lang.String,ValueType>
    +
    +
    +
    +
    public class UnmodifiableStringTrie<ValueType>
    +extends AbstractUnmodifiableStringTrie<ValueType,StringTrie<ValueType>>
    +
    An immutable StringTrie.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        UnmodifiableStringTrie

        +
        public UnmodifiableStringTrie(@NotNull
        +                              @NotNull StringTrie<ValueType> trie)
        +
        Creates a new immutable StringTrie.
        +
        +
        Parameters:
        +
        trie - The trie, which should be encapsulated, as an instance of the type StringTrie. The trie may not be null
        +
        +
      • +
      +
    • +
    + + +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/UnmodifiableTrie.html b/doc/javadoc/de/mrapp/tries/datastructure/UnmodifiableTrie.html new file mode 100644 index 0000000..738f812 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/UnmodifiableTrie.html @@ -0,0 +1,350 @@ + + + + + +UnmodifiableTrie + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure
+

Class UnmodifiableTrie<SequenceType extends Sequence,ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    Trie<SequenceType,ValueType>, java.io.Serializable, java.util.Map<SequenceType,ValueType>
    +
    +
    +
    +
    public class UnmodifiableTrie<SequenceType extends Sequence,ValueType>
    +extends AbstractUnmodifiableTrie<SequenceType,ValueType,Trie<SequenceType,ValueType>>
    +
    An immutable Trie.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        UnmodifiableTrie

        +
        public UnmodifiableTrie(@NotNull
        +                        @NotNull Trie<SequenceType,ValueType> trie)
        +
        Creates a new immutable Trie.
        +
        +
        Parameters:
        +
        trie - The trie, which should be encapsulated, as an instance of the type Trie. + The trie may not be null
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        subTrie

        +
        @NotNull
        +public final @NotNull Trie<SequenceType,ValueType> subTrie(@NotNull
        +                                                                    SequenceType sequence)
        +
        Description copied from interface: Trie
        +
        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). If the given + sequence corresponds to a key, the key is not included in the subtree. If the given sequence + is not contained by the trie, a 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.

        +
        +
        Parameters:
        +
        sequence - The sequence as an instance of the generic type SequenceType
        +
        Returns:
        +
        The subtree of the node, which corresponds to the given sequence, as an instance of + the type Trie. The subtree may not be null
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/node/AbstractNode.html b/doc/javadoc/de/mrapp/tries/datastructure/node/AbstractNode.html new file mode 100644 index 0000000..25015b4 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/node/AbstractNode.html @@ -0,0 +1,646 @@ + + + + + +AbstractNode + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure.node
+

Class AbstractNode<KeyType extends Sequence,ValueType>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • de.mrapp.tries.datastructure.node.AbstractNode<KeyType,ValueType>
    • +
    +
  • +
+
+
    +
  • +
    +
    Type Parameters:
    +
    KeyType - The type of the keys, which are associated with the node's successors
    +
    ValueType - The type of the node's value
    +
    +
    +
    All Implemented Interfaces:
    +
    Node<KeyType,ValueType>, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<KeyType>
    +
    +
    +
    Direct Known Subclasses:
    +
    HashNode, SortedListNode
    +
    +
    +
    +
    public abstract class AbstractNode<KeyType extends Sequence,ValueType>
    +extends java.lang.Object
    +implements Node<KeyType,ValueType>
    +
    An abstract base for all nodes of a trie.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        cloneSuccessors

        +
        protected final void cloneSuccessors(@NotNull
        +                                     @NotNull Node<KeyType,ValueType> source,
        +                                     @NotNull
        +                                     @NotNull Node<KeyType,ValueType> target)
        +
        Clones all successors of a specific node recursively and adds them to another node.
        +
        +
        Parameters:
        +
        source - The node, whose successors should be cloned, as an instance of the type Node. The node may not be null
        +
        target - The node, the clones should be added to, as an instance of the type Node. The node may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        onAddSuccessor

        +
        @NotNull
        +protected abstract @NotNull Node<KeyType,ValueType> onAddSuccessor(@NotNull
        +                                                                            KeyType key,
        +                                                                            @Nullable
        +                                                                            @Nullable Node<KeyType,ValueType> successor)
        +
        The method, which is invoked on subclasses in order to add a specific successor to the node.
        +
        +
        Parameters:
        +
        key - The key, which corresponds to the successor as an instance of the generic + type KeyType. The key may not be null
        +
        successor - The successor, which should be added, as an instance of the type Node or null, if a new node should be created
        +
        Returns:
        +
        The node, which has been added as a successor, as an instance of the type Node. The node may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        onRemoveSuccessor

        +
        @Nullable
        +protected abstract @Nullable Node<KeyType,ValueType> onRemoveSuccessor(@NotNull
        +                                                                                 KeyType key)
        +
        The method, which is invoked on subclasses in order to remove a specific successor from the + node.
        +
        +
        Parameters:
        +
        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 null
        +
        Returns:
        +
        The successor, which has been removed, as an instance of the type Node or + null, if no successor corresponds to the given key
        +
        +
      • +
      + + + +
        +
      • +

        getNodeValue

        +
        @Nullable
        +public final @Nullable NodeValue<ValueType> getNodeValue()
        +
        Description copied from interface: Node
        +
        Returns the value of the node.
        +
        +
        Specified by:
        +
        getNodeValue in interface Node<KeyType extends Sequence,ValueType>
        +
        Returns:
        +
        The value of the node encapsulated by a NodeValue wrapper or null, if the + node does not correspond to a key, which has been put into the trie
        +
        +
      • +
      + + + +
        +
      • +

        setNodeValue

        +
        @Nullable
        +public final @Nullable NodeValue<ValueType> setNodeValue(@Nullable
        +                                                                   @Nullable NodeValue<ValueType> nodeValue)
        +
        Description copied from interface: Node
        +
        Sets the value of the node.
        +
        +
        Specified by:
        +
        setNodeValue in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        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 trie
        +
        Returns:
        +
        The previous value of the node as an instance of the class NodeValue or null, + if no value was set
        +
        +
      • +
      + + + + + +
        +
      • +

        addSuccessor

        +
        @NotNull
        +public final @NotNull Node<KeyType,ValueType> addSuccessor(@NotNull
        +                                                                    KeyType key,
        +                                                                    @Nullable
        +                                                                    @Nullable Node<KeyType,ValueType> successor)
        +
        Description copied from interface: Node
        +
        Adds a specific successor to the node.
        +
        +
        Specified by:
        +
        addSuccessor in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        key - The key, which corresponds to the successor to be created, as an instance of + the generic type KeyType. The key may not be null
        +
        successor - The successor, which should be added, as an instance of the type Node or null, if the successor should be created
        +
        Returns:
        +
        The successor, which has been added, as an instance of the type Node. The + successor may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        removeSuccessor

        +
        public final void removeSuccessor(@NotNull
        +                                  KeyType key)
        +
        Description copied from interface: Node
        +
        Removes the successor, which corresponds to a specific key.
        +
        +
        Specified by:
        +
        removeSuccessor in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        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 null
        +
        +
      • +
      + + + +
        +
      • +

        getSuccessorValueCount

        +
        public final int getSuccessorValueCount()
        +
        Description copied from interface: Node
        +
        Returns the number of successors for which values are set, i.e. Node.isValueSet() returns + true. All successors of the node are taken into account recursively down to the + leaf nodes.
        +
        +
        Specified by:
        +
        getSuccessorValueCount in interface Node<KeyType extends Sequence,ValueType>
        +
        Returns:
        +
        The number of successor, for which values are set, as an Integer value
        +
        +
      • +
      + + + +
        +
      • +

        increaseSuccessorValueCount

        +
        public final void increaseSuccessorValueCount(int by)
        +
        Description copied from interface: Node
        +
        Increases the number of successors for which values are set by a specific amount. This causes + the number of successors of the node's predecessors to be increased recursively as well.
        +
        +
        Specified by:
        +
        increaseSuccessorValueCount in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        by - The amount, the number of successor should be increased by, as an Integer + value. The amount must be at least 0
        +
        +
      • +
      + + + +
        +
      • +

        decreaseSuccessorValueCount

        +
        public final void decreaseSuccessorValueCount(int by)
        +
        Description copied from interface: Node
        +
        Decreases the number of successors for which values are set by a specific amount. This causes + the number of successors of the node's predecessors to be decreased recursively as well.
        +
        +
        Specified by:
        +
        decreaseSuccessorValueCount in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        by - The amount, the number of successor should be decreased by, as an Integer + value. The amount must be at least 0
        +
        +
      • +
      + + + +
        +
      • +

        getPredecessor

        +
        @Nullable
        +public final java.util.Map.Entry<KeyType,Node<KeyType,ValueType>> getPredecessor()
        +
        Description copied from interface: Node
        +
        Returns the predecessor of the node.
        +
        +
        Specified by:
        +
        getPredecessor in interface Node<KeyType extends Sequence,ValueType>
        +
        Returns:
        +
        An entry, which contains the predecessor of this node, 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 is set
        +
        +
      • +
      + + + +
        +
      • +

        setPredecessor

        +
        public final void setPredecessor(@Nullable
        +                                 java.util.Map.Entry<KeyType,Node<KeyType,ValueType>> predecessor)
        +
        Description copied from interface: Node
        +
        Sets the predecessor of the node.
        +
        +
        Specified by:
        +
        setPredecessor in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        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
        +
        +
      • +
      + + + +
        +
      • +

        clone

        +
        public abstract Node<KeyType,ValueType> clone()
        +
        Description copied from interface: Node
        +
        Creates and returns a deep copy of the node and its successors.
        +
        +
        Specified by:
        +
        clone in interface Node<KeyType extends Sequence,ValueType>
        +
        Overrides:
        +
        clone in class java.lang.Object
        +
        Returns:
        +
        The copy, which has been created, as an instance of the type Node
        +
        +
      • +
      + + + +
        +
      • +

        hashCode

        +
        public int hashCode()
        +
        +
        Overrides:
        +
        hashCode in class java.lang.Object
        +
        +
      • +
      + + + +
        +
      • +

        equals

        +
        public boolean equals(java.lang.Object obj)
        +
        +
        Overrides:
        +
        equals in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/node/HashNode.html b/doc/javadoc/de/mrapp/tries/datastructure/node/HashNode.html new file mode 100644 index 0000000..11fa8d5 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/node/HashNode.html @@ -0,0 +1,506 @@ + + + + + +HashNode + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure.node
+

Class HashNode<KeyType extends Sequence,ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    KeyType - The type of the keys, which are associated with the node's successors
    +
    ValueType - The type of the node's value
    +
    +
    +
    All Implemented Interfaces:
    +
    Node<KeyType,ValueType>, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<KeyType>
    +
    +
    +
    +
    public class HashNode<KeyType extends Sequence,ValueType>
    +extends AbstractNode<KeyType,ValueType>
    +
    A node of a trie, which stores its successors in a HashMap.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HashNode

        +
        public HashNode()
        +
        Creates a new node of a trie, which stores its successors in a HashMap.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        onAddSuccessor

        +
        @NotNull
        +protected final @NotNull Node<KeyType,ValueType> onAddSuccessor(@NotNull
        +                                                                         KeyType key,
        +                                                                         @Nullable
        +                                                                         @Nullable Node<KeyType,ValueType> successor)
        +
        Description copied from class: AbstractNode
        +
        The method, which is invoked on subclasses in order to add a specific successor to the node.
        +
        +
        Specified by:
        +
        onAddSuccessor in class AbstractNode<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        key - The key, which corresponds to the successor as an instance of the generic + type KeyType. The key may not be null
        +
        successor - The successor, which should be added, as an instance of the type Node or null, if a new node should be created
        +
        Returns:
        +
        The node, which has been added as a successor, as an instance of the type Node. The node may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        onRemoveSuccessor

        +
        protected final Node<KeyType,ValueType> onRemoveSuccessor(@NotNull
        +                                                          KeyType key)
        +
        Description copied from class: AbstractNode
        +
        The method, which is invoked on subclasses in order to remove a specific successor from the + node.
        +
        +
        Specified by:
        +
        onRemoveSuccessor in class AbstractNode<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        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 null
        +
        Returns:
        +
        The successor, which has been removed, as an instance of the type Node or + null, if no successor corresponds to the given key
        +
        +
      • +
      + + + + + +
        +
      • +

        getSuccessor

        +
        @Nullable
        +public final @Nullable Node<KeyType,ValueType> getSuccessor(@NotNull
        +                                                                      KeyType key)
        +
        Description copied from interface: Node
        +
        Returns the successor of the node, which corresponds to a specific key.
        +
        +
        Parameters:
        +
        key - The key of the successor, which should be returned, as an instance of the generic + type KeyType. The key may not be null
        +
        Returns:
        +
        The successor, which corresponds to the given key, as an instance of the type Node or null, if no successor corresponds to the given key
        +
        +
      • +
      + + + +
        +
      • +

        getSuccessorCount

        +
        public final int getSuccessorCount()
        +
        Description copied from interface: Node
        +
        Returns the number of the node's successors.
        +
        +
        Returns:
        +
        The number of the node's successor as an Integer value
        +
        +
      • +
      + + + +
        +
      • +

        iterator

        +
        @NotNull
        +public final @NotNull java.util.Iterator<KeyType> iterator()
        +
      • +
      + + + + + + + +
        +
      • +

        toString

        +
        public final java.lang.String toString()
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      + + + + + + + + +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/node/SortedListNode.html b/doc/javadoc/de/mrapp/tries/datastructure/node/SortedListNode.html new file mode 100644 index 0000000..12c0685 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/node/SortedListNode.html @@ -0,0 +1,665 @@ + + + + + +SortedListNode + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure.node
+

Class SortedListNode<KeyType extends Sequence,ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    KeyType - The type of the keys, which are associated with the node's successors
    +
    ValueType - The type of the node's value
    +
    +
    +
    All Implemented Interfaces:
    +
    Node<KeyType,ValueType>, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<KeyType>, java.util.RandomAccess
    +
    +
    +
    +
    public class SortedListNode<KeyType extends Sequence,ValueType>
    +extends AbstractNode<KeyType,ValueType>
    +implements java.util.RandomAccess
    +
    A node of a trie, which stores its successors in a SortedArrayList.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SortedListNode

        +
        public SortedListNode(@Nullable
        +                      @Nullable java.util.Comparator<? super KeyType> comparator)
        +
        Creates a new node of a trie, which stores its successors in a sorted list.
        +
        +
        Parameters:
        +
        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
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        onAddSuccessor

        +
        @NotNull
        +protected final @NotNull Node<KeyType,ValueType> onAddSuccessor(@NotNull
        +                                                                         KeyType key,
        +                                                                         @Nullable
        +                                                                         @Nullable Node<KeyType,ValueType> successor)
        +
        Description copied from class: AbstractNode
        +
        The method, which is invoked on subclasses in order to add a specific successor to the node.
        +
        +
        Specified by:
        +
        onAddSuccessor in class AbstractNode<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        key - The key, which corresponds to the successor as an instance of the generic + type KeyType. The key may not be null
        +
        successor - The successor, which should be added, as an instance of the type Node or null, if a new node should be created
        +
        Returns:
        +
        The node, which has been added as a successor, as an instance of the type Node. The node may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        onRemoveSuccessor

        +
        @Nullable
        +protected final @Nullable Node<KeyType,ValueType> onRemoveSuccessor(@NotNull
        +                                                                              KeyType key)
        +
        Description copied from class: AbstractNode
        +
        The method, which is invoked on subclasses in order to remove a specific successor from the + node.
        +
        +
        Specified by:
        +
        onRemoveSuccessor in class AbstractNode<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        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 null
        +
        Returns:
        +
        The successor, which has been removed, as an instance of the type Node or + null, if no successor corresponds to the given key
        +
        +
      • +
      + + + +
        +
      • +

        getSuccessorCount

        +
        public final int getSuccessorCount()
        +
        Description copied from interface: Node
        +
        Returns the number of the node's successors.
        +
        +
        Specified by:
        +
        getSuccessorCount in interface Node<KeyType extends Sequence,ValueType>
        +
        Returns:
        +
        The number of the node's successor as an Integer value
        +
        +
      • +
      + + + + + +
        +
      • +

        getSuccessor

        +
        @Nullable
        +public final @Nullable Node<KeyType,ValueType> getSuccessor(@NotNull
        +                                                                      KeyType key)
        +
        Description copied from interface: Node
        +
        Returns the successor of the node, which corresponds to a specific key.
        +
        +
        Specified by:
        +
        getSuccessor in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        key - The key of the successor, which should be returned, as an instance of the generic + type KeyType. The key may not be null
        +
        Returns:
        +
        The successor, which corresponds to the given key, as an instance of the type Node or null, if no successor corresponds to the given key
        +
        +
      • +
      + + + +
        +
      • +

        getSuccessorKey

        +
        @NotNull
        +public final KeyType getSuccessorKey(int index)
        +
        Description copied from interface: Node
        +
        Returns the key, which corresponds to the successor at a specific index. If the index is + invalid, an IndexOutOfBoundsException is thrown. If the node's successor or are not + sorted, an UnsupportedOperationException is thrown.
        +
        +
        Specified by:
        +
        getSuccessorKey in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        index - The index of the key, which should be returned, as an Integer value
        +
        Returns:
        +
        The key of the successor at the given index as an instance of the generic type KeyType. The key may not be null
        +
        +
      • +
      + + + +
        +
      • +

        getSuccessor

        +
        @NotNull
        +public final @NotNull Node<KeyType,ValueType> getSuccessor(int index)
        +
        Description copied from interface: Node
        +
        Returns the successor at a specific index. If the index is invalid, an IndexOutOfBoundsException is thrown. If the node's successors are not sorted, an UnsupportedOperationException is thrown.
        +
        +
        Specified by:
        +
        getSuccessor in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        index - The index of the successor, which which should be returned, as an Integer value
        +
        Returns:
        +
        The successor at the given index as an instance of the type Node. The + successor may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        indexOf

        +
        public final int indexOf(@NotNull
        +                         KeyType key)
        +
        Description copied from interface: Node
        +
        Returns the index of the successor, which corresponds to a specific key. If the node's + successors are not sorted, an UnsupportedOperationException is thrown.
        +
        +
        Specified by:
        +
        indexOf in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        key - The key of the successor, whose index should be returned, as an instance of the + type KeyType. The key may not be null
        +
        Returns:
        +
        The index of the successor, which corresponds to the given key, as an Integer + value or -1, if no such successor is available
        +
        +
      • +
      + + + + + +
        +
      • +

        indexOfFirstElement

        +
        public final int indexOfFirstElement(@NotNull
        +                                     KeyType key)
        +
        Description copied from interface: Node
        +
        Returns the index of the successor, whose key starts with the first element of another key. + The index is obtained by using a binary search. If the node's successors are not sorted, an + UnsupportedOperationException is thrown.
        +
        +
        Specified by:
        +
        indexOfFirstElement in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        key - The key, whose first element should be searched, as an instance of the generic + type KeyType. The key may not be null
        +
        Returns:
        +
        The index of the successor, whose key starts with the first element of the given key, + as an Integer value or -1, if no such successor is available
        +
        +
      • +
      + + + +
        +
      • +

        removeSuccessor

        +
        public final void removeSuccessor(int index)
        +
        Description copied from interface: Node
        +
        Removes the successor at a specific index. If the index is invalid, an IndexOutOfBoundsException is thrown. If the node's successors are not sorted, an UnsupportedOperationException is thrown.
        +
        +
        Specified by:
        +
        removeSuccessor in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        index - The index of the successor, which should be removed, as an Integer + value
        +
        +
      • +
      + + + +
        +
      • +

        iterator

        +
        @NotNull
        +public final @NotNull java.util.Iterator<KeyType> iterator()
        +
        +
        Specified by:
        +
        iterator in interface java.lang.Iterable<KeyType extends Sequence>
        +
        +
      • +
      + + + + + + + +
        +
      • +

        toString

        +
        public final java.lang.String toString()
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      + + + + + + + + +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/node/UnmodifiableNode.html b/doc/javadoc/de/mrapp/tries/datastructure/node/UnmodifiableNode.html new file mode 100644 index 0000000..cde4c47 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/node/UnmodifiableNode.html @@ -0,0 +1,775 @@ + + + + + +UnmodifiableNode + + + + + + + + + + + + +
+
de.mrapp.tries.datastructure.node
+

Class UnmodifiableNode<KeyType extends Sequence,ValueType>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • de.mrapp.tries.datastructure.node.UnmodifiableNode<KeyType,ValueType>
    • +
    +
  • +
+
+
    +
  • +
    +
    Type Parameters:
    +
    KeyType - The type of the sequences, which correspond to the node's successors
    +
    ValueType - The type of the node's value
    +
    +
    +
    All Implemented Interfaces:
    +
    Node<KeyType,ValueType>, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<KeyType>
    +
    +
    +
    +
    public class UnmodifiableNode<KeyType extends Sequence,ValueType>
    +extends java.lang.Object
    +implements Node<KeyType,ValueType>
    +
    An implementation of the interface Node, which forwards read-only method calls to an + encapsulated node and throws UnsupportedOperationExceptions when calling a method, which + attempts to change the node's state.
    +
    +
    Since:
    +
    1.0.0
    +
    See Also:
    +
    Serialized Form
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        UnmodifiableNode

        +
        public UnmodifiableNode(@NotNull
        +                        @NotNull Node<KeyType,ValueType> node)
        +
        Creates a new immutable node.
        +
        +
        Parameters:
        +
        node - The node, which should be encapsulated, as an instance of the type Node. + The node may not be null
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getNodeValue

        +
        @Nullable
        +public final @Nullable NodeValue<ValueType> getNodeValue()
        +
        Description copied from interface: Node
        +
        Returns the value of the node.
        +
        +
        Specified by:
        +
        getNodeValue in interface Node<KeyType extends Sequence,ValueType>
        +
        Returns:
        +
        The value of the node encapsulated by a NodeValue wrapper or null, if the + node does not correspond to a key, which has been put into the trie
        +
        +
      • +
      + + + +
        +
      • +

        setNodeValue

        +
        @Nullable
        +public final @Nullable NodeValue<ValueType> setNodeValue(@Nullable
        +                                                                   @Nullable NodeValue<ValueType> nodeValue)
        +
        Description copied from interface: Node
        +
        Sets the value of the node.
        +
        +
        Specified by:
        +
        setNodeValue in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        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 trie
        +
        Returns:
        +
        The previous value of the node as an instance of the class NodeValue or null, + if no value was set
        +
        +
      • +
      + + + +
        +
      • +

        getSuccessorCount

        +
        public final int getSuccessorCount()
        +
        Description copied from interface: Node
        +
        Returns the number of the node's successors.
        +
        +
        Specified by:
        +
        getSuccessorCount in interface Node<KeyType extends Sequence,ValueType>
        +
        Returns:
        +
        The number of the node's successor as an Integer value
        +
        +
      • +
      + + + + + +
        +
      • +

        getSuccessor

        +
        @Nullable
        +public final @Nullable Node<KeyType,ValueType> getSuccessor(@NotNull
        +                                                                      KeyType key)
        +
        Description copied from interface: Node
        +
        Returns the successor of the node, which corresponds to a specific key.
        +
        +
        Specified by:
        +
        getSuccessor in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        key - The key of the successor, which should be returned, as an instance of the generic + type KeyType. The key may not be null
        +
        Returns:
        +
        The successor, which corresponds to the given key, as an instance of the type Node or null, if no successor corresponds to the given key
        +
        +
      • +
      + + + +
        +
      • +

        getSuccessorKey

        +
        @NotNull
        +public final KeyType getSuccessorKey(int index)
        +
        Description copied from interface: Node
        +
        Returns the key, which corresponds to the successor at a specific index. If the index is + invalid, an IndexOutOfBoundsException is thrown. If the node's successor or are not + sorted, an UnsupportedOperationException is thrown.
        +
        +
        Specified by:
        +
        getSuccessorKey in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        index - The index of the key, which should be returned, as an Integer value
        +
        Returns:
        +
        The key of the successor at the given index as an instance of the generic type KeyType. The key may not be null
        +
        +
      • +
      + + + +
        +
      • +

        getSuccessor

        +
        @NotNull
        +public final @NotNull Node<KeyType,ValueType> getSuccessor(int index)
        +
        Description copied from interface: Node
        +
        Returns the successor at a specific index. If the index is invalid, an IndexOutOfBoundsException is thrown. If the node's successors are not sorted, an UnsupportedOperationException is thrown.
        +
        +
        Specified by:
        +
        getSuccessor in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        index - The index of the successor, which which should be returned, as an Integer value
        +
        Returns:
        +
        The successor at the given index as an instance of the type Node. The + successor may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        indexOf

        +
        public final int indexOf(@NotNull
        +                         KeyType key)
        +
        Description copied from interface: Node
        +
        Returns the index of the successor, which corresponds to a specific key. If the node's + successors are not sorted, an UnsupportedOperationException is thrown.
        +
        +
        Specified by:
        +
        indexOf in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        key - The key of the successor, whose index should be returned, as an instance of the + type KeyType. The key may not be null
        +
        Returns:
        +
        The index of the successor, which corresponds to the given key, as an Integer + value or -1, if no such successor is available
        +
        +
      • +
      + + + + + +
        +
      • +

        addSuccessor

        +
        @NotNull
        +public final @NotNull Node<KeyType,ValueType> addSuccessor(@NotNull
        +                                                                    KeyType key,
        +                                                                    @Nullable
        +                                                                    @Nullable Node<KeyType,ValueType> successor)
        +
        Description copied from interface: Node
        +
        Adds a specific successor to the node.
        +
        +
        Specified by:
        +
        addSuccessor in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        key - The key, which corresponds to the successor to be created, as an instance of + the generic type KeyType. The key may not be null
        +
        successor - The successor, which should be added, as an instance of the type Node or null, if the successor should be created
        +
        Returns:
        +
        The successor, which has been added, as an instance of the type Node. The + successor may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        removeSuccessor

        +
        public final void removeSuccessor(@NotNull
        +                                  KeyType key)
        +
        Description copied from interface: Node
        +
        Removes the successor, which corresponds to a specific key.
        +
        +
        Specified by:
        +
        removeSuccessor in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        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 null
        +
        +
      • +
      + + + +
        +
      • +

        getSuccessorValueCount

        +
        public final int getSuccessorValueCount()
        +
        Description copied from interface: Node
        +
        Returns the number of successors for which values are set, i.e. Node.isValueSet() returns + true. All successors of the node are taken into account recursively down to the + leaf nodes.
        +
        +
        Specified by:
        +
        getSuccessorValueCount in interface Node<KeyType extends Sequence,ValueType>
        +
        Returns:
        +
        The number of successor, for which values are set, as an Integer value
        +
        +
      • +
      + + + +
        +
      • +

        increaseSuccessorValueCount

        +
        public final void increaseSuccessorValueCount(int by)
        +
        Description copied from interface: Node
        +
        Increases the number of successors for which values are set by a specific amount. This causes + the number of successors of the node's predecessors to be increased recursively as well.
        +
        +
        Specified by:
        +
        increaseSuccessorValueCount in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        by - The amount, the number of successor should be increased by, as an Integer + value. The amount must be at least 0
        +
        +
      • +
      + + + +
        +
      • +

        decreaseSuccessorValueCount

        +
        public final void decreaseSuccessorValueCount(int by)
        +
        Description copied from interface: Node
        +
        Decreases the number of successors for which values are set by a specific amount. This causes + the number of successors of the node's predecessors to be decreased recursively as well.
        +
        +
        Specified by:
        +
        decreaseSuccessorValueCount in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        by - The amount, the number of successor should be decreased by, as an Integer + value. The amount must be at least 0
        +
        +
      • +
      + + + +
        +
      • +

        getPredecessor

        +
        @Nullable
        +public final java.util.Map.Entry<KeyType,Node<KeyType,ValueType>> getPredecessor()
        +
        Description copied from interface: Node
        +
        Returns the predecessor of the node.
        +
        +
        Specified by:
        +
        getPredecessor in interface Node<KeyType extends Sequence,ValueType>
        +
        Returns:
        +
        An entry, which contains the predecessor of this node, 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 is set
        +
        +
      • +
      + + + +
        +
      • +

        setPredecessor

        +
        public final void setPredecessor(@Nullable
        +                                 java.util.Map.Entry<KeyType,Node<KeyType,ValueType>> predecessor)
        +
        Description copied from interface: Node
        +
        Sets the predecessor of the node.
        +
        +
        Specified by:
        +
        setPredecessor in interface Node<KeyType extends Sequence,ValueType>
        +
        Parameters:
        +
        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
        +
        +
      • +
      + + + +
        +
      • +

        iterator

        +
        @NotNull
        +public final @NotNull java.util.Iterator<KeyType> iterator()
        +
        +
        Specified by:
        +
        iterator in interface java.lang.Iterable<KeyType extends Sequence>
        +
        +
      • +
      + + + +
        +
      • +

        clone

        +
        public final Node<KeyType,ValueType> clone()
        +
        Description copied from interface: Node
        +
        Creates and returns a deep copy of the node and its successors.
        +
        +
        Specified by:
        +
        clone in interface Node<KeyType extends Sequence,ValueType>
        +
        Overrides:
        +
        clone in class java.lang.Object
        +
        Returns:
        +
        The copy, which has been created, as an instance of the type Node
        +
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public final java.lang.String toString()
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      + + + +
        +
      • +

        hashCode

        +
        public final int hashCode()
        +
        +
        Overrides:
        +
        hashCode in class java.lang.Object
        +
        +
      • +
      + + + +
        +
      • +

        equals

        +
        public final boolean equals(java.lang.Object obj)
        +
        +
        Overrides:
        +
        equals in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/node/package-frame.html b/doc/javadoc/de/mrapp/tries/datastructure/node/package-frame.html new file mode 100644 index 0000000..dee4e02 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/node/package-frame.html @@ -0,0 +1,23 @@ + + + + + +de.mrapp.tries.datastructure.node + + + + + +

de.mrapp.tries.datastructure.node

+ + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/node/package-summary.html b/doc/javadoc/de/mrapp/tries/datastructure/node/package-summary.html new file mode 100644 index 0000000..f26ee48 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/node/package-summary.html @@ -0,0 +1,162 @@ + + + + + +de.mrapp.tries.datastructure.node + + + + + + + + + + + +
+

Package de.mrapp.tries.datastructure.node

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    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 UnsupportedOperationExceptions when calling a method, which + attempts to change the node's state.
    +
    +
  • +
+
+ + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/node/package-tree.html b/doc/javadoc/de/mrapp/tries/datastructure/node/package-tree.html new file mode 100644 index 0000000..56d302a --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/node/package-tree.html @@ -0,0 +1,141 @@ + + + + + +de.mrapp.tries.datastructure.node Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package de.mrapp.tries.datastructure.node

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • de.mrapp.tries.datastructure.node.AbstractNode<KeyType,ValueType> (implements de.mrapp.tries.Node<KeyType,ValueType>) +
        +
      • de.mrapp.tries.datastructure.node.HashNode<KeyType,ValueType>
      • +
      • de.mrapp.tries.datastructure.node.SortedListNode<KeyType,ValueType> (implements java.util.RandomAccess)
      • +
      +
    • +
    • de.mrapp.tries.datastructure.node.UnmodifiableNode<KeyType,ValueType> (implements de.mrapp.tries.Node<KeyType,ValueType>)
    • +
    +
  • +
+
+ + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/package-frame.html b/doc/javadoc/de/mrapp/tries/datastructure/package-frame.html new file mode 100644 index 0000000..1433b2e --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/package-frame.html @@ -0,0 +1,40 @@ + + + + + +de.mrapp.tries.datastructure + + + + + +

de.mrapp.tries.datastructure

+ + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/package-summary.html b/doc/javadoc/de/mrapp/tries/datastructure/package-summary.html new file mode 100644 index 0000000..4cbce52 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/package-summary.html @@ -0,0 +1,271 @@ + + + + + +de.mrapp.tries.datastructure + + + + + + + + + + + +
+

Package de.mrapp.tries.datastructure

+
+
+ +
+ + + + + + diff --git a/doc/javadoc/de/mrapp/tries/datastructure/package-tree.html b/doc/javadoc/de/mrapp/tries/datastructure/package-tree.html new file mode 100644 index 0000000..c6b9880 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/datastructure/package-tree.html @@ -0,0 +1,184 @@ + + + + + +de.mrapp.tries.datastructure Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package de.mrapp.tries.datastructure

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/doc/javadoc/de/mrapp/tries/package-frame.html b/doc/javadoc/de/mrapp/tries/package-frame.html new file mode 100644 index 0000000..74b8603 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/package-frame.html @@ -0,0 +1,36 @@ + + + + + +de.mrapp.tries + + + + + +

de.mrapp.tries

+ + + diff --git a/doc/javadoc/de/mrapp/tries/package-summary.html b/doc/javadoc/de/mrapp/tries/package-summary.html new file mode 100644 index 0000000..e4da700 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/package-summary.html @@ -0,0 +1,233 @@ + + + + + +de.mrapp.tries + + + + + + + + + + + +
+

Package de.mrapp.tries

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interface Summary 
    InterfaceDescription
    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 Summary 
    ClassDescription
    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.
    +
    +
  • +
+
+ + + + + + diff --git a/doc/javadoc/de/mrapp/tries/package-tree.html b/doc/javadoc/de/mrapp/tries/package-tree.html new file mode 100644 index 0000000..90ee8c9 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/package-tree.html @@ -0,0 +1,215 @@ + + + + + +de.mrapp.tries Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package de.mrapp.tries

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Interface Hierarchy

+
    +
  • java.lang.Cloneable +
      +
    • de.mrapp.tries.Node<KeyType,ValueType> (also extends java.lang.Iterable<T>, java.io.Serializable)
    • +
    +
  • +
  • java.lang.Iterable<T> +
      +
    • de.mrapp.tries.Node<KeyType,ValueType> (also extends java.lang.Cloneable, java.io.Serializable)
    • +
    +
  • +
  • java.util.Map<K,V> +
      +
    • java.util.SortedMap<K,V> +
        +
      • java.util.NavigableMap<K,V> +
          +
        • de.mrapp.tries.SortedStringTrie<ValueType> (also extends de.mrapp.tries.StringTrie<ValueType>)
        • +
        • de.mrapp.tries.SortedTrie<SequenceType,ValueType> (also extends de.mrapp.tries.Trie<SequenceType,ValueType>)
        • +
        +
      • +
      +
    • +
    • de.mrapp.tries.StringTrie<ValueType> (also extends java.io.Serializable) +
        +
      • de.mrapp.tries.SortedStringTrie<ValueType> (also extends java.util.NavigableMap<K,V>)
      • +
      +
    • +
    • de.mrapp.tries.Trie<SequenceType,ValueType> (also extends java.io.Serializable) +
        +
      • de.mrapp.tries.SortedTrie<SequenceType,ValueType> (also extends java.util.NavigableMap<K,V>)
      • +
      +
    • +
    +
  • +
  • java.io.Serializable +
      +
    • de.mrapp.tries.Node<KeyType,ValueType> (also extends java.lang.Cloneable, java.lang.Iterable<T>)
    • +
    • de.mrapp.tries.Sequence
    • +
    • de.mrapp.tries.StringTrie<ValueType> (also extends java.util.Map<K,V>) +
        +
      • de.mrapp.tries.SortedStringTrie<ValueType> (also extends java.util.NavigableMap<K,V>)
      • +
      +
    • +
    • de.mrapp.tries.Trie<SequenceType,ValueType> (also extends java.util.Map<K,V>) +
        +
      • de.mrapp.tries.SortedTrie<SequenceType,ValueType> (also extends java.util.NavigableMap<K,V>)
      • +
      +
    • +
    +
  • +
+
+ + + + + + diff --git a/doc/javadoc/de/mrapp/tries/sequence/StringSequence.html b/doc/javadoc/de/mrapp/tries/sequence/StringSequence.html new file mode 100644 index 0000000..f3423ef --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/sequence/StringSequence.html @@ -0,0 +1,487 @@ + + + + + +StringSequence + + + + + + + + + + + + +
+
de.mrapp.tries.sequence
+

Class StringSequence

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • de.mrapp.tries.sequence.StringSequence
    • +
    +
  • +
+
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        StringSequence

        +
        public StringSequence(@NotNull
        +                      @NotNull java.lang.String string)
        +
        Creates a new character sequence.
        +
        +
        Parameters:
        +
        string - The string, which should back the sequence as a String. The string may + not be null
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        convertToString

        +
        @Nullable
        +public static @Nullable java.lang.String convertToString(@Nullable
        +                                                                   @Nullable StringSequence stringSequence)
        +
        Converts a specific StringSequence to a string.
        +
        +
        Parameters:
        +
        stringSequence - The string sequence to convert as an instance of the class StringSequence or null
        +
        Returns:
        +
        The string, which has been created, as a String or null, if the given string + sequence is null
        +
        +
      • +
      + + + +
        +
      • +

        convertFromString

        +
        @Nullable
        +public static @Nullable StringSequence convertFromString(@Nullable
        +                                                                   @Nullable java.lang.String string)
        +
        Converts a specific String to a string sequence.
        +
        +
        Parameters:
        +
        string - The string to convert as a String or null
        +
        Returns:
        +
        The string sequence, which has been created, as an instance of the class StringSequence or null, if the given string is null
        +
        +
      • +
      + + + +
        +
      • +

        subsequence

        +
        public final Sequence subsequence(int start,
        +                                  int end)
        +
        Description copied from interface: Sequence
        +
        Returns a new sequence, which is a subsequence of this sequence.
        +
        +
        Specified by:
        +
        subsequence in interface Sequence
        +
        Parameters:
        +
        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 thrown
        +
        end - Specifies the index of the last element to be included (exclusive) as an Integer value. If the index is invalid, an IndexOutOfBoundsException + may be thrown
        +
        Returns:
        +
        A new sequence, which consists of the elements within the specified range, as an + instance of the type Sequence. The returned sequence must be a new immutable object + and its class must be the same as the class of the original sequence
        +
        +
      • +
      + + + +
        +
      • +

        concat

        +
        public final Sequence concat(@NotNull
        +                             @NotNull Sequence sequence)
        +
        Description copied from interface: Sequence
        +
        Concatenates this sequence with another one.
        +
        +
        Specified by:
        +
        concat in interface Sequence
        +
        Parameters:
        +
        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 thrown
        +
        Returns:
        +
        A new sequence, which contains this sequences as a prefix and the given one as a + suffix, as an instance of the type Sequence. The returned sequence must be a new + immutable object and its class must be the same as the class of the original sequence
        +
        +
      • +
      + + + +
        +
      • +

        length

        +
        public final int length()
        +
        Description copied from interface: Sequence
        +
        Returns the length of the sequence.
        +
        +
        Specified by:
        +
        length in interface Sequence
        +
        Returns:
        +
        The length of the sequence as an Integer value. The length must be at least 0
        +
        +
      • +
      + + + +
        +
      • +

        compareTo

        +
        public final int compareTo(@NotNull
        +                           @NotNull StringSequence o)
        +
        +
        Specified by:
        +
        compareTo in interface java.lang.Comparable<StringSequence>
        +
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public final java.lang.String toString()
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      + + + +
        +
      • +

        hashCode

        +
        public final int hashCode()
        +
        +
        Overrides:
        +
        hashCode in class java.lang.Object
        +
        +
      • +
      + + + +
        +
      • +

        equals

        +
        public final boolean equals(java.lang.Object obj)
        +
        +
        Overrides:
        +
        equals in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/sequence/package-frame.html b/doc/javadoc/de/mrapp/tries/sequence/package-frame.html new file mode 100644 index 0000000..35bd46f --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/sequence/package-frame.html @@ -0,0 +1,20 @@ + + + + + +de.mrapp.tries.sequence + + + + + +

de.mrapp.tries.sequence

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/de/mrapp/tries/sequence/package-summary.html b/doc/javadoc/de/mrapp/tries/sequence/package-summary.html new file mode 100644 index 0000000..9fb7581 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/sequence/package-summary.html @@ -0,0 +1,142 @@ + + + + + +de.mrapp.tries.sequence + + + + + + + + + + + +
+

Package de.mrapp.tries.sequence

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    StringSequence +
    A character sequence, which is backed by a String.
    +
    +
  • +
+
+ + + + + + diff --git a/doc/javadoc/de/mrapp/tries/sequence/package-tree.html b/doc/javadoc/de/mrapp/tries/sequence/package-tree.html new file mode 100644 index 0000000..9a92dd6 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/sequence/package-tree.html @@ -0,0 +1,135 @@ + + + + + +de.mrapp.tries.sequence Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package de.mrapp.tries.sequence

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+
+ + + + + + diff --git a/doc/javadoc/de/mrapp/tries/structure/PatriciaStructure.html b/doc/javadoc/de/mrapp/tries/structure/PatriciaStructure.html new file mode 100644 index 0000000..38b6dd1 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/structure/PatriciaStructure.html @@ -0,0 +1,514 @@ + + + + + +PatriciaStructure + + + + + + + + + + + + +
+
de.mrapp.tries.structure
+

Class PatriciaStructure<SequenceType extends Sequence,ValueType>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • de.mrapp.tries.structure.PatriciaStructure<SequenceType,ValueType>
    • +
    +
  • +
+
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    SortedStructure<SequenceType,ValueType>, Structure<SequenceType,ValueType>
    +
    +
    +
    +
    public class PatriciaStructure<SequenceType extends Sequence,ValueType>
    +extends java.lang.Object
    +implements SortedStructure<SequenceType,ValueType>
    +
    Defines the structure of a Patricia trie, where 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.
    +
    +
    Since:
    +
    1.0.0
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        PatriciaStructure

        +
        public PatriciaStructure()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        onGetSuccessor

        +
        @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)
        +
        Description copied from interface: Structure
        +
        The method, which is invoked in order to retrieve the successor of a specific node, which + corresponds to a specific sequence. Depending on the trie's structure, the suffix of the + sequence can be processed to any extend.
        +
        +
        Specified by:
        +
        onGetSuccessor in interface Structure<SequenceType extends Sequence,ValueType>
        +
        Parameters:
        +
        node - The node, whose successor should be returned, as an instance of the type + Node. The node may not be null
        +
        sequence - The sequence, the successor corresponds to, as an instance of the generic + type SequenceType. The sequence may neither be null, nor empty
        +
        operation - The operation, the method invocation is part of, as a value of the enum + Structure.Operation. The operation may not be null
        +
        Returns:
        +
        A pair, which contains the successor, which corresponds to the given sequence, as + well as the suffix of the sequence, depending on how far it has been processed, as an + instance of the class Pair or null, if no matching successor is available
        +
        +
      • +
      + + + + + +
        +
      • +

        onAddSuccessor

        +
        @NotNull
        +public final @NotNull de.mrapp.util.datastructure.Pair<Node<SequenceType,ValueType>,SequenceType> onAddSuccessor(@NotNull
        +                                                                                                                          @NotNull Node<SequenceType,ValueType> node,
        +                                                                                                                          @NotNull
        +                                                                                                                          SequenceType sequence)
        +
        Description copied from interface: Structure
        +
        The method, which is invoked in order to add a successor to a specific node. Depending on the + trie's structure, the given sequence can be processed to any extend.
        +
        +
        Specified by:
        +
        onAddSuccessor in interface Structure<SequenceType extends Sequence,ValueType>
        +
        Parameters:
        +
        node - The node, the successor should be added to, as an instance of the type Node. The node may not be null
        +
        sequence - 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 empty
        +
        Returns:
        +
        A pair, which contains the successor, which has been created, as well as the suffix + of the given sequence, depending on how far it has been processed, as an instance of the + class Pair. The pair may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        onRemoveSuccessor

        +
        public final void onRemoveSuccessor(@NotNull
        +                                    @NotNull Node<SequenceType,ValueType> node,
        +                                    @NotNull
        +                                    SequenceType sequence)
        +
        Description copied from interface: Structure
        +
        The method, which is invoked on subclasses in order to remove the successor, which + corresponds to a specific sequence, from a specific node. Depending on the trie's structure + the given sequence can be processed to any extend.
        +
        +
        Specified by:
        +
        onRemoveSuccessor in interface Structure<SequenceType extends Sequence,ValueType>
        +
        Parameters:
        +
        node - The node, the successor should be removed from, as an instance of the type + Node. The node may not be null
        +
        sequence - 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 empty
        +
        +
      • +
      + + + +
        +
      • +

        onDeletedValue

        +
        public final void onDeletedValue(@NotNull
        +                                 @NotNull Node<SequenceType,ValueType> node)
        +
        Description copied from interface: Structure
        +
        The method, which is invoked on subclasses, when the value of a not was deleted. This + happens, when a key, which corresponds to an inner node, has been removed. This method may be + overridden by subclasses in order to adapt the structure of the trie.
        +
        +
        Specified by:
        +
        onDeletedValue in interface Structure<SequenceType extends Sequence,ValueType>
        +
        Parameters:
        +
        node - The node, whose values was deleted, as an instance of the type Node. The + node may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        getSubTrie

        +
        @NotNull
        +public final @NotNull Node<SequenceType,ValueType> getSubTrie(@Nullable
        +                                                                       SequenceType sequence,
        +                                                                       @NotNull
        +                                                                       @NotNull Node<SequenceType,ValueType> rootNode,
        +                                                                       @NotNull
        +                                                                       @NotNull Node<SequenceType,ValueType> node)
        +
        Description copied from interface: Structure
        +
        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).
        +
        +
        Specified by:
        +
        getSubTrie in interface Structure<SequenceType extends Sequence,ValueType>
        +
        Parameters:
        +
        sequence - The sequence as an instance of the generic type SequenceType. The + sequence may not be null
        +
        rootNode - The root node of the subtree, which should be returned, as an instance of the + type Node. The root node may not be null
        +
        node - The node, which corresponds the given sequence as an instance of the type + Node. The node may not be null
        +
        Returns:
        +
        The root node of the subtree as an instance of the type Node. The root node + may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        indexOf

        +
        @Nullable
        +public final @Nullable de.mrapp.util.datastructure.Pair<java.lang.Integer,SequenceType> indexOf(@NotNull
        +                                                                                                          @NotNull Node<SequenceType,ValueType> node,
        +                                                                                                          @NotNull
        +                                                                                                          SequenceType sequence)
        +
        Description copied from interface: SortedStructure
        +
        The method, which is invoked in order to identify the index of a node's successor, which + corresponds to a specific sequence.
        +
        +
        Specified by:
        +
        indexOf in interface SortedStructure<SequenceType extends Sequence,ValueType>
        +
        Parameters:
        +
        node - The node, whose successors should be checked, as an instance of the type + Node. The node may not be null
        +
        sequence - The sequence, the successor, whose index should be returned, corresponds to, + as an Integer value
        +
        Returns:
        +
        The index of the successor, which corresponds to the given sequence, as an Integer value or -1, if no such successor is available for the given node
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/structure/SortedStructure.html b/doc/javadoc/de/mrapp/tries/structure/SortedStructure.html new file mode 100644 index 0000000..d5eb324 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/structure/SortedStructure.html @@ -0,0 +1,283 @@ + + + + + +SortedStructure + + + + + + + + + + + + +
+
de.mrapp.tries.structure
+

Interface SortedStructure<K extends Sequence,V>

+
+
+
+
    +
  • +
    +
    Type Parameters:
    +
    K - The type of the sequences, which are used as the trie's keys
    +
    V - The type of the values, which are stored by the trie
    +
    +
    +
    All Superinterfaces:
    +
    Structure<K,V>
    +
    +
    +
    All Known Implementing Classes:
    +
    PatriciaStructure, UncompressedSortedStructure
    +
    +
    +
    +
    public interface SortedStructure<K extends Sequence,V>
    +extends Structure<K,V>
    +
    Defines the interface, a class, which defines the structure of a sorted trie, must implement. In + addition to the method of the interface Structure, this interface also provides a method + for retrieving the index of the successor, which corresponds to a specific sequence.
    +
    +
    Since:
    +
    1.0.0
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        indexOf

        +
        @Nullable
        +@Nullable de.mrapp.util.datastructure.Pair<java.lang.Integer,K> indexOf(@NotNull
        +                                                                                  @NotNull Node<K,V> node,
        +                                                                                  @NotNull
        +                                                                                  K sequence)
        +
        The method, which is invoked in order to identify the index of a node's successor, which + corresponds to a specific sequence.
        +
        +
        Parameters:
        +
        node - The node, whose successors should be checked, as an instance of the type + Node. The node may not be null
        +
        sequence - The sequence, the successor, whose index should be returned, corresponds to, + as an Integer value
        +
        Returns:
        +
        The index of the successor, which corresponds to the given sequence, as an Integer value or -1, if no such successor is available for the given node
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/structure/Structure.Operation.html b/doc/javadoc/de/mrapp/tries/structure/Structure.Operation.html new file mode 100644 index 0000000..2d44797 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/structure/Structure.Operation.html @@ -0,0 +1,380 @@ + + + + + +Structure.Operation + + + + + + + + + + + + +
+
de.mrapp.tries.structure
+

Enum Structure.Operation

+
+
+
    +
  • java.lang.Object
  • +
  • + +
  • +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Summary

      + + + + + + + + + + + + + + + + + +
      Enum Constants 
      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.
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static Structure.OperationvalueOf(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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Detail

      + + + +
        +
      • +

        GET

        +
        public static final Structure.Operation GET
        +
        An operation, which retrieves data from the trie.
        +
      • +
      + + + +
        +
      • +

        REMOVE

        +
        public static final Structure.Operation REMOVE
        +
        An operation, which removes data from the trie.
        +
      • +
      + + + +
        +
      • +

        PUT

        +
        public static final Structure.Operation PUT
        +
        An operation, which puts data into the trie.
        +
      • +
      + + + +
        +
      • +

        SUB_TRIE

        +
        public static final Structure.Operation SUB_TRIE
        +
        An operation, which creates a subtrie of the trie.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static Structure.Operation[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (Structure.Operation c : Structure.Operation.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static Structure.Operation valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/structure/Structure.html b/doc/javadoc/de/mrapp/tries/structure/Structure.html new file mode 100644 index 0000000..f0decb6 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/structure/Structure.html @@ -0,0 +1,421 @@ + + + + + +Structure + + + + + + + + + + + + +
+
de.mrapp.tries.structure
+

Interface Structure<SequenceType extends Sequence,ValueType>

+
+
+
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Known Subinterfaces:
    +
    SortedStructure<K,V>
    +
    +
    +
    All Known Implementing Classes:
    +
    PatriciaStructure, UncompressedSortedStructure, UncompressedStructure
    +
    +
    +
    +
    public interface Structure<SequenceType extends Sequence,ValueType>
    +
    Defines the interface, a class, which defines the structure of a trie, must implement. This + interface provides methods, which are invoked when inserting, removing or retrieving keys from a + trie. By implementing these methods accordingly, the structure of the trie can be adjusted.
    +
    +
    Since:
    +
    1.0.0
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        onGetSuccessor

        +
        @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)
        +
        The method, which is invoked in order to retrieve the successor of a specific node, which + corresponds to a specific sequence. Depending on the trie's structure, the suffix of the + sequence can be processed to any extend.
        +
        +
        Parameters:
        +
        node - The node, whose successor should be returned, as an instance of the type + Node. The node may not be null
        +
        sequence - The sequence, the successor corresponds to, as an instance of the generic + type SequenceType. The sequence may neither be null, nor empty
        +
        operation - The operation, the method invocation is part of, as a value of the enum + Structure.Operation. The operation may not be null
        +
        Returns:
        +
        A pair, which contains the successor, which corresponds to the given sequence, as + well as the suffix of the sequence, depending on how far it has been processed, as an + instance of the class Pair or null, if no matching successor is available
        +
        +
      • +
      + + + + + +
        +
      • +

        onAddSuccessor

        +
        @NotNull
        +@NotNull de.mrapp.util.datastructure.Pair<Node<SequenceType,ValueType>,SequenceType> onAddSuccessor(@NotNull
        +                                                                                                             @NotNull Node<SequenceType,ValueType> node,
        +                                                                                                             @NotNull
        +                                                                                                             SequenceType sequence)
        +
        The method, which is invoked in order to add a successor to a specific node. Depending on the + trie's structure, the given sequence can be processed to any extend.
        +
        +
        Parameters:
        +
        node - The node, the successor should be added to, as an instance of the type Node. The node may not be null
        +
        sequence - 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 empty
        +
        Returns:
        +
        A pair, which contains the successor, which has been created, as well as the suffix + of the given sequence, depending on how far it has been processed, as an instance of the + class Pair. The pair may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        onRemoveSuccessor

        +
        void onRemoveSuccessor(@NotNull
        +                       @NotNull Node<SequenceType,ValueType> node,
        +                       @NotNull
        +                       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. Depending on the trie's structure + the given sequence can be processed to any extend.
        +
        +
        Parameters:
        +
        node - The node, the successor should be removed from, as an instance of the type + Node. The node may not be null
        +
        sequence - 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 empty
        +
        +
      • +
      + + + +
        +
      • +

        onDeletedValue

        +
        void onDeletedValue(@NotNull
        +                    @NotNull Node<SequenceType,ValueType> node)
        +
        The method, which is invoked on subclasses, when the value of a not was deleted. This + happens, when a key, which corresponds to an inner node, has been removed. This method may be + overridden by subclasses in order to adapt the structure of the trie.
        +
        +
        Parameters:
        +
        node - The node, whose values was deleted, as an instance of the type Node. The + node may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        getSubTrie

        +
        @NotNull
        +@NotNull Node<SequenceType,ValueType> getSubTrie(@Nullable
        +                                                          SequenceType sequence,
        +                                                          @NotNull
        +                                                          @NotNull Node<SequenceType,ValueType> rootNode,
        +                                                          @NotNull
        +                                                          @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).
        +
        +
        Parameters:
        +
        sequence - The sequence as an instance of the generic type SequenceType. The + sequence may not be null
        +
        rootNode - The root node of the subtree, which should be returned, as an instance of the + type Node. The root node may not be null
        +
        node - The node, which corresponds the given sequence as an instance of the type + Node. The node may not be null
        +
        Returns:
        +
        The root node of the subtree as an instance of the type Node. The root node + may not be null
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/structure/UncompressedSortedStructure.html b/doc/javadoc/de/mrapp/tries/structure/UncompressedSortedStructure.html new file mode 100644 index 0000000..ce733b0 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/structure/UncompressedSortedStructure.html @@ -0,0 +1,343 @@ + + + + + +UncompressedSortedStructure + + + + + + + + + + + + +
+
de.mrapp.tries.structure
+

Class UncompressedSortedStructure<SequenceType extends Sequence,ValueType>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    SortedStructure<SequenceType,ValueType>, Structure<SequenceType,ValueType>
    +
    +
    +
    +
    public class UncompressedSortedStructure<SequenceType extends Sequence,ValueType>
    +extends UncompressedStructure<SequenceType,ValueType>
    +implements SortedStructure<SequenceType,ValueType>
    +
    Defines the structure of an uncompressed sorted trie, where the edges between nodes always + correspond to exactly one element of a sequence.
    +
    +
    Since:
    +
    1.0.0
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        UncompressedSortedStructure

        +
        public UncompressedSortedStructure()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        indexOf

        +
        @Nullable
        +public final @Nullable de.mrapp.util.datastructure.Pair<java.lang.Integer,SequenceType> indexOf(@NotNull
        +                                                                                                          @NotNull Node<SequenceType,ValueType> node,
        +                                                                                                          @NotNull
        +                                                                                                          SequenceType sequence)
        +
        Description copied from interface: SortedStructure
        +
        The method, which is invoked in order to identify the index of a node's successor, which + corresponds to a specific sequence.
        +
        +
        Specified by:
        +
        indexOf in interface SortedStructure<SequenceType extends Sequence,ValueType>
        +
        Parameters:
        +
        node - The node, whose successors should be checked, as an instance of the type + Node. The node may not be null
        +
        sequence - The sequence, the successor, whose index should be returned, corresponds to, + as an Integer value
        +
        Returns:
        +
        The index of the successor, which corresponds to the given sequence, as an Integer value or -1, if no such successor is available for the given node
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/structure/UncompressedStructure.html b/doc/javadoc/de/mrapp/tries/structure/UncompressedStructure.html new file mode 100644 index 0000000..c590aee --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/structure/UncompressedStructure.html @@ -0,0 +1,480 @@ + + + + + +UncompressedStructure + + + + + + + + + + + + +
+
de.mrapp.tries.structure
+

Class UncompressedStructure<SequenceType extends Sequence,ValueType>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • de.mrapp.tries.structure.UncompressedStructure<SequenceType,ValueType>
    • +
    +
  • +
+
+
    +
  • +
    +
    Type Parameters:
    +
    SequenceType - The type of the sequences, which are used as the trie's keys
    +
    ValueType - The type of the values, which are stored by the trie
    +
    +
    +
    All Implemented Interfaces:
    +
    Structure<SequenceType,ValueType>
    +
    +
    +
    Direct Known Subclasses:
    +
    UncompressedSortedStructure
    +
    +
    +
    +
    public class UncompressedStructure<SequenceType extends Sequence,ValueType>
    +extends java.lang.Object
    +implements Structure<SequenceType,ValueType>
    +
    Defines the structure of an uncompressed trie, where the edges between nodes always correspond to + exactly one element of a sequence.
    +
    +
    Since:
    +
    1.0.0
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        UncompressedStructure

        +
        public UncompressedStructure()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        onGetSuccessor

        +
        @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)
        +
        Description copied from interface: Structure
        +
        The method, which is invoked in order to retrieve the successor of a specific node, which + corresponds to a specific sequence. Depending on the trie's structure, the suffix of the + sequence can be processed to any extend.
        +
        +
        Specified by:
        +
        onGetSuccessor in interface Structure<SequenceType extends Sequence,ValueType>
        +
        Parameters:
        +
        node - The node, whose successor should be returned, as an instance of the type + Node. The node may not be null
        +
        sequence - The sequence, the successor corresponds to, as an instance of the generic + type SequenceType. The sequence may neither be null, nor empty
        +
        operation - The operation, the method invocation is part of, as a value of the enum + Structure.Operation. The operation may not be null
        +
        Returns:
        +
        A pair, which contains the successor, which corresponds to the given sequence, as + well as the suffix of the sequence, depending on how far it has been processed, as an + instance of the class Pair or null, if no matching successor is available
        +
        +
      • +
      + + + + + +
        +
      • +

        onAddSuccessor

        +
        @NotNull
        +public final @NotNull de.mrapp.util.datastructure.Pair<Node<SequenceType,ValueType>,SequenceType> onAddSuccessor(@NotNull
        +                                                                                                                          @NotNull Node<SequenceType,ValueType> node,
        +                                                                                                                          @NotNull
        +                                                                                                                          SequenceType sequence)
        +
        Description copied from interface: Structure
        +
        The method, which is invoked in order to add a successor to a specific node. Depending on the + trie's structure, the given sequence can be processed to any extend.
        +
        +
        Specified by:
        +
        onAddSuccessor in interface Structure<SequenceType extends Sequence,ValueType>
        +
        Parameters:
        +
        node - The node, the successor should be added to, as an instance of the type Node. The node may not be null
        +
        sequence - 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 empty
        +
        Returns:
        +
        A pair, which contains the successor, which has been created, as well as the suffix + of the given sequence, depending on how far it has been processed, as an instance of the + class Pair. The pair may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        onRemoveSuccessor

        +
        public final void onRemoveSuccessor(@NotNull
        +                                    @NotNull Node<SequenceType,ValueType> node,
        +                                    @NotNull
        +                                    SequenceType sequence)
        +
        Description copied from interface: Structure
        +
        The method, which is invoked on subclasses in order to remove the successor, which + corresponds to a specific sequence, from a specific node. Depending on the trie's structure + the given sequence can be processed to any extend.
        +
        +
        Specified by:
        +
        onRemoveSuccessor in interface Structure<SequenceType extends Sequence,ValueType>
        +
        Parameters:
        +
        node - The node, the successor should be removed from, as an instance of the type + Node. The node may not be null
        +
        sequence - 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 empty
        +
        +
      • +
      + + + +
        +
      • +

        onDeletedValue

        +
        public final void onDeletedValue(@NotNull
        +                                 @NotNull Node<SequenceType,ValueType> node)
        +
        Description copied from interface: Structure
        +
        The method, which is invoked on subclasses, when the value of a not was deleted. This + happens, when a key, which corresponds to an inner node, has been removed. This method may be + overridden by subclasses in order to adapt the structure of the trie.
        +
        +
        Specified by:
        +
        onDeletedValue in interface Structure<SequenceType extends Sequence,ValueType>
        +
        Parameters:
        +
        node - The node, whose values was deleted, as an instance of the type Node. The + node may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        getSubTrie

        +
        @NotNull
        +public final @NotNull Node<SequenceType,ValueType> getSubTrie(@Nullable
        +                                                                       SequenceType sequence,
        +                                                                       @NotNull
        +                                                                       @NotNull Node<SequenceType,ValueType> rootNode,
        +                                                                       @NotNull
        +                                                                       @NotNull Node<SequenceType,ValueType> node)
        +
        Description copied from interface: Structure
        +
        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).
        +
        +
        Specified by:
        +
        getSubTrie in interface Structure<SequenceType extends Sequence,ValueType>
        +
        Parameters:
        +
        sequence - The sequence as an instance of the generic type SequenceType. The + sequence may not be null
        +
        rootNode - The root node of the subtree, which should be returned, as an instance of the + type Node. The root node may not be null
        +
        node - The node, which corresponds the given sequence as an instance of the type + Node. The node may not be null
        +
        Returns:
        +
        The root node of the subtree as an instance of the type Node. The root node + may not be null
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/structure/package-frame.html b/doc/javadoc/de/mrapp/tries/structure/package-frame.html new file mode 100644 index 0000000..6e6845e --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/structure/package-frame.html @@ -0,0 +1,31 @@ + + + + + +de.mrapp.tries.structure + + + + + +

de.mrapp.tries.structure

+ + + diff --git a/doc/javadoc/de/mrapp/tries/structure/package-summary.html b/doc/javadoc/de/mrapp/tries/structure/package-summary.html new file mode 100644 index 0000000..b07de8f --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/structure/package-summary.html @@ -0,0 +1,197 @@ + + + + + +de.mrapp.tries.structure + + + + + + + + + + + +
+

Package de.mrapp.tries.structure

+
+
+
    +
  • + + + + + + + + + + + + + + + + +
    Interface Summary 
    InterfaceDescription
    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 Summary 
    ClassDescription
    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 Summary 
    EnumDescription
    Structure.Operation +
    An enum, which contains all types of operations, which can be performed on a trie.
    +
    +
  • +
+
+ + + + + + diff --git a/doc/javadoc/de/mrapp/tries/structure/package-tree.html b/doc/javadoc/de/mrapp/tries/structure/package-tree.html new file mode 100644 index 0000000..cd7220a --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/structure/package-tree.html @@ -0,0 +1,160 @@ + + + + + +de.mrapp.tries.structure Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package de.mrapp.tries.structure

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Interface Hierarchy

+ +

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ + + + + + diff --git a/doc/javadoc/de/mrapp/tries/util/EntryUtil.html b/doc/javadoc/de/mrapp/tries/util/EntryUtil.html new file mode 100644 index 0000000..2fe73aa --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/util/EntryUtil.html @@ -0,0 +1,334 @@ + + + + + +EntryUtil + + + + + + + + + + + + +
+
de.mrapp.tries.util
+

Class EntryUtil

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • de.mrapp.tries.util.EntryUtil
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public final class EntryUtil
    +extends java.lang.Object
    +
    An utility class, which provides static methods for handling instances of the type Map.Entry.
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <K> KgetKey(java.util.Map.Entry<K,?> entry) +
      Returns the key of a specific entry or null, if the entry is null.
      +
      static <K> KgetKeyOrThrowException(java.util.Map.Entry<K,?> entry) +
      Returns the key of a specific entry or throws a NoSuchElementException, if the entry + is null.
      +
      static booleanisEqual(@Nullable java.lang.Object o1, + @Nullable java.lang.Object o2) +
      Returns, whether two objects are equal, or not.
      +
      static booleanisValueEqual(@NotNull Node<?,?> node, + java.util.Map.Entry<?,?> entry) +
      Returns, whether the values of a specific node and entry are equal, or not.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        isValueEqual

        +
        public static boolean isValueEqual(@NotNull
        +                                   @NotNull Node<?,?> node,
        +                                   @NotNull
        +                                   java.util.Map.Entry<?,?> entry)
        +
        Returns, whether the values of a specific node and entry are equal, or not.
        +
        +
        Parameters:
        +
        node - The node as an instance of the type Node. The node may not be null
        +
        entry - The entry as an instance of the type Map.Entry. The entry may not be + null
        +
        Returns:
        +
        True, if the values of the given node and entry are equal, false otherwise
        +
        +
      • +
      + + + +
        +
      • +

        isEqual

        +
        public static boolean isEqual(@Nullable
        +                              @Nullable java.lang.Object o1,
        +                              @Nullable
        +                              @Nullable java.lang.Object o2)
        +
        Returns, whether two objects are equal, or not.
        +
        +
        Parameters:
        +
        o1 - The first object as an instance of the class Object or null
        +
        o2 - The second object as an instance of the class Object or null
        +
        Returns:
        +
        True, if the given objects are equal, false otherwise
        +
        +
      • +
      + + + +
        +
      • +

        getKey

        +
        @Nullable
        +public static <K> K getKey(@Nullable
        +                                     java.util.Map.Entry<K,?> entry)
        +
        Returns the key of a specific entry or null, if the entry is null.
        +
        +
        Type Parameters:
        +
        K - The type of the entry's key
        +
        Parameters:
        +
        entry - The entry, whose key should be returned, as an instance of the type Map.Entry or null
        +
        Returns:
        +
        The key of the given entry as an instance of the generic type K or null, if + the key or the given entry is null
        +
        +
      • +
      + + + +
        +
      • +

        getKeyOrThrowException

        +
        @Nullable
        +public static <K> K getKeyOrThrowException(@Nullable
        +                                                     java.util.Map.Entry<K,?> entry)
        +
        Returns the key of a specific entry or throws a NoSuchElementException, if the entry + is null.
        +
        +
        Type Parameters:
        +
        K - The type of the entry's key
        +
        Parameters:
        +
        entry - The entry, whose key should be returned, as an instance of the type Map.Entry or null
        +
        Returns:
        +
        The key of the given entry as an instance of the generic type K or null, if + the key is null
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/util/SequenceUtil.html b/doc/javadoc/de/mrapp/tries/util/SequenceUtil.html new file mode 100644 index 0000000..ff95a5d --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/util/SequenceUtil.html @@ -0,0 +1,466 @@ + + + + + +SequenceUtil + + + + + + + + + + + + +
+
de.mrapp.tries.util
+

Class SequenceUtil

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • de.mrapp.tries.util.SequenceUtil
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class SequenceUtil
    +extends java.lang.Object
    +
    An utility class, which provides methods for handling sequences.
    +
    +
    Since:
    +
    1.0.0
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <T extends Sequence>
      int
      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>
      @NotNull java.util.Comparator<? super T>
      comparator(@Nullable java.util.Comparator<? super T> comparator) +
      Creates and returns a comparator, which allows to compare sequences.
      +
      static <T extends Sequence>
      T
      concat(T prefix, + T suffix) +
      Concatenates two sequences.
      +
      static <T extends Sequence>
      T
      getCommonPrefix(T sequence1, + T sequence2) +
      Returns the longest common prefix of two sequences.
      +
      static booleanisEmpty(@Nullable Sequence sequence) +
      Returns, whether a specific sequence is null or empty.
      +
      static <T extends Sequence>
      T
      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>
      T
      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.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        isEmpty

        +
        public static boolean isEmpty(@Nullable
        +                              @Nullable Sequence sequence)
        +
        Returns, whether a specific sequence is null or empty.
        +
        +
        Parameters:
        +
        sequence - The sequence, which should be checked, as an instance of the type Sequence or null
        +
        Returns:
        +
        True, if the given sequence is null or empty, false otherwise
        +
        +
      • +
      + + + + + +
        +
      • +

        subsequence

        +
        @NotNull
        +public static <T extends Sequence> T subsequence(@NotNull
        +                                                          T sequence,
        +                                                          int start)
        +
        Returns a subsequence of a specific sequence, starting at a specific index and spanning to + the end. If the given start index is invalid, an IndexOutOfBoundsException will be + thrown.
        +
        +
        Type Parameters:
        +
        T - The type of the sequence
        +
        Parameters:
        +
        sequence - The sequence as an instance of the generic type T. The sequence may + not be null
        +
        start - The start index (inclusive) of the subsequence to return as an Integer value
        +
        Returns:
        +
        The subsequence of the given sequence as an instance of the generic type T. + The subsequence may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        subsequence

        +
        @NotNull
        +public static <T extends Sequence> T subsequence(@NotNull
        +                                                          T sequence,
        +                                                          int start,
        +                                                          int end)
        +
        Returns a subsequence of a specific sequence, starting at a specific index and spanning to an + end index. If the given start or end index is invalid, an IndexOutOfBoundsException + will be thrown.
        +
        +
        Type Parameters:
        +
        T - The type of the sequence
        +
        Parameters:
        +
        sequence - The sequence as an instance of the generic type T. The sequence may + not be null
        +
        start - The start index (inclusive) of the subsequence to return as an Integer value
        +
        end - The end index (exclusive) of the subsequence to return as an Integer + value
        +
        Returns:
        +
        The subsequence of the given sequence as an instance of the generic type T. + The subsequence may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        concat

        +
        public static <T extends Sequence> T concat(@Nullable
        +                                            T prefix,
        +                                            @Nullable
        +                                            T suffix)
        +
        Concatenates two sequences. If one of the given sequences is null, the other one is returned. + If both are null, null is returned.
        +
        +
        Type Parameters:
        +
        T - The type of the sequences
        +
        Parameters:
        +
        prefix - 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
        +
        Returns:
        +
        The concatenated sequence as an instance of the generic type T or null, if + both of the given sequences are null
        +
        +
      • +
      + + + +
        +
      • +

        comparator

        +
        @NotNull
        +public static <T extends Sequence> @NotNull java.util.Comparator<? super T> comparator(@Nullable
        +                                                                                                @Nullable java.util.Comparator<? super T> comparator)
        +
        Creates and returns a comparator, which allows to compare sequences.
        +
        +
        Type Parameters:
        +
        T - The type of the sequences
        +
        Parameters:
        +
        comparator - 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 used
        +
        Returns:
        +
        The comparator, which has been created, as an instance of the type Comparator. The comparator may not be null
        +
        +
      • +
      + + + + + +
        +
      • +

        getCommonPrefix

        +
        @Nullable
        +public static <T extends Sequence> T getCommonPrefix(@NotNull
        +                                                               T sequence1,
        +                                                               @NotNull
        +                                                               T sequence2)
        +
        Returns the longest common prefix of two sequences.
        +
        +
        Type Parameters:
        +
        T - The type of the sequences
        +
        Parameters:
        +
        sequence1 - The first sequence as an instance of the generic type T. The + sequence may not be null
        +
        sequence2 - The second sequence as an instance of the generic type T. The + sequence may not be null
        +
        Returns:
        +
        The longest common prefix of the given sequences as an instance of the generic type + T or null, if the sequences do not have a common prefix
        +
        +
      • +
      + + + + + +
        +
      • +

        binarySearch

        +
        public 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)
        +
        Performs a binary search to find a specific sequence.
        +
        +
        Type Parameters:
        +
        T - The type of the sequences
        +
        Parameters:
        +
        size - The total number of sequences as an Integer value
        +
        getter - A function, which returns the corresponding sequence for a given index, as + an instance of the type Function. The function may not be null
        +
        comparator - 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 used
        +
        sequence - The sequence to search for as an instance of the generic type T. + The sequence may not be null
        +
        Returns:
        +
        The index of the given sequence as an Integer value or -1, if the sequence + could not be found
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/doc/javadoc/de/mrapp/tries/util/package-frame.html b/doc/javadoc/de/mrapp/tries/util/package-frame.html new file mode 100644 index 0000000..a45f895 --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/util/package-frame.html @@ -0,0 +1,21 @@ + + + + + +de.mrapp.tries.util + + + + + +

de.mrapp.tries.util

+
+

Classes

+ +
+ + diff --git a/doc/javadoc/de/mrapp/tries/util/package-summary.html b/doc/javadoc/de/mrapp/tries/util/package-summary.html new file mode 100644 index 0000000..94353da --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/util/package-summary.html @@ -0,0 +1,148 @@ + + + + + +de.mrapp.tries.util + + + + + + + + + + + +
+

Package de.mrapp.tries.util

+
+
+
    +
  • + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    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.
    +
    +
  • +
+
+ + + + + + diff --git a/doc/javadoc/de/mrapp/tries/util/package-tree.html b/doc/javadoc/de/mrapp/tries/util/package-tree.html new file mode 100644 index 0000000..dfd326a --- /dev/null +++ b/doc/javadoc/de/mrapp/tries/util/package-tree.html @@ -0,0 +1,136 @@ + + + + + +de.mrapp.tries.util Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package de.mrapp.tries.util

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/doc/javadoc/deprecated-list.html b/doc/javadoc/deprecated-list.html new file mode 100644 index 0000000..4d5dc9d --- /dev/null +++ b/doc/javadoc/deprecated-list.html @@ -0,0 +1,122 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/help-doc.html b/doc/javadoc/help-doc.html new file mode 100644 index 0000000..03adcf8 --- /dev/null +++ b/doc/javadoc/help-doc.html @@ -0,0 +1,223 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    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.

    +
  • +
  • +

    Package

    +

    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:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    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:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    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.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    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.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    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.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    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.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-1.html b/doc/javadoc/index-files/index-1.html new file mode 100644 index 0000000..9544243 --- /dev/null +++ b/doc/javadoc/index-files/index-1.html @@ -0,0 +1,222 @@ + + + + + +A-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

A

+
+
AbstractEmptyTrie<SequenceType extends Sequence,ValueType> - Class in de.mrapp.tries.datastructure
+
+
An abstract base class for all immutable and empty tries.
+
+
AbstractEmptyTrie() - Constructor for class de.mrapp.tries.datastructure.AbstractEmptyTrie
+
 
+
AbstractNode<KeyType extends Sequence,ValueType> - Class in de.mrapp.tries.datastructure.node
+
+
An abstract base for all nodes of a trie.
+
+
AbstractSingletonTrie<SequenceType extends Sequence,ValueType> - Class in de.mrapp.tries.datastructure
+
+
An abstract base class for all immutable tries, which contains only a single entry.
+
+
AbstractSingletonTrie(SequenceType, ValueType) - Constructor for class de.mrapp.tries.datastructure.AbstractSingletonTrie
+
+
Creates a new immutable trie, which only contains a single entry.
+
+
AbstractSortedTrie<SequenceType extends Sequence,ValueType> - Class in de.mrapp.tries.datastructure
+
+
An abstract base class for all sorted tries, whose nodes are ordered by their keys.
+
+
AbstractSortedTrie(Node<SequenceType, ValueType>, Comparator<? super SequenceType>) - Constructor for class de.mrapp.tries.datastructure.AbstractSortedTrie
+
+
Creates a new sorted trie.
+
+
AbstractSortedTrie(Comparator<? super SequenceType>) - Constructor for class de.mrapp.tries.datastructure.AbstractSortedTrie
+
+
Creates a new empty, sorted trie.
+
+
AbstractSortedTrie(Comparator<? super SequenceType>, Map<SequenceType, ValueType>) - Constructor for class de.mrapp.tries.datastructure.AbstractSortedTrie
+
+
Creates a new sorted trie, which contains all key-value pairs that are contained in a map.
+
+
AbstractStringTrieWrapper<TrieType extends Trie<StringSequence,ValueType>,ValueType> - Class in de.mrapp.tries.datastructure
+
+
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> - Class in de.mrapp.tries.datastructure
+
+
An abstract base class for all tries.
+
+
AbstractTrie(Node<SequenceType, ValueType>) - Constructor for class de.mrapp.tries.datastructure.AbstractTrie
+
+
Creates a new trie.
+
+
AbstractTrie() - Constructor for class de.mrapp.tries.datastructure.AbstractTrie
+
+
Creates a new empty trie.
+
+
AbstractTrie(Map<SequenceType, ValueType>) - Constructor for class de.mrapp.tries.datastructure.AbstractTrie
+
+
Creates a new trie, which contains all key-value pairs that are contained in a map.
+
+
AbstractTrie.AbstractKeySet<K extends Sequence,MapType extends java.util.Map<K,?>> - Class in de.mrapp.tries.datastructure
+
+
An abstract base class for all key sets as returned by the Map.keySet() method.
+
+
AbstractTrie.KeySet<K extends Sequence> - Class in de.mrapp.tries.datastructure
+
+
The key set of a trie as returned by the method Map.keySet().
+
+
AbstractUnmodifiableStringTrie<ValueType,TrieType extends StringTrie<ValueType>> - Class in de.mrapp.tries.datastructure
+
+
An abstract base class for all string tries, which forward read-only method calls to an + encapsulated trie and throw UnsupportedOperationExceptions when calling a method, which + attempts to change the trie's state.
+
+
AbstractUnmodifiableStringTrie(TrieType) - Constructor for class de.mrapp.tries.datastructure.AbstractUnmodifiableStringTrie
+
+
Creates a new immutable string trie.
+
+
AbstractUnmodifiableTrie<SequenceType extends Sequence,ValueType,TrieType extends Trie<SequenceType,ValueType>> - Class in de.mrapp.tries.datastructure
+
+
An abstract base class for all tries, which forward read-only method calls to an encapsulated + trie and throw UnsupportedOperationExceptions when calling a method, which attempts to + change the trie's state.
+
+
AbstractUnmodifiableTrie(TrieType) - Constructor for class de.mrapp.tries.datastructure.AbstractUnmodifiableTrie
+
+
Creates a new immutable trie.
+
+
addSuccessor(KeyType, Node<KeyType, ValueType>) - Method in class de.mrapp.tries.datastructure.node.AbstractNode
+
 
+
addSuccessor(KeyType, Node<KeyType, ValueType>) - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
addSuccessor(String, Node<String, ValueType>) - Method in class de.mrapp.tries.datastructure.StringNodeWrapper
+
 
+
addSuccessor(KeyType) - Method in interface de.mrapp.tries.Node
+
+
Creates a new successor and adds it to the node.
+
+
addSuccessor(KeyType, Node<KeyType, ValueType>) - Method in interface de.mrapp.tries.Node
+
+
Adds a specific successor to the node.
+
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-10.html b/doc/javadoc/index-files/index-10.html new file mode 100644 index 0000000..6d10744 --- /dev/null +++ b/doc/javadoc/index-files/index-10.html @@ -0,0 +1,137 @@ + + + + + +K-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

K

+
+
keySet() - Method in class de.mrapp.tries.datastructure.AbstractEmptyTrie
+
 
+
keySet() - Method in class de.mrapp.tries.datastructure.AbstractSingletonTrie
+
 
+
keySet() - Method in class de.mrapp.tries.datastructure.AbstractStringTrieWrapper
+
 
+
keySet() - Method in class de.mrapp.tries.datastructure.AbstractTrie
+
 
+
keySet() - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableStringTrie
+
 
+
keySet() - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableTrie
+
 
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-11.html b/doc/javadoc/index-files/index-11.html new file mode 100644 index 0000000..286ee5a --- /dev/null +++ b/doc/javadoc/index-files/index-11.html @@ -0,0 +1,179 @@ + + + + + +L-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

L

+
+
lastEntry() - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
lastEntry() - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
lastEntry() - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
lastEntry() - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
lastEntry() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
lastEntry() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
lastKey() - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
lastKey() - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
lastKey() - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
lastKey() - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
lastKey() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
lastKey() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
length() - Method in interface de.mrapp.tries.Sequence
+
+
Returns the length of the sequence.
+
+
length() - Method in class de.mrapp.tries.sequence.StringSequence
+
 
+
lowerEntry(SequenceType) - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
lowerEntry(SequenceType) - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
lowerEntry(SequenceType) - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
lowerEntry(String) - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
lowerEntry(String) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
lowerEntry(SequenceType) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
lowerKey(SequenceType) - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
lowerKey(SequenceType) - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
lowerKey(SequenceType) - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
lowerKey(String) - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
lowerKey(String) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
lowerKey(SequenceType) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-12.html b/doc/javadoc/index-files/index-12.html new file mode 100644 index 0000000..9904034 --- /dev/null +++ b/doc/javadoc/index-files/index-12.html @@ -0,0 +1,149 @@ + + + + + +N-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

N

+
+
navigableKeySet() - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
navigableKeySet() - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
navigableKeySet() - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
navigableKeySet() - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
navigableKeySet() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
navigableKeySet() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
Node<KeyType,ValueType> - Interface in de.mrapp.tries
+
+
Defines the interface, a node of a trie must implement.
+
+
NodeValue<T> - Class in de.mrapp.tries
+
+
A wrapper, which encapsulates the value of a trie's node.
+
+
NodeValue(T) - Constructor for class de.mrapp.tries.NodeValue
+
+
Creates a new wrapper, which encapsulates the value of a trie's node.
+
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-13.html b/doc/javadoc/index-files/index-13.html new file mode 100644 index 0000000..b3b1d45 --- /dev/null +++ b/doc/javadoc/index-files/index-13.html @@ -0,0 +1,176 @@ + + + + + +O-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

O

+
+
onAddSuccessor(KeyType, Node<KeyType, ValueType>) - Method in class de.mrapp.tries.datastructure.node.AbstractNode
+
+
The method, which is invoked on subclasses in order to add a specific successor to the node.
+
+
onAddSuccessor(KeyType, Node<KeyType, ValueType>) - Method in class de.mrapp.tries.datastructure.node.HashNode
+
 
+
onAddSuccessor(KeyType, Node<KeyType, ValueType>) - Method in class de.mrapp.tries.datastructure.node.SortedListNode
+
 
+
onAddSuccessor(Node<SequenceType, ValueType>, SequenceType) - Method in class de.mrapp.tries.structure.PatriciaStructure
+
 
+
onAddSuccessor(Node<SequenceType, ValueType>, SequenceType) - Method in interface de.mrapp.tries.structure.Structure
+
+
The method, which is invoked in order to add a successor to a specific node.
+
+
onAddSuccessor(Node<SequenceType, ValueType>, SequenceType) - Method in class de.mrapp.tries.structure.UncompressedStructure
+
 
+
onDeletedValue(Node<SequenceType, ValueType>) - Method in class de.mrapp.tries.structure.PatriciaStructure
+
 
+
onDeletedValue(Node<SequenceType, ValueType>) - Method in interface de.mrapp.tries.structure.Structure
+
+
The method, which is invoked on subclasses, when the value of a not was deleted.
+
+
onDeletedValue(Node<SequenceType, ValueType>) - Method in class de.mrapp.tries.structure.UncompressedStructure
+
 
+
onGetSuccessor(Node<SequenceType, ValueType>, SequenceType, Structure.Operation) - Method in class de.mrapp.tries.structure.PatriciaStructure
+
 
+
onGetSuccessor(Node<SequenceType, ValueType>, SequenceType, Structure.Operation) - Method in interface de.mrapp.tries.structure.Structure
+
+
The method, which is invoked in order to retrieve the successor of a specific node, which + corresponds to a specific sequence.
+
+
onGetSuccessor(Node<SequenceType, ValueType>, SequenceType, Structure.Operation) - Method in class de.mrapp.tries.structure.UncompressedStructure
+
 
+
onRemoveSuccessor(KeyType) - Method in class de.mrapp.tries.datastructure.node.AbstractNode
+
+
The method, which is invoked on subclasses in order to remove a specific successor from the + node.
+
+
onRemoveSuccessor(KeyType) - Method in class de.mrapp.tries.datastructure.node.HashNode
+
 
+
onRemoveSuccessor(KeyType) - Method in class de.mrapp.tries.datastructure.node.SortedListNode
+
 
+
onRemoveSuccessor(Node<SequenceType, ValueType>, SequenceType) - Method in class de.mrapp.tries.structure.PatriciaStructure
+
 
+
onRemoveSuccessor(Node<SequenceType, ValueType>, SequenceType) - Method in interface de.mrapp.tries.structure.Structure
+
+
The method, which is invoked on subclasses in order to remove the successor, which + corresponds to a specific sequence, from a specific node.
+
+
onRemoveSuccessor(Node<SequenceType, ValueType>, SequenceType) - Method in class de.mrapp.tries.structure.UncompressedStructure
+
 
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-14.html b/doc/javadoc/index-files/index-14.html new file mode 100644 index 0000000..1a75fa7 --- /dev/null +++ b/doc/javadoc/index-files/index-14.html @@ -0,0 +1,228 @@ + + + + + +P-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

P

+
+
PatriciaStringTrie<ValueType> - Class in de.mrapp.tries
+
+
A sorted trie, which stores the successors of nodes in sorted lists.
+
+
PatriciaStringTrie() - Constructor for class de.mrapp.tries.PatriciaStringTrie
+
+
Creates a new empty, sorted trie for storing character sequences, which uses sorted lists for + storing the successors of nodes.
+
+
PatriciaStringTrie(Comparator<? super String>) - Constructor for class de.mrapp.tries.PatriciaStringTrie
+
+
Creates a new empty, sorted trie for storing character sequences, which uses sorted lists for + storing the successors of nodes.
+
+
PatriciaStringTrie(Map<String, ValueType>) - Constructor for class de.mrapp.tries.PatriciaStringTrie
+
+
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(Comparator<? super String>, Map<String, ValueType>) - Constructor for class de.mrapp.tries.PatriciaStringTrie
+
+
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.
+
+
PatriciaStructure<SequenceType extends Sequence,ValueType> - Class in de.mrapp.tries.structure
+
+
Defines the structure of a Patricia trie, where the edges between nodes do not always correspond + to a single element of a sequence.
+
+
PatriciaStructure() - Constructor for class de.mrapp.tries.structure.PatriciaStructure
+
 
+
PatriciaTrie<SequenceType extends Sequence,ValueType> - Class in de.mrapp.tries
+
+
A sorted trie, which stores the successor of nodes in sorted lists.
+
+
PatriciaTrie(Node<SequenceType, ValueType>, Comparator<? super SequenceType>) - Constructor for class de.mrapp.tries.PatriciaTrie
+
+
Creates a new Patricia trie.
+
+
PatriciaTrie() - Constructor for class de.mrapp.tries.PatriciaTrie
+
+
Creates a new, empty Patricia trie.
+
+
PatriciaTrie(Map<SequenceType, ValueType>) - Constructor for class de.mrapp.tries.PatriciaTrie
+
+
Creates a new Patricia trie, which contains all key-value pairs that are contained by a map.
+
+
PatriciaTrie(Comparator<? super SequenceType>) - Constructor for class de.mrapp.tries.PatriciaTrie
+
+
Creates a new, empty Patricia trie.
+
+
PatriciaTrie(Comparator<? super SequenceType>, Map<SequenceType, ValueType>) - Constructor for class de.mrapp.tries.PatriciaTrie
+
+
Creates a new Patrica trie, which contains all key-value pairs that are contained by a map.
+
+
pollFirstEntry() - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
pollFirstEntry() - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
pollFirstEntry() - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
pollFirstEntry() - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
pollFirstEntry() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
pollFirstEntry() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
pollLastEntry() - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
pollLastEntry() - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
pollLastEntry() - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
pollLastEntry() - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
pollLastEntry() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
pollLastEntry() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
put(SequenceType, ValueType) - Method in class de.mrapp.tries.datastructure.AbstractEmptyTrie
+
 
+
put(SequenceType, ValueType) - Method in class de.mrapp.tries.datastructure.AbstractSingletonTrie
+
 
+
put(String, ValueType) - Method in class de.mrapp.tries.datastructure.AbstractStringTrieWrapper
+
 
+
put(SequenceType, ValueType) - Method in class de.mrapp.tries.datastructure.AbstractTrie
+
 
+
put(String, ValueType) - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableStringTrie
+
 
+
put(SequenceType, ValueType) - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableTrie
+
 
+
putAll(Map<? extends SequenceType, ? extends ValueType>) - Method in class de.mrapp.tries.datastructure.AbstractEmptyTrie
+
 
+
putAll(Map<? extends SequenceType, ? extends ValueType>) - Method in class de.mrapp.tries.datastructure.AbstractSingletonTrie
+
 
+
putAll(Map<? extends String, ? extends ValueType>) - Method in class de.mrapp.tries.datastructure.AbstractStringTrieWrapper
+
 
+
putAll(Map<? extends SequenceType, ? extends ValueType>) - Method in class de.mrapp.tries.datastructure.AbstractTrie
+
 
+
putAll(Map<? extends String, ? extends ValueType>) - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableStringTrie
+
 
+
putAll(Map<? extends SequenceType, ? extends ValueType>) - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableTrie
+
 
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-15.html b/doc/javadoc/index-files/index-15.html new file mode 100644 index 0000000..33b1207 --- /dev/null +++ b/doc/javadoc/index-files/index-15.html @@ -0,0 +1,159 @@ + + + + + +R-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

R

+
+
remove(Object) - Method in class de.mrapp.tries.datastructure.AbstractEmptyTrie
+
 
+
remove(Object) - Method in class de.mrapp.tries.datastructure.AbstractSingletonTrie
+
 
+
remove(Object) - Method in class de.mrapp.tries.datastructure.AbstractStringTrieWrapper
+
 
+
remove(Object) - Method in class de.mrapp.tries.datastructure.AbstractTrie.AbstractKeySet
+
 
+
remove(Object) - Method in class de.mrapp.tries.datastructure.AbstractTrie
+
 
+
remove(Object) - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableStringTrie
+
 
+
remove(Object) - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableTrie
+
 
+
removeSuccessor(KeyType) - Method in class de.mrapp.tries.datastructure.node.AbstractNode
+
 
+
removeSuccessor(int) - Method in class de.mrapp.tries.datastructure.node.SortedListNode
+
 
+
removeSuccessor(KeyType) - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
removeSuccessor(String) - Method in class de.mrapp.tries.datastructure.StringNodeWrapper
+
 
+
removeSuccessor(KeyType) - Method in interface de.mrapp.tries.Node
+
+
Removes the successor, which corresponds to a specific key.
+
+
removeSuccessor(int) - Method in interface de.mrapp.tries.Node
+
+
Removes the successor at a specific index.
+
+
rootNode - Variable in class de.mrapp.tries.datastructure.AbstractTrie
+
+
The root node of the trie.
+
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-16.html b/doc/javadoc/index-files/index-16.html new file mode 100644 index 0000000..9499939 --- /dev/null +++ b/doc/javadoc/index-files/index-16.html @@ -0,0 +1,414 @@ + + + + + +S-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

S

+
+
Sequence - Interface in de.mrapp.tries
+
+
Defines the interface, a sequence, which can be used as the keys of a Trie or SortedTrie must implement.
+
+
SequenceUtil - Class in de.mrapp.tries.util
+
+
An utility class, which provides methods for handling sequences.
+
+
setNodeValue(NodeValue<ValueType>) - Method in class de.mrapp.tries.datastructure.node.AbstractNode
+
 
+
setNodeValue(NodeValue<ValueType>) - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
setNodeValue(NodeValue<ValueType>) - Method in class de.mrapp.tries.datastructure.StringNodeWrapper
+
 
+
setNodeValue(NodeValue<ValueType>) - Method in interface de.mrapp.tries.Node
+
+
Sets the value of the node.
+
+
setPredecessor(Map.Entry<KeyType, Node<KeyType, ValueType>>) - Method in class de.mrapp.tries.datastructure.node.AbstractNode
+
 
+
setPredecessor(Map.Entry<KeyType, Node<KeyType, ValueType>>) - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
setPredecessor(Map.Entry<String, Node<String, ValueType>>) - Method in class de.mrapp.tries.datastructure.StringNodeWrapper
+
 
+
setPredecessor(Map.Entry<KeyType, Node<KeyType, ValueType>>) - Method in interface de.mrapp.tries.Node
+
+
Sets the predecessor of the node.
+
+
singletonSortedStringTrie(String, V) - Static method in class de.mrapp.tries.Tries
+
+
Returns an immutable SortedStringTrie, which only contains a single entry.
+
+
SingletonSortedTrie<SequenceType extends Sequence,ValueType> - Class in de.mrapp.tries.datastructure
+
+
An immutable SortedTrie, which contains only a single entry.
+
+
SingletonSortedTrie(SequenceType, ValueType) - Constructor for class de.mrapp.tries.datastructure.SingletonSortedTrie
+
+
Creates a new immutable SortedTrie, which only contains a single entry.
+
+
singletonSortedTrie(K, V) - Static method in class de.mrapp.tries.Tries
+
+
Returns an immutable SortedTrie, which only contains a single entry.
+
+
singletonStringTrie(String, V) - Static method in class de.mrapp.tries.Tries
+
+
Returns an immutable StringTrie, which only contains a single entry.
+
+
SingletonTrie<SequenceType extends Sequence,ValueType> - Class in de.mrapp.tries.datastructure
+
+
An immutable Trie, which contains only a single entry.
+
+
SingletonTrie(SequenceType, ValueType) - Constructor for class de.mrapp.tries.datastructure.SingletonTrie
+
+
Creates a new immutable Trie, which only contains a single entry.
+
+
singletonTrie(K, V) - Static method in class de.mrapp.tries.Tries
+
+
Returns an immutable Trie, which only contains a single entry.
+
+
size() - Method in class de.mrapp.tries.datastructure.AbstractEmptyTrie
+
 
+
size() - Method in class de.mrapp.tries.datastructure.AbstractSingletonTrie
+
 
+
size() - Method in class de.mrapp.tries.datastructure.AbstractStringTrieWrapper
+
 
+
size() - Method in class de.mrapp.tries.datastructure.AbstractTrie.AbstractKeySet
+
 
+
size() - Method in class de.mrapp.tries.datastructure.AbstractTrie
+
 
+
size() - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableStringTrie
+
 
+
size() - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableTrie
+
 
+
SortedListNode<KeyType extends Sequence,ValueType> - Class in de.mrapp.tries.datastructure.node
+
+
A node of a trie, which stores its successors in a SortedArrayList.
+
+
SortedListNode(Comparator<? super KeyType>) - Constructor for class de.mrapp.tries.datastructure.node.SortedListNode
+
+
Creates a new node of a trie, which stores its successors in a sorted list.
+
+
SortedListStringTrie<ValueType> - Class in de.mrapp.tries
+
+
A sorted trie, which stores the successors of nodes in sorted lists.
+
+
SortedListStringTrie() - Constructor for class de.mrapp.tries.SortedListStringTrie
+
+
Creates a new empty, sorted trie for storing character sequences, which uses sorted lists for + storing the successors of nodes.
+
+
SortedListStringTrie(Comparator<? super String>) - Constructor for class de.mrapp.tries.SortedListStringTrie
+
+
Creates a new empty, sorted trie for storing character sequences, which uses sorted lists for + storing the successors of nodes.
+
+
SortedListStringTrie(Map<String, ValueType>) - Constructor for class de.mrapp.tries.SortedListStringTrie
+
+
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(Comparator<? super String>, Map<String, ValueType>) - Constructor for class de.mrapp.tries.SortedListStringTrie
+
+
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.
+
+
SortedListTrie<SequenceType extends Sequence,ValueType> - Class in de.mrapp.tries
+
+
A sorted trie, which stores the successors of nodes in sorted lists.
+
+
SortedListTrie() - Constructor for class de.mrapp.tries.SortedListTrie
+
+
Creates a new empty, sorted trie, which stores the successors of nodes in sorted lists.
+
+
SortedListTrie(Map<SequenceType, ValueType>) - Constructor for class de.mrapp.tries.SortedListTrie
+
+
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(Comparator<? super SequenceType>) - Constructor for class de.mrapp.tries.SortedListTrie
+
+
Creates a new empty, sorted trie, which stores the successors of nodes in sorted lists.
+
+
SortedListTrie(Comparator<? super SequenceType>, Map<SequenceType, ValueType>) - Constructor for class de.mrapp.tries.SortedListTrie
+
+
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.
+
+
SortedStringTrie<ValueType> - Interface in de.mrapp.tries
+
+
Defines the interface of a sorted trie, which uses character sequences, represented by the class + String, as keys.
+
+
SortedStringTrieWrapper<ValueType> - Class in de.mrapp.tries.datastructure
+
+
A wrapper, which implements the interface SortedStringTrie by delegating all method calls + to an encapsulated SortedTrie.
+
+
SortedStringTrieWrapper(SortedTrie<StringSequence, ValueType>) - Constructor for class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
+
Creates a new wrapper, which implements the interface SortedStringTrie.
+
+
SortedStringTrieWrapper.StringSequenceComparatorWrapper - Class in de.mrapp.tries.datastructure
+
+
A comparator, which allows to compare instances of the class StringSequence by + encapsulating a comparator, which compares Strings.
+
+
SortedStructure<K extends Sequence,V> - Interface in de.mrapp.tries.structure
+
+
Defines the interface, a class, which defines the structure of a sorted trie, must implement.
+
+
SortedTrie<SequenceType extends Sequence,ValueType> - Interface in de.mrapp.tries
+
+
Defines the interface of a sorted trie.
+
+
StringNodeWrapper<ValueType> - Class in de.mrapp.tries.datastructure
+
+
An implementation of the interface Node, where predecessors correspond to keys of the + type String.
+
+
StringNodeWrapper(Node<StringSequence, ValueType>) - Constructor for class de.mrapp.tries.datastructure.StringNodeWrapper
+
+
Creates a new implementation of the interface Node, where predecessors correspond to + keys of the type String.
+
+
StringSequence - Class in de.mrapp.tries.sequence
+
+
A character sequence, which is backed by a String.
+
+
StringSequence(String) - Constructor for class de.mrapp.tries.sequence.StringSequence
+
+
Creates a new character sequence.
+
+
StringSequenceComparatorWrapper(Comparator<? super String>) - Constructor for class de.mrapp.tries.datastructure.SortedStringTrieWrapper.StringSequenceComparatorWrapper
+
+
Creates a new comparator, which allows to compare instances of the class StringSequence by encapsulating a comparator, which compares Strings.
+
+
StringTrie<ValueType> - Interface in de.mrapp.tries
+
+
Defines the interface of a trie, which allows to use character sequences, represented by the + class String, as keys.
+
+
StringTrieWrapper<ValueType> - Class in de.mrapp.tries.datastructure
+
+
A wrapper, which implements the interface StringTrie by delegating all method calls to an + encapsulated Trie.
+
+
StringTrieWrapper(Trie<StringSequence, ValueType>) - Constructor for class de.mrapp.tries.datastructure.StringTrieWrapper
+
+
Creates a new wrapper, which implements the interface StringTrie.
+
+
structure - Variable in class de.mrapp.tries.datastructure.AbstractTrie
+
+
The implementation of the interface Structure, which defines the structure of the + trie.
+
+
Structure<SequenceType extends Sequence,ValueType> - Interface in de.mrapp.tries.structure
+
+
Defines the interface, a class, which defines the structure of a trie, must implement.
+
+
Structure.Operation - Enum in de.mrapp.tries.structure
+
+
An enum, which contains all types of operations, which can be performed on a trie.
+
+
subMap(SequenceType, SequenceType) - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
subMap(SequenceType, boolean, SequenceType, boolean) - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
subMap(SequenceType, boolean, SequenceType, boolean) - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
subMap(SequenceType, SequenceType) - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
subMap(SequenceType, boolean, SequenceType, boolean) - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
subMap(SequenceType, SequenceType) - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
subMap(String, boolean, String, boolean) - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
subMap(String, String) - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
subMap(String, boolean, String, boolean) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
subMap(String, String) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
subMap(SequenceType, boolean, SequenceType, boolean) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
subMap(SequenceType, SequenceType) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
subsequence(int, int) - Method in class de.mrapp.tries.sequence.StringSequence
+
 
+
subsequence(int) - Method in interface de.mrapp.tries.Sequence
+
+
Returns a new sequence, which is a subsequence of this sequence, starting at a specific index + and spanning to the end.
+
+
subsequence(int, int) - Method in interface de.mrapp.tries.Sequence
+
+
Returns a new sequence, which is a subsequence of this sequence.
+
+
subsequence(T, int) - Static method in class de.mrapp.tries.util.SequenceUtil
+
+
Returns a subsequence of a specific sequence, starting at a specific index and spanning to + the end.
+
+
subsequence(T, int, int) - Static method in class de.mrapp.tries.util.SequenceUtil
+
+
Returns a subsequence of a specific sequence, starting at a specific index and spanning to an + end index.
+
+
subTrie(SequenceType) - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
subTrie(SequenceType) - Method in class de.mrapp.tries.datastructure.EmptyTrie
+
 
+
subTrie(SequenceType) - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
subTrie(SequenceType) - Method in class de.mrapp.tries.datastructure.SingletonTrie
+
 
+
subTrie(String) - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
subTrie(String) - Method in class de.mrapp.tries.datastructure.StringTrieWrapper
+
 
+
subTrie(String) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
subTrie(SequenceType) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
subTrie(String) - Method in class de.mrapp.tries.datastructure.UnmodifiableStringTrie
+
 
+
subTrie(SequenceType) - Method in class de.mrapp.tries.datastructure.UnmodifiableTrie
+
 
+
subTrie(SequenceType) - Method in class de.mrapp.tries.HashTrie
+
 
+
subTrie(SequenceType) - Method in class de.mrapp.tries.PatriciaTrie
+
 
+
subTrie(SequenceType) - Method in class de.mrapp.tries.SortedListTrie
+
 
+
subTrie(String) - Method in interface de.mrapp.tries.SortedStringTrie
+
 
+
subTrie(SequenceType) - Method in interface de.mrapp.tries.SortedTrie
+
+ +
+
subTrie(String) - Method in interface de.mrapp.tries.StringTrie
+
 
+
subTrie(SequenceType) - Method in interface de.mrapp.tries.Trie
+
+
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).
+
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-17.html b/doc/javadoc/index-files/index-17.html new file mode 100644 index 0000000..fb1ea0c --- /dev/null +++ b/doc/javadoc/index-files/index-17.html @@ -0,0 +1,197 @@ + + + + + +T-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

T

+
+
tailMap(SequenceType) - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
tailMap(SequenceType, boolean) - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
tailMap(SequenceType, boolean) - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
tailMap(SequenceType) - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
tailMap(SequenceType, boolean) - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
tailMap(SequenceType) - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
tailMap(String, boolean) - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
tailMap(String) - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
tailMap(String, boolean) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
tailMap(String) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
tailMap(SequenceType, boolean) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
tailMap(SequenceType) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
toString() - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableStringTrie
+
 
+
toString() - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableTrie
+
 
+
toString() - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
toString() - Method in class de.mrapp.tries.datastructure.EmptyTrie
+
 
+
toString() - Method in class de.mrapp.tries.datastructure.node.HashNode
+
 
+
toString() - Method in class de.mrapp.tries.datastructure.node.SortedListNode
+
 
+
toString() - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
toString() - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
toString() - Method in class de.mrapp.tries.datastructure.SingletonTrie
+
 
+
toString() - Method in class de.mrapp.tries.datastructure.StringNodeWrapper
+
 
+
toString() - Method in class de.mrapp.tries.HashStringTrie
+
 
+
toString() - Method in class de.mrapp.tries.HashTrie
+
 
+
toString() - Method in class de.mrapp.tries.NodeValue
+
 
+
toString() - Method in class de.mrapp.tries.PatriciaStringTrie
+
 
+
toString() - Method in class de.mrapp.tries.PatriciaTrie
+
 
+
toString() - Method in class de.mrapp.tries.sequence.StringSequence
+
 
+
toString() - Method in class de.mrapp.tries.SortedListStringTrie
+
 
+
toString() - Method in class de.mrapp.tries.SortedListTrie
+
 
+
trie - Variable in class de.mrapp.tries.datastructure.AbstractStringTrieWrapper
+
+
The encapsulated trie.
+
+
Trie<SequenceType extends Sequence,ValueType> - Interface in de.mrapp.tries
+
+
Defines the interface of a trie (also called prefix tree, digital tree or radix tree).
+
+
Tries - Class in de.mrapp.tries
+
+
This class consists exclusively of static methods that operate on or return tries.
+
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-18.html b/doc/javadoc/index-files/index-18.html new file mode 100644 index 0000000..1c3a021 --- /dev/null +++ b/doc/javadoc/index-files/index-18.html @@ -0,0 +1,197 @@ + + + + + +U-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

U

+
+
UncompressedSortedStructure<SequenceType extends Sequence,ValueType> - Class in de.mrapp.tries.structure
+
+
Defines the structure of an uncompressed sorted trie, where the edges between nodes always + correspond to exactly one element of a sequence.
+
+
UncompressedSortedStructure() - Constructor for class de.mrapp.tries.structure.UncompressedSortedStructure
+
 
+
UncompressedStructure<SequenceType extends Sequence,ValueType> - Class in de.mrapp.tries.structure
+
+
Defines the structure of an uncompressed trie, where the edges between nodes always correspond to + exactly one element of a sequence.
+
+
UncompressedStructure() - Constructor for class de.mrapp.tries.structure.UncompressedStructure
+
 
+
UnmodifiableNode<KeyType extends Sequence,ValueType> - Class in de.mrapp.tries.datastructure.node
+
+
An implementation of the interface Node, which forwards read-only method calls to an + encapsulated node and throws UnsupportedOperationExceptions when calling a method, which + attempts to change the node's state.
+
+
UnmodifiableNode(Node<KeyType, ValueType>) - Constructor for class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
+
Creates a new immutable node.
+
+
UnmodifiableSortedStringTrie<ValueType> - Class in de.mrapp.tries.datastructure
+
+
An immutable SortedStringTrie.
+
+
UnmodifiableSortedStringTrie(SortedStringTrie<ValueType>) - Constructor for class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
+
Creates a new unmodifiable sorted string trie.
+
+
unmodifiableSortedStringTrie(SortedStringTrie<V>) - Static method in class de.mrapp.tries.Tries
+
+
Returns an unmodifiable view of a specific SortedStringTrie.
+
+
UnmodifiableSortedTrie<SequenceType extends Sequence,ValueType> - Class in de.mrapp.tries.datastructure
+
+
An immutable SortedTrie.
+
+
UnmodifiableSortedTrie(SortedTrie<SequenceType, ValueType>) - Constructor for class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
+
Creates a new immutable SortedTrie.
+
+
unmodifiableSortedTrie(SortedTrie<K, V>) - Static method in class de.mrapp.tries.Tries
+
+
Returns an unmodifiable view of a specific SortedTrie.
+
+
UnmodifiableStringTrie<ValueType> - Class in de.mrapp.tries.datastructure
+
+
An immutable StringTrie.
+
+
UnmodifiableStringTrie(StringTrie<ValueType>) - Constructor for class de.mrapp.tries.datastructure.UnmodifiableStringTrie
+
+
Creates a new immutable StringTrie.
+
+
unmodifiableStringTrie(StringTrie<V>) - Static method in class de.mrapp.tries.Tries
+
+
Returns an unmodifiable view of a specific StringTrie.
+
+
UnmodifiableTrie<SequenceType extends Sequence,ValueType> - Class in de.mrapp.tries.datastructure
+
+
An immutable Trie.
+
+
UnmodifiableTrie(Trie<SequenceType, ValueType>) - Constructor for class de.mrapp.tries.datastructure.UnmodifiableTrie
+
+
Creates a new immutable Trie.
+
+
unmodifiableTrie(Trie<K, V>) - Static method in class de.mrapp.tries.Tries
+
+
Returns an unmodifiable view of a specific Trie.
+
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-19.html b/doc/javadoc/index-files/index-19.html new file mode 100644 index 0000000..f698533 --- /dev/null +++ b/doc/javadoc/index-files/index-19.html @@ -0,0 +1,146 @@ + + + + + +V-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

V

+
+
valueOf(String) - Static method in enum de.mrapp.tries.structure.Structure.Operation
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Method in class de.mrapp.tries.datastructure.AbstractEmptyTrie
+
 
+
values() - Method in class de.mrapp.tries.datastructure.AbstractSingletonTrie
+
 
+
values() - Method in class de.mrapp.tries.datastructure.AbstractStringTrieWrapper
+
 
+
values() - Method in class de.mrapp.tries.datastructure.AbstractTrie
+
 
+
values() - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableStringTrie
+
 
+
values() - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableTrie
+
 
+
values() - Static method in enum de.mrapp.tries.structure.Structure.Operation
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-2.html b/doc/javadoc/index-files/index-2.html new file mode 100644 index 0000000..4c6bb55 --- /dev/null +++ b/doc/javadoc/index-files/index-2.html @@ -0,0 +1,129 @@ + + + + + +B-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

B

+
+
binarySearch(int, Function<Integer, T>, Comparator<? super T>, T) - Static method in class de.mrapp.tries.util.SequenceUtil
+
+
Performs a binary search to find a specific sequence.
+
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-3.html b/doc/javadoc/index-files/index-3.html new file mode 100644 index 0000000..6a066a6 --- /dev/null +++ b/doc/javadoc/index-files/index-3.html @@ -0,0 +1,273 @@ + + + + + +C-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

C

+
+
ceilingEntry(SequenceType) - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
ceilingEntry(SequenceType) - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
ceilingEntry(SequenceType) - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
ceilingEntry(String) - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
ceilingEntry(String) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
ceilingEntry(SequenceType) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
ceilingKey(SequenceType) - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
ceilingKey(SequenceType) - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
ceilingKey(SequenceType) - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
ceilingKey(String) - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
ceilingKey(String) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
ceilingKey(SequenceType) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
clear() - Method in class de.mrapp.tries.datastructure.AbstractEmptyTrie
+
 
+
clear() - Method in class de.mrapp.tries.datastructure.AbstractSingletonTrie
+
 
+
clear() - Method in class de.mrapp.tries.datastructure.AbstractStringTrieWrapper
+
 
+
clear() - Method in class de.mrapp.tries.datastructure.AbstractTrie.AbstractKeySet
+
 
+
clear() - Method in class de.mrapp.tries.datastructure.AbstractTrie
+
 
+
clear() - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableStringTrie
+
 
+
clear() - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableTrie
+
 
+
clone() - Method in class de.mrapp.tries.datastructure.node.AbstractNode
+
 
+
clone() - Method in class de.mrapp.tries.datastructure.node.HashNode
+
 
+
clone() - Method in class de.mrapp.tries.datastructure.node.SortedListNode
+
 
+
clone() - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
clone() - Method in class de.mrapp.tries.datastructure.StringNodeWrapper
+
 
+
clone() - Method in interface de.mrapp.tries.Node
+
+
Creates and returns a deep copy of the node and its successors.
+
+
clone() - Method in class de.mrapp.tries.NodeValue
+
 
+
cloneSuccessors(Node<KeyType, ValueType>, Node<KeyType, ValueType>) - Method in class de.mrapp.tries.datastructure.node.AbstractNode
+
+
Clones all successors of a specific node recursively and adds them to another node.
+
+
comparator - Variable in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
+
The comparator, which is used to compare sequences to each other, or null, if the natural + order of the sequences is used.
+
+
comparator() - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
comparator() - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
comparator() - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
comparator() - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
comparator() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
comparator() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
comparator(Comparator<? super T>) - Static method in class de.mrapp.tries.util.SequenceUtil
+
+
Creates and returns a comparator, which allows to compare sequences.
+
+
compare(StringSequence, StringSequence) - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper.StringSequenceComparatorWrapper
+
 
+
compareTo(StringSequence) - Method in class de.mrapp.tries.sequence.StringSequence
+
 
+
concat(Sequence) - Method in interface de.mrapp.tries.Sequence
+
+
Concatenates this sequence with another one.
+
+
concat(Sequence) - Method in class de.mrapp.tries.sequence.StringSequence
+
 
+
concat(T, T) - Static method in class de.mrapp.tries.util.SequenceUtil
+
+
Concatenates two sequences.
+
+
contains(Object) - Method in class de.mrapp.tries.datastructure.AbstractTrie.AbstractKeySet
+
 
+
containsKey(Object) - Method in class de.mrapp.tries.datastructure.AbstractEmptyTrie
+
 
+
containsKey(Object) - Method in class de.mrapp.tries.datastructure.AbstractSingletonTrie
+
 
+
containsKey(Object) - Method in class de.mrapp.tries.datastructure.AbstractStringTrieWrapper
+
 
+
containsKey(Object) - Method in class de.mrapp.tries.datastructure.AbstractTrie
+
 
+
containsKey(Object) - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableStringTrie
+
 
+
containsKey(Object) - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableTrie
+
 
+
containsValue(Object) - Method in class de.mrapp.tries.datastructure.AbstractEmptyTrie
+
 
+
containsValue(Object) - Method in class de.mrapp.tries.datastructure.AbstractSingletonTrie
+
 
+
containsValue(Object) - Method in class de.mrapp.tries.datastructure.AbstractStringTrieWrapper
+
 
+
containsValue(Object) - Method in class de.mrapp.tries.datastructure.AbstractTrie
+
 
+
containsValue(Object) - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableStringTrie
+
 
+
containsValue(Object) - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableTrie
+
 
+
convertFromString(String) - Static method in class de.mrapp.tries.sequence.StringSequence
+
+
Converts a specific String to a string sequence.
+
+
convertToString(StringSequence) - Static method in class de.mrapp.tries.sequence.StringSequence
+
+
Converts a specific StringSequence to a string.
+
+
createRootNode() - Method in class de.mrapp.tries.datastructure.AbstractTrie
+
+
The method, which is invoked on subclasses in order to create the trie's root node.
+
+
createRootNode() - Method in class de.mrapp.tries.HashTrie
+
 
+
createRootNode() - Method in class de.mrapp.tries.PatriciaTrie
+
 
+
createRootNode() - Method in class de.mrapp.tries.SortedListTrie
+
 
+
createStructure() - Method in class de.mrapp.tries.datastructure.AbstractTrie
+
+
The method, which is invoked on subclasses in order to create the implementation of the + interface Structure, which defines the structure of the trie.
+
+
createStructure() - Method in class de.mrapp.tries.HashTrie
+
 
+
createStructure() - Method in class de.mrapp.tries.PatriciaTrie
+
 
+
createStructure() - Method in class de.mrapp.tries.SortedListTrie
+
 
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-4.html b/doc/javadoc/index-files/index-4.html new file mode 100644 index 0000000..77ccda1 --- /dev/null +++ b/doc/javadoc/index-files/index-4.html @@ -0,0 +1,171 @@ + + + + + +D-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

D

+
+
de.mrapp.tries - package de.mrapp.tries
+
 
+
de.mrapp.tries.datastructure - package de.mrapp.tries.datastructure
+
 
+
de.mrapp.tries.datastructure.node - package de.mrapp.tries.datastructure.node
+
 
+
de.mrapp.tries.sequence - package de.mrapp.tries.sequence
+
 
+
de.mrapp.tries.structure - package de.mrapp.tries.structure
+
 
+
de.mrapp.tries.util - package de.mrapp.tries.util
+
 
+
decreaseSuccessorValueCount(int) - Method in class de.mrapp.tries.datastructure.node.AbstractNode
+
 
+
decreaseSuccessorValueCount(int) - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
decreaseSuccessorValueCount(int) - Method in class de.mrapp.tries.datastructure.StringNodeWrapper
+
 
+
decreaseSuccessorValueCount(int) - Method in interface de.mrapp.tries.Node
+
+
Decreases the number of successors for which values are set by a specific amount.
+
+
descendingKeySet() - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
descendingKeySet() - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
descendingKeySet() - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
descendingKeySet() - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
descendingKeySet() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
descendingKeySet() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
descendingMap() - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
descendingMap() - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
descendingMap() - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
descendingMap() - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
descendingMap() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
descendingMap() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-5.html b/doc/javadoc/index-files/index-5.html new file mode 100644 index 0000000..9514404 --- /dev/null +++ b/doc/javadoc/index-files/index-5.html @@ -0,0 +1,209 @@ + + + + + +E-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

E

+
+
EMPTY_SORTED_STRING_TRIE - Static variable in class de.mrapp.tries.Tries
+
+
The empty SortedStringTrie (immutable).
+
+
EMPTY_SORTED_TRIE - Static variable in class de.mrapp.tries.Tries
+
+
The empty SortedTrie (immutable).
+
+
EMPTY_STRING_TRIE - Static variable in class de.mrapp.tries.Tries
+
+
The empty StringTrie (immutable).
+
+
EMPTY_TRIE - Static variable in class de.mrapp.tries.Tries
+
+
The empty Trie (immutable).
+
+
emptySortedStringTrie() - Static method in class de.mrapp.tries.Tries
+
+
Returns the empty SortedStringTrie (immutable).
+
+
EmptySortedTrie<SequenceType extends Sequence,ValueType> - Class in de.mrapp.tries.datastructure
+
+
An unmodifiable and empty sorted trie.
+
+
EmptySortedTrie() - Constructor for class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
emptySortedTrie() - Static method in class de.mrapp.tries.Tries
+
+
Returns the empty SortedTrie (immutable).
+
+
emptyStringTrie() - Static method in class de.mrapp.tries.Tries
+
+
Returns the empty StringTrie (immutable).
+
+
EmptyTrie<SequenceType extends Sequence,ValueType> - Class in de.mrapp.tries.datastructure
+
+
An immutable and empty trie.
+
+
EmptyTrie() - Constructor for class de.mrapp.tries.datastructure.EmptyTrie
+
 
+
emptyTrie() - Static method in class de.mrapp.tries.Tries
+
+
Returns the empty Trie (immutable).
+
+
entrySet() - Method in class de.mrapp.tries.datastructure.AbstractEmptyTrie
+
 
+
entrySet() - Method in class de.mrapp.tries.datastructure.AbstractSingletonTrie
+
 
+
entrySet() - Method in class de.mrapp.tries.datastructure.AbstractStringTrieWrapper
+
 
+
entrySet() - Method in class de.mrapp.tries.datastructure.AbstractTrie
+
 
+
entrySet() - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableStringTrie
+
 
+
entrySet() - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableTrie
+
 
+
EntryUtil - Class in de.mrapp.tries.util
+
+
An utility class, which provides static methods for handling instances of the type Map.Entry.
+
+
equals(Object) - Method in class de.mrapp.tries.datastructure.AbstractSingletonTrie
+
 
+
equals(Object) - Method in class de.mrapp.tries.datastructure.AbstractStringTrieWrapper
+
 
+
equals(Object) - Method in class de.mrapp.tries.datastructure.AbstractTrie
+
 
+
equals(Object) - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableStringTrie
+
 
+
equals(Object) - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableTrie
+
 
+
equals(Object) - Method in class de.mrapp.tries.datastructure.node.AbstractNode
+
 
+
equals(Object) - Method in class de.mrapp.tries.datastructure.node.HashNode
+
 
+
equals(Object) - Method in class de.mrapp.tries.datastructure.node.SortedListNode
+
 
+
equals(Object) - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
equals(Object) - Method in class de.mrapp.tries.datastructure.StringNodeWrapper
+
 
+
equals(Object) - Method in class de.mrapp.tries.NodeValue
+
 
+
equals(Object) - Method in class de.mrapp.tries.sequence.StringSequence
+
 
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-6.html b/doc/javadoc/index-files/index-6.html new file mode 100644 index 0000000..8a17aad --- /dev/null +++ b/doc/javadoc/index-files/index-6.html @@ -0,0 +1,173 @@ + + + + + +F-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

F

+
+
firstEntry() - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
firstEntry() - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
firstEntry() - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
firstEntry() - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
firstEntry() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
firstEntry() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
firstKey() - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
firstKey() - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
firstKey() - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
firstKey() - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
firstKey() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
firstKey() - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
floorEntry(SequenceType) - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
floorEntry(SequenceType) - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
floorEntry(SequenceType) - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
floorEntry(String) - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
floorEntry(String) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
floorEntry(SequenceType) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
floorKey(SequenceType) - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
floorKey(SequenceType) - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
floorKey(SequenceType) - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
floorKey(String) - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
floorKey(String) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
floorKey(SequenceType) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-7.html b/doc/javadoc/index-files/index-7.html new file mode 100644 index 0000000..72cd709 --- /dev/null +++ b/doc/javadoc/index-files/index-7.html @@ -0,0 +1,275 @@ + + + + + +G-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

G

+
+
get(Object) - Method in class de.mrapp.tries.datastructure.AbstractEmptyTrie
+
 
+
get(Object) - Method in class de.mrapp.tries.datastructure.AbstractSingletonTrie
+
 
+
get(Object) - Method in class de.mrapp.tries.datastructure.AbstractStringTrieWrapper
+
 
+
get(Object) - Method in class de.mrapp.tries.datastructure.AbstractTrie
+
 
+
get(Object) - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableStringTrie
+
 
+
get(Object) - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableTrie
+
 
+
getCommonPrefix(T, T) - Static method in class de.mrapp.tries.util.SequenceUtil
+
+
Returns the longest common prefix of two sequences.
+
+
getFirstSuccessor() - Method in interface de.mrapp.tries.Node
+
+
Returns the first successor.
+
+
getFirstSuccessorKey() - Method in interface de.mrapp.tries.Node
+
+
Returns the key, which corresponds to the first successor.
+
+
getKey(Map.Entry<K, ?>) - Static method in class de.mrapp.tries.util.EntryUtil
+
+
Returns the key of a specific entry or null, if the entry is null.
+
+
getKeyOrThrowException(Map.Entry<K, ?>) - Static method in class de.mrapp.tries.util.EntryUtil
+
+
Returns the key of a specific entry or throws a NoSuchElementException, if the entry + is null.
+
+
getLastSuccessor() - Method in interface de.mrapp.tries.Node
+
+
Returns the last successor.
+
+
getLastSuccessorKey() - Method in interface de.mrapp.tries.Node
+
+
Returns the key, which corresponds to the last successor.
+
+
getNode(Object) - Method in class de.mrapp.tries.datastructure.AbstractTrie
+
+
Traverses the trie in order to returns the node, which corresponds to a specific key.
+
+
getNodeValue() - Method in class de.mrapp.tries.datastructure.node.AbstractNode
+
 
+
getNodeValue() - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
getNodeValue() - Method in class de.mrapp.tries.datastructure.StringNodeWrapper
+
 
+
getNodeValue() - Method in interface de.mrapp.tries.Node
+
+
Returns the value of the node.
+
+
getPredecessor() - Method in class de.mrapp.tries.datastructure.node.AbstractNode
+
 
+
getPredecessor() - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
getPredecessor() - Method in class de.mrapp.tries.datastructure.StringNodeWrapper
+
 
+
getPredecessor() - Method in interface de.mrapp.tries.Node
+
+
Returns the predecessor of the node.
+
+
getRootNode() - Method in class de.mrapp.tries.datastructure.AbstractEmptyTrie
+
 
+
getRootNode() - Method in class de.mrapp.tries.datastructure.AbstractSingletonTrie
+
 
+
getRootNode() - Method in class de.mrapp.tries.datastructure.AbstractStringTrieWrapper
+
 
+
getRootNode() - Method in class de.mrapp.tries.datastructure.AbstractTrie
+
 
+
getRootNode() - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableStringTrie
+
 
+
getRootNode() - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableTrie
+
 
+
getRootNode() - Method in interface de.mrapp.tries.StringTrie
+
 
+
getRootNode() - Method in interface de.mrapp.tries.Trie
+
+
Returns the root node of the trie.
+
+
getSubTrie(SequenceType, Node<SequenceType, ValueType>, Node<SequenceType, ValueType>) - Method in class de.mrapp.tries.structure.PatriciaStructure
+
 
+
getSubTrie(SequenceType, Node<SequenceType, ValueType>, Node<SequenceType, ValueType>) - Method in interface de.mrapp.tries.structure.Structure
+
+
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).
+
+
getSubTrie(SequenceType, Node<SequenceType, ValueType>, Node<SequenceType, ValueType>) - Method in class de.mrapp.tries.structure.UncompressedStructure
+
 
+
getSuccessor(KeyType) - Method in class de.mrapp.tries.datastructure.node.HashNode
+
 
+
getSuccessor(KeyType) - Method in class de.mrapp.tries.datastructure.node.SortedListNode
+
 
+
getSuccessor(int) - Method in class de.mrapp.tries.datastructure.node.SortedListNode
+
 
+
getSuccessor(KeyType) - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
getSuccessor(int) - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
getSuccessor(String) - Method in class de.mrapp.tries.datastructure.StringNodeWrapper
+
 
+
getSuccessor(KeyType) - Method in interface de.mrapp.tries.Node
+
+
Returns the successor of the node, which corresponds to a specific key.
+
+
getSuccessor(int) - Method in interface de.mrapp.tries.Node
+
+
Returns the successor at a specific index.
+
+
getSuccessorCount() - Method in class de.mrapp.tries.datastructure.node.HashNode
+
 
+
getSuccessorCount() - Method in class de.mrapp.tries.datastructure.node.SortedListNode
+
 
+
getSuccessorCount() - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
getSuccessorCount() - Method in class de.mrapp.tries.datastructure.StringNodeWrapper
+
 
+
getSuccessorCount() - Method in interface de.mrapp.tries.Node
+
+
Returns the number of the node's successors.
+
+
getSuccessorKey(int) - Method in class de.mrapp.tries.datastructure.node.SortedListNode
+
 
+
getSuccessorKey(int) - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
getSuccessorKey(int) - Method in interface de.mrapp.tries.Node
+
+
Returns the key, which corresponds to the successor at a specific index.
+
+
getSuccessorValueCount() - Method in class de.mrapp.tries.datastructure.node.AbstractNode
+
 
+
getSuccessorValueCount() - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
getSuccessorValueCount() - Method in class de.mrapp.tries.datastructure.StringNodeWrapper
+
 
+
getSuccessorValueCount() - Method in interface de.mrapp.tries.Node
+
+
Returns the number of successors for which values are set, i.e.
+
+
getValue() - Method in interface de.mrapp.tries.Node
+
+
Returns the unboxed value of the node, i.e.
+
+
getValue() - Method in class de.mrapp.tries.NodeValue
+
+
Returns the encapsulated value.
+
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-8.html b/doc/javadoc/index-files/index-8.html new file mode 100644 index 0000000..532deb9 --- /dev/null +++ b/doc/javadoc/index-files/index-8.html @@ -0,0 +1,230 @@ + + + + + +H-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

H

+
+
hashCode() - Method in class de.mrapp.tries.datastructure.AbstractSingletonTrie
+
 
+
hashCode() - Method in class de.mrapp.tries.datastructure.AbstractStringTrieWrapper
+
 
+
hashCode() - Method in class de.mrapp.tries.datastructure.AbstractTrie
+
 
+
hashCode() - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableStringTrie
+
 
+
hashCode() - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableTrie
+
 
+
hashCode() - Method in class de.mrapp.tries.datastructure.node.AbstractNode
+
 
+
hashCode() - Method in class de.mrapp.tries.datastructure.node.HashNode
+
 
+
hashCode() - Method in class de.mrapp.tries.datastructure.node.SortedListNode
+
 
+
hashCode() - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
hashCode() - Method in class de.mrapp.tries.datastructure.StringNodeWrapper
+
 
+
hashCode() - Method in class de.mrapp.tries.NodeValue
+
 
+
hashCode() - Method in class de.mrapp.tries.sequence.StringSequence
+
 
+
HashNode<KeyType extends Sequence,ValueType> - Class in de.mrapp.tries.datastructure.node
+
+
A node of a trie, which stores its successors in a HashMap.
+
+
HashNode() - Constructor for class de.mrapp.tries.datastructure.node.HashNode
+
+
Creates a new node of a trie, which stores its successors in a HashMap.
+
+
HashStringTrie<ValueType> - Class in de.mrapp.tries
+
+
An unsorted trie, which uses hash maps for storing the successors of nodes.
+
+
HashStringTrie() - Constructor for class de.mrapp.tries.HashStringTrie
+
+
Creates a new empty, unsorted trie for storing character sequences, which uses hash maps for + storing the successors of nodes.
+
+
HashTrie<SequenceType extends Sequence,ValueType> - Class in de.mrapp.tries
+
+
A unsorted trie, which stores the successors of nodes in hash maps.
+
+
HashTrie() - Constructor for class de.mrapp.tries.HashTrie
+
+
Creates a new empty, unsorted trie, which stores the successors of nodes in hash maps.
+
+
HashTrie(Map<SequenceType, ValueType>) - Constructor for class de.mrapp.tries.HashTrie
+
+
Creates a new unsorted trie, which contains all key-value pairs that are contained by a map.
+
+
hasSuccessors() - Method in interface de.mrapp.tries.Node
+
+
Returns, whether the node has successors, or not.
+
+
headMap(SequenceType) - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
headMap(SequenceType, boolean) - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
headMap(SequenceType, boolean) - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
headMap(SequenceType) - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
headMap(SequenceType, boolean) - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
headMap(SequenceType) - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
headMap(String, boolean) - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
headMap(String) - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
headMap(String, boolean) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
headMap(String) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
headMap(SequenceType, boolean) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
headMap(SequenceType) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
higherEntry(SequenceType) - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
higherEntry(SequenceType) - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
higherEntry(SequenceType) - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
higherEntry(String) - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
higherEntry(String) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
higherEntry(SequenceType) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
higherKey(SequenceType) - Method in class de.mrapp.tries.datastructure.AbstractSortedTrie
+
 
+
higherKey(SequenceType) - Method in class de.mrapp.tries.datastructure.EmptySortedTrie
+
 
+
higherKey(SequenceType) - Method in class de.mrapp.tries.datastructure.SingletonSortedTrie
+
 
+
higherKey(String) - Method in class de.mrapp.tries.datastructure.SortedStringTrieWrapper
+
 
+
higherKey(String) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedStringTrie
+
 
+
higherKey(SequenceType) - Method in class de.mrapp.tries.datastructure.UnmodifiableSortedTrie
+
 
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index-files/index-9.html b/doc/javadoc/index-files/index-9.html new file mode 100644 index 0000000..54b6423 --- /dev/null +++ b/doc/javadoc/index-files/index-9.html @@ -0,0 +1,202 @@ + + + + + +I-Index + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I K L N O P R S T U V  + + +

I

+
+
increaseSuccessorValueCount(int) - Method in class de.mrapp.tries.datastructure.node.AbstractNode
+
 
+
increaseSuccessorValueCount(int) - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
increaseSuccessorValueCount(int) - Method in class de.mrapp.tries.datastructure.StringNodeWrapper
+
 
+
increaseSuccessorValueCount(int) - Method in interface de.mrapp.tries.Node
+
+
Increases the number of successors for which values are set by a specific amount.
+
+
indexOf(KeyType) - Method in class de.mrapp.tries.datastructure.node.SortedListNode
+
 
+
indexOf(KeyType) - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
indexOf(KeyType) - Method in interface de.mrapp.tries.Node
+
+
Returns the index of the successor, which corresponds to a specific key.
+
+
indexOf(Node<SequenceType, ValueType>, SequenceType) - Method in class de.mrapp.tries.structure.PatriciaStructure
+
 
+
indexOf(Node<K, V>, K) - Method in interface de.mrapp.tries.structure.SortedStructure
+
+
The method, which is invoked in order to identify the index of a node's successor, which + corresponds to a specific sequence.
+
+
indexOf(Node<SequenceType, ValueType>, SequenceType) - Method in class de.mrapp.tries.structure.UncompressedSortedStructure
+
 
+
indexOfFirstElement(KeyType) - Method in class de.mrapp.tries.datastructure.node.SortedListNode
+
 
+
indexOfFirstElement(KeyType) - Method in interface de.mrapp.tries.Node
+
+
Returns the index of the successor, whose key starts with the first element of another key.
+
+
isEmpty() - Method in class de.mrapp.tries.datastructure.AbstractEmptyTrie
+
 
+
isEmpty() - Method in class de.mrapp.tries.datastructure.AbstractSingletonTrie
+
 
+
isEmpty() - Method in class de.mrapp.tries.datastructure.AbstractStringTrieWrapper
+
 
+
isEmpty() - Method in class de.mrapp.tries.datastructure.AbstractTrie.AbstractKeySet
+
 
+
isEmpty() - Method in class de.mrapp.tries.datastructure.AbstractTrie
+
 
+
isEmpty() - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableStringTrie
+
 
+
isEmpty() - Method in class de.mrapp.tries.datastructure.AbstractUnmodifiableTrie
+
 
+
isEmpty() - Method in interface de.mrapp.tries.Sequence
+
+
Returns, whether the sequence is empty, i.e.
+
+
isEmpty(Sequence) - Static method in class de.mrapp.tries.util.SequenceUtil
+
+
Returns, whether a specific sequence is null or empty.
+
+
isEqual(Object, Object) - Static method in class de.mrapp.tries.util.EntryUtil
+
+
Returns, whether two objects are equal, or not.
+
+
isValueEqual(Node<?, ?>, Map.Entry<?, ?>) - Static method in class de.mrapp.tries.util.EntryUtil
+
+
Returns, whether the values of a specific node and entry are equal, or not.
+
+
isValueSet() - Method in interface de.mrapp.tries.Node
+
+
Returns, whether a value is set for the node, or not.
+
+
iterator() - Method in class de.mrapp.tries.datastructure.AbstractTrie.KeySet
+
 
+
iterator() - Method in class de.mrapp.tries.datastructure.node.HashNode
+
 
+
iterator() - Method in class de.mrapp.tries.datastructure.node.SortedListNode
+
 
+
iterator() - Method in class de.mrapp.tries.datastructure.node.UnmodifiableNode
+
 
+
iterator() - Method in class de.mrapp.tries.datastructure.StringNodeWrapper
+
 
+
+A B C D E F G H I K L N O P R S T U V 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/index.html b/doc/javadoc/index.html new file mode 100644 index 0000000..ad7d547 --- /dev/null +++ b/doc/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/doc/javadoc/overview-frame.html b/doc/javadoc/overview-frame.html new file mode 100644 index 0000000..2e86564 --- /dev/null +++ b/doc/javadoc/overview-frame.html @@ -0,0 +1,26 @@ + + + + + +Overview List + + + + + + + +

 

+ + 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 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
de.mrapp.tries 
de.mrapp.tries.datastructure 
de.mrapp.tries.datastructure.node 
de.mrapp.tries.sequence 
de.mrapp.tries.structure 
de.mrapp.tries.util 
+
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/overview-tree.html b/doc/javadoc/overview-tree.html new file mode 100644 index 0000000..1e055c7 --- /dev/null +++ b/doc/javadoc/overview-tree.html @@ -0,0 +1,292 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
+ + + +
+

Class Hierarchy

+ +

Interface Hierarchy

+
    +
  • java.lang.Cloneable +
      +
    • de.mrapp.tries.Node<KeyType,ValueType> (also extends java.lang.Iterable<T>, java.io.Serializable)
    • +
    +
  • +
  • java.lang.Iterable<T> +
      +
    • de.mrapp.tries.Node<KeyType,ValueType> (also extends java.lang.Cloneable, java.io.Serializable)
    • +
    +
  • +
  • java.util.Map<K,V> +
      +
    • java.util.SortedMap<K,V> +
        +
      • java.util.NavigableMap<K,V> +
          +
        • de.mrapp.tries.SortedStringTrie<ValueType> (also extends de.mrapp.tries.StringTrie<ValueType>)
        • +
        • de.mrapp.tries.SortedTrie<SequenceType,ValueType> (also extends de.mrapp.tries.Trie<SequenceType,ValueType>)
        • +
        +
      • +
      +
    • +
    • de.mrapp.tries.StringTrie<ValueType> (also extends java.io.Serializable) +
        +
      • de.mrapp.tries.SortedStringTrie<ValueType> (also extends java.util.NavigableMap<K,V>)
      • +
      +
    • +
    • de.mrapp.tries.Trie<SequenceType,ValueType> (also extends java.io.Serializable) +
        +
      • de.mrapp.tries.SortedTrie<SequenceType,ValueType> (also extends java.util.NavigableMap<K,V>)
      • +
      +
    • +
    +
  • +
  • java.io.Serializable +
      +
    • de.mrapp.tries.Node<KeyType,ValueType> (also extends java.lang.Cloneable, java.lang.Iterable<T>)
    • +
    • de.mrapp.tries.Sequence
    • +
    • de.mrapp.tries.StringTrie<ValueType> (also extends java.util.Map<K,V>) +
        +
      • de.mrapp.tries.SortedStringTrie<ValueType> (also extends java.util.NavigableMap<K,V>)
      • +
      +
    • +
    • de.mrapp.tries.Trie<SequenceType,ValueType> (also extends java.util.Map<K,V>) +
        +
      • de.mrapp.tries.SortedTrie<SequenceType,ValueType> (also extends java.util.NavigableMap<K,V>)
      • +
      +
    • +
    +
  • +
  • de.mrapp.tries.structure.Structure<SequenceType,ValueType> + +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
+ + + + diff --git a/doc/javadoc/package-list b/doc/javadoc/package-list new file mode 100644 index 0000000..baa7f57 --- /dev/null +++ b/doc/javadoc/package-list @@ -0,0 +1,6 @@ +de.mrapp.tries +de.mrapp.tries.datastructure +de.mrapp.tries.datastructure.node +de.mrapp.tries.sequence +de.mrapp.tries.structure +de.mrapp.tries.util diff --git a/doc/javadoc/script.js b/doc/javadoc/script.js new file mode 100644 index 0000000..b346356 --- /dev/null +++ b/doc/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/javadoc/serialized-form.html b/doc/javadoc/serialized-form.html new file mode 100644 index 0000000..7849b03 --- /dev/null +++ b/doc/javadoc/serialized-form.html @@ -0,0 +1,637 @@ + + + + + +Serialized Form + + + + + + + + + + + +
+

Serialized Form

+
+
+ +
+ + + + + + diff --git a/doc/javadoc/stylesheet.css b/doc/javadoc/stylesheet.css new file mode 100644 index 0000000..98055b2 --- /dev/null +++ b/doc/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a523045..ef35c71 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Nov 24 22:59:39 CET 2017 +#Thu Jan 25 11:34:10 CET 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-rc-2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-all.zip diff --git a/gradlew b/gradlew index 4453cce..27309d9 100755 --- a/gradlew +++ b/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash ############################################################################## ## @@ -154,19 +154,11 @@ if $cygwin ; then esac fi -# Escape application args -save ( ) { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") } -APP_ARGS=$(save "$@") +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat index f955316..832fdb6 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -49,6 +49,7 @@ goto fail @rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -59,6 +60,11 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ :execute @rem Setup the command line diff --git a/src/main/java/de/mrapp/tries/HashTrie.java b/src/main/java/de/mrapp/tries/HashTrie.java index 0907d3e..ee1283b 100644 --- a/src/main/java/de/mrapp/tries/HashTrie.java +++ b/src/main/java/de/mrapp/tries/HashTrie.java @@ -14,10 +14,9 @@ package de.mrapp.tries; import de.mrapp.tries.datastructure.AbstractTrie; -import de.mrapp.tries.datastructure.HashNode; -import de.mrapp.tries.datastructure.Structure; -import de.mrapp.tries.datastructure.UncompressedStructure; -import de.mrapp.util.datastructure.Pair; +import de.mrapp.tries.datastructure.node.HashNode; +import de.mrapp.tries.structure.Structure; +import de.mrapp.tries.structure.UncompressedStructure; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -86,31 +85,17 @@ protected final Structure createStructure() { @NotNull @Override - public HashTrie subTrie(@NotNull final SequenceType key) { - Node node = getNode(key); + public HashTrie subTrie(@Nullable final SequenceType sequence) { + Node node = getNode(sequence); if (node != null) { - Node newRootNode = createRootNode(); - Node currentNode = newRootNode; - SequenceType suffix = key; - - while (suffix != null && !suffix.isEmpty()) { - Pair, SequenceType> pair = - structure.onAddSuccessor(currentNode, suffix); - Node successor = pair.first; - suffix = pair.second; - currentNode = successor; + if (node.hasSuccessors()) { + Node rootNode = + structure.getSubTrie(sequence, createRootNode(), node); + return new HashTrie<>(rootNode); + } else { + return new HashTrie<>((Node) null); } - - for (SequenceType sequence : node) { - Node successor = node.getSuccessor(sequence); - - if (successor != null) { - currentNode.addSuccessor(sequence, successor.clone()); - } - } - - return new HashTrie<>(newRootNode); } throw new NoSuchElementException(); diff --git a/src/main/java/de/mrapp/tries/Node.java b/src/main/java/de/mrapp/tries/Node.java index 38d079e..d2dafa2 100644 --- a/src/main/java/de/mrapp/tries/Node.java +++ b/src/main/java/de/mrapp/tries/Node.java @@ -126,7 +126,7 @@ default Node addSuccessor(@NotNull final KeyType key) { * successor may not be null */ @NotNull Node addSuccessor(@NotNull final KeyType key, - @Nullable final Node successor); + @Nullable final Node successor); /** * Removes the successor, which corresponds to a specific key. @@ -257,6 +257,20 @@ default int indexOf(@NotNull KeyType key) { throw new UnsupportedOperationException(); } + /** + * Returns the index of the successor, whose key starts with the first element of another key. + * The index is obtained by using a binary search. If the node's successors are not sorted, an + * {@link UnsupportedOperationException} is thrown. + * + * @param key The key, whose first element should be searched, as an instance of the generic + * type {@link KeyType}. The key may not be null + * @return The index of the successor, whose key starts with the first element of the given key, + * as an {@link Integer} value or -1, if no such successor is available + */ + default int indexOfFirstElement(@NotNull KeyType key) { + throw new UnsupportedOperationException(); + } + /** * Increases the number of successors for which values are set by a specific amount. This causes * the number of successors of the node's predecessors to be increased recursively as well. diff --git a/src/main/java/de/mrapp/tries/PatriciaTrie.java b/src/main/java/de/mrapp/tries/PatriciaTrie.java index 06dd757..53ff279 100644 --- a/src/main/java/de/mrapp/tries/PatriciaTrie.java +++ b/src/main/java/de/mrapp/tries/PatriciaTrie.java @@ -14,14 +14,18 @@ package de.mrapp.tries; import de.mrapp.tries.datastructure.AbstractSortedTrie; -import de.mrapp.tries.datastructure.PatriciaStructure; -import de.mrapp.tries.datastructure.SortedListNode; -import de.mrapp.tries.datastructure.SortedStructure; +import de.mrapp.tries.datastructure.node.SortedListNode; +import de.mrapp.tries.structure.PatriciaStructure; +import de.mrapp.tries.structure.SortedStructure; +import de.mrapp.tries.structure.Structure.Operation; +import de.mrapp.tries.util.SequenceUtil; +import de.mrapp.util.datastructure.Pair; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Comparator; import java.util.Map; +import java.util.NoSuchElementException; /** * A sorted trie, which stores the successor of nodes in sorted lists. In contrast to a {@link @@ -44,6 +48,62 @@ public class PatriciaTrie */ private static final long serialVersionUID = 3229102065205655196L; + /** + * Traverses the trie in order to return the node, which corresponds to a specific sequence. If + * the sequence does not correspond to a node, the next higher node with the same prefix is + * returned. + * + * @param sequence The sequence, the node, which should be returned, corresponds to, as an + * instance of the generic type {@link SequenceType} or null + * @return A pair, which contains the node, which corresponds to the given sequence, + * respectively the next higher node, as well as the key, the returned node corresponds to, as + * an instance of the class {@link Pair} or null, if the given sequence does not match any node + */ + @Nullable + private Pair, SequenceType> getSubTrieRootNode( + @Nullable final SequenceType sequence) { + if (rootNode != null) { + Node currentNode = rootNode; + SequenceType matchedPrefix = null; + SequenceType suffix = sequence; + + while (suffix != null && !suffix.isEmpty()) { + Pair, SequenceType> pair = + structure.onGetSuccessor(currentNode, suffix, Operation.GET); + + if (pair == null) { + suffix = null; + + if (matchedPrefix == null || matchedPrefix.isEmpty()) { + return null; + } + } else { + currentNode = pair.first; + suffix = pair.second; + matchedPrefix = suffix == null || suffix.isEmpty() ? sequence : SequenceUtil + .subsequence(sequence, 0, sequence.length() - suffix.length()); + } + } + + if (sequence != null && !sequence.isEmpty() && matchedPrefix != null && + matchedPrefix.length() < sequence.length()) { + SequenceType unmatchedSuffix = + SequenceUtil.subsequence(sequence, matchedPrefix.length()); + int index = currentNode.indexOfFirstElement(unmatchedSuffix); + + if (index != -1) { + SequenceType successorKey = currentNode.getSuccessorKey(index); + currentNode = currentNode.getSuccessor(index); + matchedPrefix = SequenceUtil.concat(matchedPrefix, successorKey); + } + } + + return Pair.create(currentNode, matchedPrefix); + } + + return null; + } + /** * Creates a new Patricia trie. * @@ -54,7 +114,7 @@ public class PatriciaTrie * the keys should be used */ protected PatriciaTrie(@Nullable final Node rootNode, - @Nullable final Comparator comparator) { + @Nullable final Comparator comparator) { super(rootNode, comparator); } @@ -91,13 +151,13 @@ public PatriciaTrie(@Nullable final Comparator comparator) * Creates a new Patrica trie, which contains all key-value pairs that are contained by a map. * * @param comparator The comparator, which should be used to compare keys with each other, as an - * instance of< the type {@link Comparator} or null, if the natural ordering - * of the keys should be used + * instance of the type {@link Comparator} or null, if the natural ordering of + * the keys should be used * @param map The map, which contains the key-value pairs that should be added to the * trie, as an instance of the type {@link Map}. The map may not be null */ public PatriciaTrie(@Nullable final Comparator comparator, - @NotNull final Map map) { + @NotNull final Map map) { super(comparator, map); } @@ -115,9 +175,23 @@ protected final SortedStructure createStructure() { @NotNull @Override - public final SortedTrie subTrie(@NotNull final SequenceType sequence) { - // TODO - return null; + public final SortedTrie subTrie( + @Nullable final SequenceType sequence) { + Pair, SequenceType> pair = getSubTrieRootNode(sequence); + + if (pair != null) { + Node node = pair.first; + + if (node.hasSuccessors()) { + Node rootNode = + structure.getSubTrie(pair.second, createRootNode(), node); + return new PatriciaTrie<>(rootNode, comparator); + } else { + return new PatriciaTrie<>(null, comparator); + } + } + + throw new NoSuchElementException(); } @Override diff --git a/src/main/java/de/mrapp/tries/Sequence.java b/src/main/java/de/mrapp/tries/Sequence.java index 11a5b4b..9a6e22e 100644 --- a/src/main/java/de/mrapp/tries/Sequence.java +++ b/src/main/java/de/mrapp/tries/Sequence.java @@ -24,10 +24,10 @@ *

* 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 keys should be used */ private SortedListTrie(@Nullable final Node rootNode, - @Nullable final Comparator comparator) { + @Nullable final Comparator comparator) { super(rootNode, comparator); } @@ -100,7 +102,7 @@ public SortedListTrie(@Nullable final Comparator comparato * trie, as an instance of the type {@link Map}. The map may not be null */ public SortedListTrie(@Nullable final Comparator comparator, - @NotNull final Map map) { + @NotNull final Map map) { super(comparator, map); } @@ -110,6 +112,7 @@ protected final Node createRootNode() { return new SortedListNode<>(comparator); } + @NotNull @Override protected final SortedStructure createStructure() { return new UncompressedSortedStructure<>(); @@ -118,31 +121,17 @@ protected final SortedStructure createStructure() { @NotNull @Override public final SortedListTrie subTrie( - @NotNull final SequenceType sequence) { + @Nullable final SequenceType sequence) { Node node = getNode(sequence); if (node != null) { - Node newRootNode = createRootNode(); - Node currentNode = newRootNode; - SequenceType suffix = sequence; - - while (suffix != null && !suffix.isEmpty()) { - Pair, SequenceType> pair = - structure.onAddSuccessor(currentNode, suffix); - Node successor = pair.first; - suffix = pair.second; - currentNode = successor; + if (node.hasSuccessors()) { + Node rootNode = + structure.getSubTrie(sequence, createRootNode(), node); + return new SortedListTrie<>(rootNode, comparator); + } else { + return new SortedListTrie<>(null, comparator); } - - for (SequenceType key : node) { - Node successor = node.getSuccessor(key); - - if (successor != null) { - currentNode.addSuccessor(key, successor.clone()); - } - } - - return new SortedListTrie<>(newRootNode, comparator); } throw new NoSuchElementException(); diff --git a/src/main/java/de/mrapp/tries/SortedStringTrie.java b/src/main/java/de/mrapp/tries/SortedStringTrie.java index e7d9289..da6bc07 100644 --- a/src/main/java/de/mrapp/tries/SortedStringTrie.java +++ b/src/main/java/de/mrapp/tries/SortedStringTrie.java @@ -14,6 +14,7 @@ package de.mrapp.tries; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.NavigableMap; @@ -28,14 +29,14 @@ * @author Michael Rapp * @since 1.0.0 */ -public interface SortedStringTrie extends NavigableMap, - StringTrie { +public interface SortedStringTrie + extends NavigableMap, StringTrie { /** * @see StringTrie#subTrie(String) */ @NotNull @Override - SortedStringTrie subTrie(@NotNull final String sequence); + SortedStringTrie subTrie(@Nullable String sequence); } \ No newline at end of file diff --git a/src/main/java/de/mrapp/tries/SortedTrie.java b/src/main/java/de/mrapp/tries/SortedTrie.java index a8ff31b..4900883 100644 --- a/src/main/java/de/mrapp/tries/SortedTrie.java +++ b/src/main/java/de/mrapp/tries/SortedTrie.java @@ -14,6 +14,7 @@ package de.mrapp.tries; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.NavigableMap; @@ -40,6 +41,6 @@ public interface SortedTrie */ @NotNull @Override - SortedTrie subTrie(@NotNull SequenceType sequence); + SortedTrie subTrie(@Nullable SequenceType sequence); } \ No newline at end of file diff --git a/src/main/java/de/mrapp/tries/StringTrie.java b/src/main/java/de/mrapp/tries/StringTrie.java index a3fcf01..b1a206a 100644 --- a/src/main/java/de/mrapp/tries/StringTrie.java +++ b/src/main/java/de/mrapp/tries/StringTrie.java @@ -39,13 +39,11 @@ public interface StringTrie extends Map, Serializa /** * @see Trie#getRootNode() */ - @Nullable - Node getRootNode(); + @Nullable Node getRootNode(); /** * @see Trie#subTrie(Sequence) */ - @NotNull - StringTrie subTrie(@NotNull String sequence); + @NotNull StringTrie subTrie(@Nullable String sequence); } \ No newline at end of file diff --git a/src/main/java/de/mrapp/tries/Trie.java b/src/main/java/de/mrapp/tries/Trie.java index e9cdcd9..05bb232 100644 --- a/src/main/java/de/mrapp/tries/Trie.java +++ b/src/main/java/de/mrapp/tries/Trie.java @@ -49,24 +49,21 @@ public interface Trie * @return The root node of the trie as an instance of the type {@link Node} or null, if the * trie is empty */ - @Nullable - Node getRootNode(); + @Nullable Node getRootNode(); /** * 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). If the given - * sequence is not contained by the trie, a {@link java.util.NoSuchElementException} will be - * thrown. + * sequence corresponds to a key, the key is not included in the subtree. If the given sequence + * is not contained by the trie, a {@link java.util.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. * - * @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 subTrie(@NotNull SequenceType sequence); + @NotNull Trie subTrie(@Nullable SequenceType sequence); } \ No newline at end of file diff --git a/src/main/java/de/mrapp/tries/datastructure/AbstractSingletonTrie.java b/src/main/java/de/mrapp/tries/datastructure/AbstractSingletonTrie.java index 0de4559..da38003 100644 --- a/src/main/java/de/mrapp/tries/datastructure/AbstractSingletonTrie.java +++ b/src/main/java/de/mrapp/tries/datastructure/AbstractSingletonTrie.java @@ -17,6 +17,8 @@ import de.mrapp.tries.NodeValue; import de.mrapp.tries.Sequence; import de.mrapp.tries.Trie; +import de.mrapp.tries.datastructure.node.HashNode; +import de.mrapp.tries.datastructure.node.UnmodifiableNode; import de.mrapp.tries.util.SequenceUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/de/mrapp/tries/datastructure/AbstractSortedTrie.java b/src/main/java/de/mrapp/tries/datastructure/AbstractSortedTrie.java index 4692da3..f342d84 100644 --- a/src/main/java/de/mrapp/tries/datastructure/AbstractSortedTrie.java +++ b/src/main/java/de/mrapp/tries/datastructure/AbstractSortedTrie.java @@ -16,6 +16,8 @@ import de.mrapp.tries.Node; import de.mrapp.tries.Sequence; import de.mrapp.tries.SortedTrie; +import de.mrapp.tries.structure.SortedStructure; +import de.mrapp.tries.structure.Structure; import de.mrapp.tries.util.EntryUtil; import de.mrapp.tries.util.SequenceUtil; import de.mrapp.util.datastructure.Pair; @@ -149,7 +151,7 @@ public K pollLast() { @NotNull @Override public NavigableSet subSet(final K fromElement, final boolean fromInclusive, - final K toElement, final boolean toInclusive) { + final K toElement, final boolean toInclusive) { return new NavigableKeySet<>( backingMap.subMap(fromElement, fromInclusive, toElement, toInclusive)); } @@ -341,8 +343,7 @@ static final class AscendingSubMapEntryIterator * restricted */ AscendingSubMapEntryIterator(@NotNull final AbstractSortedTrie trie, - @Nullable final Map.Entry first, - @Nullable final Map.Entry fence) { + @Nullable final Map.Entry first, @Nullable final Map.Entry fence) { super(trie, first, fence); } @@ -383,8 +384,7 @@ static final class DescendingSubMapEntryIterator * restricted */ DescendingSubMapEntryIterator(@NotNull final AbstractSortedTrie trie, - @Nullable final Map.Entry first, - @Nullable final Map.Entry fence) { + @Nullable final Map.Entry first, @Nullable final Map.Entry fence) { super(trie, first, fence); } @@ -436,8 +436,7 @@ abstract static class AbstractSubMapEntryIterator * restricted */ AbstractSubMapEntryIterator(@NotNull final AbstractSortedTrie trie, - @Nullable final Map.Entry first, - @Nullable final Map.Entry fence) { + @Nullable final Map.Entry first, @Nullable final Map.Entry fence) { super(trie, first); this.fenceKey = fence != null ? fence.getKey() : UNRESTRICTED_KEY; } @@ -464,11 +463,37 @@ public final boolean hasNext() { */ private final Comparator comparator; - final K fromKey, toKey; + /** + * The first key of the sub map. + */ + final K fromKey; + + /** + * The last key of the sub map. + */ + final K toKey; - final boolean fromStart, toEnd; + /** + * True, if the sub map starts at the first key of the backing trie, false otherwise. If + * true, the {@link #fromKey} is ignored. + */ + final boolean fromStart; - final boolean fromInclusive, toInclusive; + /** + * True, if the sub map ends at the last key of the backing trie, false otherwise. If true, + * the {@link #toKey} is ignored. + */ + final boolean toEnd; + + /** + * True, if the {@link #firstKey} is included in the sub map, false otherwise. + */ + final boolean fromInclusive; + + /** + * True, if the {@link #toKey} is included in the sub map, false otherwise. + */ + final boolean toInclusive; /** * Returns, whether a key is too low to be included in the sub map. @@ -759,8 +784,8 @@ final Map.Entry getLowFence() { * otherwise */ AbstractSubMap(@NotNull final AbstractSortedTrie trie, final boolean fromStart, - @Nullable final K fromKey, final boolean fromInclusive, final boolean toEnd, - @Nullable final K toKey, final boolean toInclusive) { + @Nullable final K fromKey, final boolean fromInclusive, final boolean toEnd, + @Nullable final K toKey, final boolean toInclusive) { ensureNotNull(trie, "The trie may not be null"); this.trie = trie; this.comparator = SequenceUtil.comparator(trie.comparator); @@ -978,8 +1003,8 @@ public Iterator> iterator() { * otherwise */ AscendingSubMap(@NotNull final AbstractSortedTrie trie, final boolean fromStart, - @Nullable final K fromKey, final boolean fromInclusive, final boolean toEnd, - @Nullable final K toKey, final boolean toInclusive) { + @Nullable final K fromKey, final boolean fromInclusive, final boolean toEnd, + @Nullable final K toKey, final boolean toInclusive) { super(trie, fromStart, fromKey, fromInclusive, toEnd, toKey, toInclusive); } @@ -990,7 +1015,7 @@ public Comparator comparator() { @Override public NavigableMap subMap(final K fromKey, final boolean fromInclusive, - final K toKey, final boolean toInclusive) { + final K toKey, final boolean toInclusive) { ensureTrue(isInRange(fromKey, fromInclusive), "fromKey out of range"); ensureTrue(isInRange(toKey, toInclusive), "toKey out of range"); return new AscendingSubMap<>(trie, false, fromKey, fromInclusive, false, toKey, @@ -1130,8 +1155,8 @@ public Iterator> iterator() { * otherwise */ DescendingSubMap(@NotNull final AbstractSortedTrie trie, final boolean fromStart, - @Nullable final K fromKey, final boolean fromInclusive, - final boolean toEnd, @Nullable final K toKey, final boolean toInclusive) { + @Nullable final K fromKey, final boolean fromInclusive, final boolean toEnd, + @Nullable final K toKey, final boolean toInclusive) { super(trie, fromStart, fromKey, fromInclusive, toEnd, toKey, toInclusive); this.reverseComparator = trie.comparator() != null ? Collections.reverseOrder(trie.comparator()) : null; @@ -1144,7 +1169,7 @@ public Comparator comparator() { @Override public NavigableMap subMap(final K fromKey, final boolean fromInclusive, - final K toKey, final boolean toInclusive) { + final K toKey, final boolean toInclusive) { ensureTrue(isInRange(fromKey, fromInclusive), "fromKey out of range"); ensureTrue(isInRange(toKey, toInclusive), "fromKey out of range"); return new DescendingSubMap<>(trie, false, toKey, toInclusive, false, fromKey, @@ -1248,7 +1273,7 @@ private static final class AscendingKeyIterator * or null, if the trie is empty */ AscendingKeyIterator(@NotNull final AbstractSortedTrie trie, - @Nullable final Map.Entry first) { + @Nullable final Map.Entry first) { super(trie, first); } @@ -1284,7 +1309,7 @@ private static final class DescendingKeyIterator * or null, if the trie is empty */ DescendingKeyIterator(@NotNull final AbstractSortedTrie trie, - @Nullable final Map.Entry first) { + @Nullable final Map.Entry first) { super(trie, first); } @@ -1332,7 +1357,7 @@ private static abstract class AbstractEntryIterator * or null, if the trie is empty */ AbstractEntryIterator(@NotNull final AbstractSortedTrie trie, - @Nullable final Map.Entry first) { + @Nullable final Map.Entry first) { super(trie); this.next = first; this.lastReturned = null; @@ -1380,7 +1405,7 @@ private static final class SpliteratorWrapper * {@link Iterator}. The iterator may not be null */ SpliteratorWrapper(@NotNull final AbstractSortedTrie trie, - @NotNull final Iterator iterator) { + @NotNull final Iterator iterator) { super(trie); ensureNotNull(iterator, "The iterator may not be null"); this.iterator = iterator; @@ -1851,7 +1876,7 @@ final Spliterator descendingKeySpliterator() { * the keys should be used */ protected AbstractSortedTrie(@Nullable final Node rootNode, - @Nullable final Comparator comparator) { + @Nullable final Comparator comparator) { super(rootNode); this.comparator = comparator; } @@ -1877,7 +1902,7 @@ public AbstractSortedTrie(@Nullable final Comparator compa * trie, as an instance of the type {@link Map}. The map may not be null */ public AbstractSortedTrie(@Nullable final Comparator comparator, - @NotNull final Map map) { + @NotNull final Map map) { this(comparator); putAll(map); } @@ -2025,16 +2050,14 @@ public final Entry pollLastEntry() { @NotNull @Override public final SortedMap subMap(final SequenceType fromKey, - final SequenceType toKey) { + final SequenceType toKey) { return subMap(fromKey, true, toKey, false); } @NotNull @Override public final NavigableMap subMap(final SequenceType fromKey, - final boolean fromInclusive, - final SequenceType toKey, - final boolean toInclusive) { + final boolean fromInclusive, final SequenceType toKey, final boolean toInclusive) { return new AscendingSubMap<>(this, false, fromKey, fromInclusive, false, toKey, toInclusive); } @@ -2048,7 +2071,7 @@ public final SortedMap headMap(final SequenceType toKey @NotNull @Override public final NavigableMap headMap(final SequenceType toKey, - final boolean inclusive) { + final boolean inclusive) { return new AscendingSubMap<>(this, true, null, true, false, toKey, inclusive); } @@ -2060,7 +2083,7 @@ public final SortedMap tailMap(final SequenceType fromK @Override public final NavigableMap tailMap(final SequenceType fromKey, - final boolean inclusive) { + final boolean inclusive) { return new AscendingSubMap<>(this, false, fromKey, inclusive, true, null, true); } diff --git a/src/main/java/de/mrapp/tries/datastructure/AbstractTrie.java b/src/main/java/de/mrapp/tries/datastructure/AbstractTrie.java index 5add6a7..ee6e297 100644 --- a/src/main/java/de/mrapp/tries/datastructure/AbstractTrie.java +++ b/src/main/java/de/mrapp/tries/datastructure/AbstractTrie.java @@ -17,7 +17,9 @@ import de.mrapp.tries.NodeValue; import de.mrapp.tries.Sequence; import de.mrapp.tries.Trie; -import de.mrapp.tries.datastructure.Structure.Operation; +import de.mrapp.tries.datastructure.node.UnmodifiableNode; +import de.mrapp.tries.structure.Structure; +import de.mrapp.tries.structure.Structure.Operation; import de.mrapp.tries.util.EntryUtil; import de.mrapp.tries.util.SequenceUtil; import de.mrapp.util.datastructure.Pair; @@ -571,28 +573,28 @@ static abstract class AbstractIterator rootNode; + protected Node rootNode; /** * A counter, which is increased whenever the trie is modified. It is used to fast-fail * iterators by throwing a {@link ConcurrentModificationException}. */ - long modificationCount; + transient long modificationCount; /** * The values of the trie (see {@link #values()}). */ - private Collection values; + private transient Collection values; /** * The key set of the trie (see {@link #keySet()}). */ - private Set keySet; + private transient Set keySet; /** * The entry set of the trie (see {@link #entrySet()}). */ - private Set> entrySet; + private transient Set> entrySet; /** * The method, which is invoked on subclasses in order to create the trie's root node. diff --git a/src/main/java/de/mrapp/tries/datastructure/SortedStringTrieWrapper.java b/src/main/java/de/mrapp/tries/datastructure/SortedStringTrieWrapper.java index 073bd2c..d769076 100644 --- a/src/main/java/de/mrapp/tries/datastructure/SortedStringTrieWrapper.java +++ b/src/main/java/de/mrapp/tries/datastructure/SortedStringTrieWrapper.java @@ -31,16 +31,16 @@ * @author Michael Rapp * @since 1.0.0 */ -public class SortedStringTrieWrapper extends - AbstractStringTrieWrapper, ValueType> implements - SortedStringTrie { +public class SortedStringTrieWrapper + extends AbstractStringTrieWrapper, ValueType> + implements SortedStringTrie { /** * A comparator, which allows to compare instances of the class {@link StringSequence} by * encapsulating a comparator, which compares {@link String}s. */ - protected static final class StringSequenceComparatorWrapper implements - Comparator { + protected static final class StringSequenceComparatorWrapper + implements Comparator { /** * The encapsulated comparator. @@ -105,8 +105,8 @@ public int compare(final String o1, final String o2) { * * @param The type of the encapsulated set */ - private static class SortedKeySetWrapper> extends - KeySetWrapper implements SortedSet { + private static class SortedKeySetWrapper> + extends KeySetWrapper implements SortedSet { /** * The comparator of the sorted set. @@ -169,8 +169,9 @@ public final String last() { * The navigable key set of a {@link SortedStringTrie}. It encapsulates the navigable key set of * a {@link SortedTrie}. */ - private static final class NavigableKeySetWrapper extends - SortedKeySetWrapper> implements NavigableSet { + private static final class NavigableKeySetWrapper + extends SortedKeySetWrapper> + implements NavigableSet { /** * The descending key set. @@ -244,7 +245,7 @@ public Iterator descendingIterator() { @NotNull @Override public NavigableSet subSet(final String fromElement, final boolean fromInclusive, - final String toElement, final boolean toInclusive) { + final String toElement, final boolean toInclusive) { return new NavigableKeySetWrapper( set.subSet(StringSequence.convertFromString(fromElement), fromInclusive, StringSequence.convertFromString(toElement), toInclusive)); @@ -273,8 +274,8 @@ public NavigableSet tailSet(final String fromElement, final boolean incl * @param The type of the values, which are stored by the trie * @param The type of the encapsulated map */ - private static class SortedMapWrapper> extends - AbstractMap implements SortedMap { + private static class SortedMapWrapper> + extends AbstractMap implements SortedMap { /** * The encapsulated map. @@ -387,9 +388,9 @@ public final boolean remove(final Object key, final Object value) { * * @param The type of the values, which are stored by the trie */ - private static final class NavigableMapWrapper extends - SortedMapWrapper> implements - NavigableMap { + private static final class NavigableMapWrapper + extends SortedMapWrapper> + implements NavigableMap { /** * Creates a new navigable map of a {@link SortedStringTrie}. @@ -482,7 +483,7 @@ public NavigableSet descendingKeySet() { @Override public NavigableMap subMap(final String fromKey, final boolean fromInclusive, - final String toKey, final boolean toInclusive) { + final String toKey, final boolean toInclusive) { return new NavigableMapWrapper<>( map.subMap(StringSequence.convertFromString(fromKey), fromInclusive, StringSequence.convertFromString(toKey), toInclusive)); @@ -537,8 +538,7 @@ static Entry convertEntry(@Nullable final Entry trie) { + public SortedStringTrieWrapper(@NotNull final SortedTrie trie) { super(trie); Comparator comparator = trie.comparator(); this.comparator = comparator != null ? new StringComparatorWrapper(comparator) : null; @@ -624,9 +624,7 @@ public final NavigableSet descendingKeySet() { @Override public final NavigableMap subMap(final String fromKey, - final boolean fromInclusive, - final String toKey, - final boolean toInclusive) { + final boolean fromInclusive, final String toKey, final boolean toInclusive) { return new NavigableMapWrapper<>( trie.subMap(StringSequence.convertFromString(fromKey), fromInclusive, StringSequence.convertFromString(toKey), toInclusive)); @@ -634,14 +632,14 @@ public final NavigableMap subMap(final String fromKey, @Override public final NavigableMap headMap(final String toKey, - final boolean inclusive) { + final boolean inclusive) { return new NavigableMapWrapper<>( trie.headMap(StringSequence.convertFromString(toKey), inclusive)); } @Override public final NavigableMap tailMap(final String fromKey, - final boolean inclusive) { + final boolean inclusive) { return new NavigableMapWrapper<>( trie.tailMap(StringSequence.convertFromString(fromKey), inclusive)); } @@ -682,8 +680,9 @@ public final String lastKey() { @NotNull @Override - public final SortedStringTrie subTrie(@NotNull final String sequence) { - return new SortedStringTrieWrapper<>(trie.subTrie(new StringSequence(sequence))); + public final SortedStringTrie subTrie(@Nullable final String sequence) { + return new SortedStringTrieWrapper<>( + trie.subTrie(StringSequence.convertFromString(sequence))); } } \ No newline at end of file diff --git a/src/main/java/de/mrapp/tries/datastructure/StringTrieWrapper.java b/src/main/java/de/mrapp/tries/datastructure/StringTrieWrapper.java index 5408faf..871b706 100644 --- a/src/main/java/de/mrapp/tries/datastructure/StringTrieWrapper.java +++ b/src/main/java/de/mrapp/tries/datastructure/StringTrieWrapper.java @@ -17,6 +17,7 @@ import de.mrapp.tries.Trie; import de.mrapp.tries.sequence.StringSequence; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * A wrapper, which implements the interface {@link StringTrie} by delegating all method calls to an @@ -26,9 +27,9 @@ * @author Michael Rapp * @since 1.0.0 */ -public class StringTrieWrapper extends - AbstractStringTrieWrapper, ValueType> implements - StringTrie { +public class StringTrieWrapper + extends AbstractStringTrieWrapper, ValueType> + implements StringTrie { /** * The constant serial version UID. @@ -47,8 +48,8 @@ public StringTrieWrapper(@NotNull final Trie trie) { @NotNull @Override - public final StringTrieWrapper subTrie(@NotNull final String sequence) { - return new StringTrieWrapper<>(trie.subTrie(new StringSequence(sequence))); + public final StringTrieWrapper subTrie(@Nullable final String sequence) { + return new StringTrieWrapper<>(trie.subTrie(StringSequence.convertFromString(sequence))); } } \ No newline at end of file diff --git a/src/main/java/de/mrapp/tries/datastructure/AbstractNode.java b/src/main/java/de/mrapp/tries/datastructure/node/AbstractNode.java similarity index 99% rename from src/main/java/de/mrapp/tries/datastructure/AbstractNode.java rename to src/main/java/de/mrapp/tries/datastructure/node/AbstractNode.java index 3bdbc2e..6423ff4 100644 --- a/src/main/java/de/mrapp/tries/datastructure/AbstractNode.java +++ b/src/main/java/de/mrapp/tries/datastructure/node/AbstractNode.java @@ -11,7 +11,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package de.mrapp.tries.datastructure; +package de.mrapp.tries.datastructure.node; import de.mrapp.tries.Node; import de.mrapp.tries.NodeValue; diff --git a/src/main/java/de/mrapp/tries/datastructure/HashNode.java b/src/main/java/de/mrapp/tries/datastructure/node/HashNode.java similarity index 98% rename from src/main/java/de/mrapp/tries/datastructure/HashNode.java rename to src/main/java/de/mrapp/tries/datastructure/node/HashNode.java index e386cc7..51dae64 100644 --- a/src/main/java/de/mrapp/tries/datastructure/HashNode.java +++ b/src/main/java/de/mrapp/tries/datastructure/node/HashNode.java @@ -11,7 +11,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package de.mrapp.tries.datastructure; +package de.mrapp.tries.datastructure.node; import de.mrapp.tries.Node; import de.mrapp.tries.Sequence; diff --git a/src/main/java/de/mrapp/tries/datastructure/SortedListNode.java b/src/main/java/de/mrapp/tries/datastructure/node/SortedListNode.java similarity index 89% rename from src/main/java/de/mrapp/tries/datastructure/SortedListNode.java rename to src/main/java/de/mrapp/tries/datastructure/node/SortedListNode.java index 134d1b3..8f5befe 100644 --- a/src/main/java/de/mrapp/tries/datastructure/SortedListNode.java +++ b/src/main/java/de/mrapp/tries/datastructure/node/SortedListNode.java @@ -11,7 +11,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package de.mrapp.tries.datastructure; +package de.mrapp.tries.datastructure.node; import de.mrapp.tries.Node; import de.mrapp.tries.Sequence; @@ -26,6 +26,7 @@ import java.util.RandomAccess; import static de.mrapp.util.Condition.ensureNotNull; +import static de.mrapp.util.Condition.ensureTrue; /** * A node of a trie, which stores its successors in a {@link SortedArrayList}. @@ -35,9 +36,8 @@ * @author Michael Rapp * @since 1.0.0 */ -public class SortedListNode extends - AbstractNode - implements RandomAccess { +public class SortedListNode + extends AbstractNode implements RandomAccess { /** * A directed edge, which references a successor of a node. @@ -45,8 +45,8 @@ public class SortedListNode extends * @param The type of the key, the successor corresponds to * @param The type of the successor's value */ - private static class Edge implements Serializable, - Comparable> { + private static class Edge + implements Serializable, Comparable> { /** * The constant serial version UID. @@ -80,7 +80,7 @@ private static class Edge implements Serializable, * the natural order of the keys should be used */ Edge(@NotNull final K key, @NotNull final Node successor, - @Nullable final Comparator comparator) { + @Nullable final Comparator comparator) { ensureNotNull(key, "The key may not be null"); ensureNotNull(successor, "The successor may not be null"); this.key = key; @@ -153,7 +153,7 @@ public SortedListNode(@Nullable final Comparator comparator) { @NotNull @Override protected final Node onAddSuccessor(@NotNull final KeyType key, - @Nullable final Node successor) { + @Nullable final Node successor) { Node successorToAdd = successor == null ? new SortedListNode<>(comparator) : successor; successors.add(new Edge<>(key, successorToAdd, comparator)); @@ -212,6 +212,17 @@ public final int indexOf(@NotNull final KeyType key) { key); } + @SuppressWarnings("unchecked") + @Override + public final int indexOfFirstElement(@NotNull final KeyType key) { + ensureTrue(RandomAccess.class.isAssignableFrom(getClass()), null, + UnsupportedOperationException.class); + KeyType firstElement = SequenceUtil.subsequence(key, 0, 1); + return SequenceUtil.binarySearch(getSuccessorCount(), this::getSuccessorKey, + (o1, o2) -> ((Comparable) SequenceUtil.subsequence(o1, 0, 1)) + .compareTo(SequenceUtil.subsequence(o2, 0, 1)), firstElement); + } + @Override public final void removeSuccessor(final int index) { Edge edge = successors.remove(index); diff --git a/src/main/java/de/mrapp/tries/datastructure/UnmodifiableNode.java b/src/main/java/de/mrapp/tries/datastructure/node/UnmodifiableNode.java similarity index 99% rename from src/main/java/de/mrapp/tries/datastructure/UnmodifiableNode.java rename to src/main/java/de/mrapp/tries/datastructure/node/UnmodifiableNode.java index e0e10dd..17c62a7 100644 --- a/src/main/java/de/mrapp/tries/datastructure/UnmodifiableNode.java +++ b/src/main/java/de/mrapp/tries/datastructure/node/UnmodifiableNode.java @@ -11,7 +11,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package de.mrapp.tries.datastructure; +package de.mrapp.tries.datastructure.node; import de.mrapp.tries.Node; import de.mrapp.tries.NodeValue; diff --git a/src/main/java/de/mrapp/tries/datastructure/PatriciaStructure.java b/src/main/java/de/mrapp/tries/structure/PatriciaStructure.java similarity index 85% rename from src/main/java/de/mrapp/tries/datastructure/PatriciaStructure.java rename to src/main/java/de/mrapp/tries/structure/PatriciaStructure.java index ab2d75b..c188c52 100644 --- a/src/main/java/de/mrapp/tries/datastructure/PatriciaStructure.java +++ b/src/main/java/de/mrapp/tries/structure/PatriciaStructure.java @@ -11,7 +11,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package de.mrapp.tries.datastructure; +package de.mrapp.tries.structure; import de.mrapp.tries.Node; import de.mrapp.tries.Sequence; @@ -52,10 +52,7 @@ public class PatriciaStructure private Triple indexOfInternal( @NotNull final Node node, @NotNull final SequenceType sequence) { - SequenceType firstElement = SequenceUtil.subsequence(sequence, 0, 1); - int index = SequenceUtil.binarySearch(node.getSuccessorCount(), node::getSuccessorKey, - (o1, o2) -> ((Comparable) SequenceUtil.subsequence(o1, 0, 1)) - .compareTo(SequenceUtil.subsequence(o2, 0, 1)), firstElement); + int index = node.indexOfFirstElement(sequence); if (index != -1) { SequenceType successorKey = node.getSuccessorKey(index); @@ -139,8 +136,12 @@ public final Pair, SequenceType> onGetSuccessor( Pair.create(successor, suffix) : null; } else { int sequenceLength = sequence.length(); - return sequenceLength == prefixLength && successorKey.length() > sequenceLength ? - null : Pair.create(successor, suffix); + + if (sequenceLength == prefixLength && successorKey.length() > sequenceLength) { + return operation == Operation.SUB_TRIE ? Pair.create(node, null) : null; + } + + return Pair.create(successor, suffix); } } @@ -158,7 +159,7 @@ public final Pair, SequenceType> onAddSuccessor( @Override public final void onRemoveSuccessor(@NotNull final Node node, - @NotNull final SequenceType sequence) { + @NotNull final SequenceType sequence) { node.removeSuccessor(sequence); removeIntermediateNode(node); } @@ -168,6 +169,30 @@ public final void onDeletedValue(@NotNull final Node no removeIntermediateNode(node); } + @NotNull + @Override + public final Node getSubTrie(@Nullable final SequenceType sequence, + @NotNull final Node rootNode, + @NotNull final Node node) { + Node currentNode = rootNode; + + if (sequence != null && !sequence.isEmpty()) { + Pair, SequenceType> pair = + onAddSuccessor(rootNode, sequence); + currentNode = pair.first; + } + + for (SequenceType successorKey : node) { + Node successor = node.getSuccessor(successorKey); + + if (successor != null) { + currentNode.addSuccessor(successorKey, successor.clone()); + } + } + + return rootNode; + } + @Nullable @Override public final Pair indexOf( diff --git a/src/main/java/de/mrapp/tries/datastructure/SortedStructure.java b/src/main/java/de/mrapp/tries/structure/SortedStructure.java similarity index 98% rename from src/main/java/de/mrapp/tries/datastructure/SortedStructure.java rename to src/main/java/de/mrapp/tries/structure/SortedStructure.java index 34851a7..c6b1058 100644 --- a/src/main/java/de/mrapp/tries/datastructure/SortedStructure.java +++ b/src/main/java/de/mrapp/tries/structure/SortedStructure.java @@ -11,7 +11,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package de.mrapp.tries.datastructure; +package de.mrapp.tries.structure; import de.mrapp.tries.Node; import de.mrapp.tries.Sequence; diff --git a/src/main/java/de/mrapp/tries/datastructure/Structure.java b/src/main/java/de/mrapp/tries/structure/Structure.java similarity index 81% rename from src/main/java/de/mrapp/tries/datastructure/Structure.java rename to src/main/java/de/mrapp/tries/structure/Structure.java index 264109e..7c24523 100644 --- a/src/main/java/de/mrapp/tries/datastructure/Structure.java +++ b/src/main/java/de/mrapp/tries/structure/Structure.java @@ -11,7 +11,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package de.mrapp.tries.datastructure; +package de.mrapp.tries.structure; import de.mrapp.tries.Node; import de.mrapp.tries.Sequence; @@ -49,7 +49,12 @@ enum Operation { /** * An operation, which puts data into the trie. */ - PUT + PUT, + + /** + * An operation, which creates a subtrie of the trie. + */ + SUB_TRIE } @@ -100,7 +105,7 @@ enum Operation { * be null, nor empty */ void onRemoveSuccessor(@NotNull Node node, - @NotNull SequenceType sequence); + @NotNull SequenceType sequence); /** * The method, which is invoked on subclasses, when the value of a not was deleted. This @@ -112,4 +117,21 @@ void onRemoveSuccessor(@NotNull Node node, */ void onDeletedValue(@NotNull Node 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). + * + * @param sequence The sequence as an instance of the generic type {@link SequenceType}. The + * sequence may not be null + * @param rootNode The root node of the subtree, which should be returned, as an instance of the + * type {@link Node}. The root node may not be null + * @param node The node, which corresponds the given sequence as an instance of the type + * {@link Node}. The node may not be null + * @return The root node of the subtree as an instance of the type {@link Node}. The root node + * may not be null + */ + @NotNull Node getSubTrie(@Nullable SequenceType sequence, + @NotNull Node rootNode, + @NotNull Node node); + } \ No newline at end of file diff --git a/src/main/java/de/mrapp/tries/datastructure/UncompressedSortedStructure.java b/src/main/java/de/mrapp/tries/structure/UncompressedSortedStructure.java similarity index 98% rename from src/main/java/de/mrapp/tries/datastructure/UncompressedSortedStructure.java rename to src/main/java/de/mrapp/tries/structure/UncompressedSortedStructure.java index c8804fe..c198c28 100644 --- a/src/main/java/de/mrapp/tries/datastructure/UncompressedSortedStructure.java +++ b/src/main/java/de/mrapp/tries/structure/UncompressedSortedStructure.java @@ -11,7 +11,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package de.mrapp.tries.datastructure; +package de.mrapp.tries.structure; import de.mrapp.tries.Node; import de.mrapp.tries.Sequence; diff --git a/src/main/java/de/mrapp/tries/datastructure/UncompressedStructure.java b/src/main/java/de/mrapp/tries/structure/UncompressedStructure.java similarity index 71% rename from src/main/java/de/mrapp/tries/datastructure/UncompressedStructure.java rename to src/main/java/de/mrapp/tries/structure/UncompressedStructure.java index abd89a7..11e72c4 100644 --- a/src/main/java/de/mrapp/tries/datastructure/UncompressedStructure.java +++ b/src/main/java/de/mrapp/tries/structure/UncompressedStructure.java @@ -11,7 +11,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package de.mrapp.tries.datastructure; +package de.mrapp.tries.structure; import de.mrapp.tries.Node; import de.mrapp.tries.Sequence; @@ -61,7 +61,7 @@ public final Pair, SequenceType> onAddSuccessor( @Override public final void onRemoveSuccessor(@NotNull final Node node, - @NotNull final SequenceType sequence) { + @NotNull final SequenceType sequence) { node.removeSuccessor(sequence); } @@ -70,4 +70,31 @@ public final void onDeletedValue(@NotNull final Node no } + @NotNull + @Override + public final Node getSubTrie(@Nullable final SequenceType sequence, + @NotNull final Node rootNode, + @NotNull final Node node) { + Node currentNode = rootNode; + SequenceType suffix = sequence; + + while (suffix != null && !suffix.isEmpty()) { + Pair, SequenceType> pair = + onAddSuccessor(currentNode, suffix); + Node successor = pair.first; + suffix = pair.second; + currentNode = successor; + } + + for (SequenceType successorKey : node) { + Node successor = node.getSuccessor(successorKey); + + if (successor != null) { + currentNode.addSuccessor(successorKey, successor.clone()); + } + } + + return rootNode; + } + } \ No newline at end of file diff --git a/src/test/java/de/mrapp/tries/HashStringTrieTest.java b/src/test/java/de/mrapp/tries/HashStringTrieTest.java index a6f5f62..228a615 100644 --- a/src/test/java/de/mrapp/tries/HashStringTrieTest.java +++ b/src/test/java/de/mrapp/tries/HashStringTrieTest.java @@ -15,8 +15,7 @@ import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.Assert.*; /** * Tests the functionality of the class {@link HashStringTrie}. @@ -30,6 +29,86 @@ HashStringTrie onCreateTrie() { return new HashStringTrie<>(); } + @Test + public final void testSubTrieWithEmptySequence() { + testPutWithNullKey(); + StringTrie subTrie = trie.subTrie(""); + assertFalse(subTrie.isEmpty()); + assertEquals(8, subTrie.size()); + assertNull("A", subTrie.get("A")); + assertEquals("tea", subTrie.get("B")); + assertEquals("tea", subTrie.get("tea")); + assertEquals("ted", subTrie.get("ted")); + assertEquals("ten", subTrie.get("ten")); + assertEquals("to", subTrie.get("to")); + assertEquals("in", subTrie.get("in")); + assertEquals("inn", subTrie.get("inn")); + verifyRootNode(subTrie.getRootNode()); + verifySuccessors(subTrie.getRootNode(), "A", "B", "t", "i"); + Node ASuccessor = getSuccessor(subTrie.getRootNode(), "A"); + verifyLeaf(ASuccessor, null); + Node BSuccessor = getSuccessor(subTrie.getRootNode(), "B"); + verifyLeaf(BSuccessor, "tea"); + Node tSuccessor = getSuccessor(subTrie.getRootNode(), "t"); + verifySuccessors(tSuccessor, "e", "o"); + Node eSuccessor = getSuccessor(tSuccessor, "e"); + verifySuccessors(eSuccessor, "a", "d", "n"); + Node aSuccessor = getSuccessor(eSuccessor, "a"); + verifyLeaf(aSuccessor, "tea"); + Node dSuccessor = getSuccessor(eSuccessor, "d"); + verifyLeaf(dSuccessor, "ted"); + Node nSuccessor = getSuccessor(eSuccessor, "n"); + verifyLeaf(nSuccessor, "ten"); + Node oSuccessor = getSuccessor(tSuccessor, "o"); + verifyLeaf(oSuccessor, "to"); + Node iSuccessor = getSuccessor(subTrie.getRootNode(), "i"); + verifySuccessors(iSuccessor, "n"); + Node n2Successor = getSuccessor(iSuccessor, "n"); + verifySuccessors(n2Successor, "n"); + Node n3Successor = getSuccessor(n2Successor, "n"); + verifyLeaf(n3Successor, "inn"); + } + + @Test + public final void testSubTrieWithNullSequence() { + testPutWithNullKey(); + StringTrie subTrie = trie.subTrie(null); + assertFalse(subTrie.isEmpty()); + assertEquals(8, subTrie.size()); + assertNull("A", subTrie.get("A")); + assertEquals("tea", subTrie.get("B")); + assertEquals("tea", subTrie.get("tea")); + assertEquals("ted", subTrie.get("ted")); + assertEquals("ten", subTrie.get("ten")); + assertEquals("to", subTrie.get("to")); + assertEquals("in", subTrie.get("in")); + assertEquals("inn", subTrie.get("inn")); + verifyRootNode(subTrie.getRootNode()); + verifySuccessors(subTrie.getRootNode(), "A", "B", "t", "i"); + Node ASuccessor = getSuccessor(subTrie.getRootNode(), "A"); + verifyLeaf(ASuccessor, null); + Node BSuccessor = getSuccessor(subTrie.getRootNode(), "B"); + verifyLeaf(BSuccessor, "tea"); + Node tSuccessor = getSuccessor(subTrie.getRootNode(), "t"); + verifySuccessors(tSuccessor, "e", "o"); + Node eSuccessor = getSuccessor(tSuccessor, "e"); + verifySuccessors(eSuccessor, "a", "d", "n"); + Node aSuccessor = getSuccessor(eSuccessor, "a"); + verifyLeaf(aSuccessor, "tea"); + Node dSuccessor = getSuccessor(eSuccessor, "d"); + verifyLeaf(dSuccessor, "ted"); + Node nSuccessor = getSuccessor(eSuccessor, "n"); + verifyLeaf(nSuccessor, "ten"); + Node oSuccessor = getSuccessor(tSuccessor, "o"); + verifyLeaf(oSuccessor, "to"); + Node iSuccessor = getSuccessor(subTrie.getRootNode(), "i"); + verifySuccessors(iSuccessor, "n"); + Node n2Successor = getSuccessor(iSuccessor, "n"); + verifySuccessors(n2Successor, "n"); + Node n3Successor = getSuccessor(n2Successor, "n"); + verifyLeaf(n3Successor, "inn"); + } + @Test public final void testSubTrie1() { testPutWithNullKey(); @@ -72,6 +151,32 @@ public final void testSubTrie2() { verifyLeaf(leaf, "ten"); } + @Test + public final void testSubTrieIfSequenceCorrespondsToNode() { + testPutWithNullKey(); + StringTrie subTrie = trie.subTrie("in"); + assertFalse(subTrie.isEmpty()); + assertEquals(1, subTrie.size()); + assertEquals("inn", subTrie.get("inn")); + verifyRootNode(subTrie.getRootNode()); + verifySuccessors(subTrie.getRootNode(), "i"); + Node iSuccessor = getSuccessor(subTrie.getRootNode(), "i"); + verifySuccessors(iSuccessor, "n"); + Node nSuccessor = getSuccessor(iSuccessor, "n"); + verifySuccessors(nSuccessor, "n"); + Node n2Successor = getSuccessor(nSuccessor, "n"); + verifyLeaf(n2Successor, "inn"); + } + + @Test + public final void testSubTrieIsEmpty() { + testPutWithNullKey(); + StringTrie subTrie = trie.subTrie("tea"); + assertTrue(subTrie.isEmpty()); + assertEquals(0, subTrie.size()); + assertNull(subTrie.getRootNode()); + } + @Test public final void testToString() { testPut3(); diff --git a/src/test/java/de/mrapp/tries/HashTrieTest.java b/src/test/java/de/mrapp/tries/HashTrieTest.java index f378fc5..c6ccf13 100644 --- a/src/test/java/de/mrapp/tries/HashTrieTest.java +++ b/src/test/java/de/mrapp/tries/HashTrieTest.java @@ -19,16 +19,15 @@ import java.util.HashMap; import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.Assert.*; /** * Tests the functionality of the class {@link HashTrie}. * * @author Michael Rapp */ -public class HashTrieTest extends - AbstractStringSequenceNonPatriciaTrieTest> { +public class HashTrieTest + extends AbstractStringSequenceNonPatriciaTrieTest> { @Override final HashTrie onCreateTrie() { @@ -48,6 +47,85 @@ public void testConstructorWithMapParameter() { assertEquals(value2, trie.get(new StringSequence(value2))); } + @Test + public final void testSubTrieWithEmptySequence() { + testPutWithNullKey(); + Trie subTrie = trie.subTrie(new StringSequence("")); + assertFalse(subTrie.isEmpty()); + assertEquals(8, subTrie.size()); + assertNull("A", subTrie.get(new StringSequence("A"))); + assertEquals("tea", subTrie.get(new StringSequence("B"))); + assertEquals("tea", subTrie.get(new StringSequence("tea"))); + assertEquals("ted", subTrie.get(new StringSequence("ted"))); + assertEquals("ten", subTrie.get(new StringSequence("ten"))); + assertEquals("to", subTrie.get(new StringSequence("to"))); + assertEquals("in", subTrie.get(new StringSequence("in"))); + assertEquals("inn", subTrie.get(new StringSequence("inn"))); + verifyRootNode(subTrie.getRootNode()); + verifySuccessors(subTrie.getRootNode(), "A", "B", "t", "i"); + Node ASuccessor = getSuccessor(subTrie.getRootNode(), "A"); + verifyLeaf(ASuccessor, null); + Node BSuccessor = getSuccessor(subTrie.getRootNode(), "B"); + verifyLeaf(BSuccessor, "tea"); + Node tSuccessor = getSuccessor(subTrie.getRootNode(), "t"); + verifySuccessors(tSuccessor, "e", "o"); + Node eSuccessor = getSuccessor(tSuccessor, "e"); + verifySuccessors(eSuccessor, "a", "d", "n"); + Node aSuccessor = getSuccessor(eSuccessor, "a"); + verifyLeaf(aSuccessor, "tea"); + Node dSuccessor = getSuccessor(eSuccessor, "d"); + verifyLeaf(dSuccessor, "ted"); + Node nSuccessor = getSuccessor(eSuccessor, "n"); + verifyLeaf(nSuccessor, "ten"); + Node oSuccessor = getSuccessor(tSuccessor, "o"); + verifyLeaf(oSuccessor, "to"); + Node iSuccessor = getSuccessor(subTrie.getRootNode(), "i"); + verifySuccessors(iSuccessor, "n"); + Node n2Successor = getSuccessor(iSuccessor, "n"); + verifySuccessors(n2Successor, "n"); + Node n3Successor = getSuccessor(n2Successor, "n"); + verifyLeaf(n3Successor, "inn"); + } + + @Test + public final void testSubTrieWithNullSequence() { + testPutWithNullKey(); + Trie subTrie = trie.subTrie(null); + assertFalse(subTrie.isEmpty()); + assertEquals(8, subTrie.size()); + assertNull("A", subTrie.get(new StringSequence("A"))); + assertEquals("tea", subTrie.get(new StringSequence("B"))); + assertEquals("tea", subTrie.get(new StringSequence("tea"))); + assertEquals("ted", subTrie.get(new StringSequence("ted"))); + assertEquals("ten", subTrie.get(new StringSequence("ten"))); + assertEquals("to", subTrie.get(new StringSequence("to"))); + assertEquals("in", subTrie.get(new StringSequence("in"))); + assertEquals("inn", subTrie.get(new StringSequence("inn"))); + verifyRootNode(subTrie.getRootNode()); + verifySuccessors(subTrie.getRootNode(), "A", "B", "t", "i"); + Node ASuccessor = getSuccessor(subTrie.getRootNode(), "A"); + verifyLeaf(ASuccessor, null); + Node BSuccessor = getSuccessor(subTrie.getRootNode(), "B"); + verifyLeaf(BSuccessor, "tea"); + Node tSuccessor = getSuccessor(subTrie.getRootNode(), "t"); + verifySuccessors(tSuccessor, "e", "o"); + Node eSuccessor = getSuccessor(tSuccessor, "e"); + verifySuccessors(eSuccessor, "a", "d", "n"); + Node aSuccessor = getSuccessor(eSuccessor, "a"); + verifyLeaf(aSuccessor, "tea"); + Node dSuccessor = getSuccessor(eSuccessor, "d"); + verifyLeaf(dSuccessor, "ted"); + Node nSuccessor = getSuccessor(eSuccessor, "n"); + verifyLeaf(nSuccessor, "ten"); + Node oSuccessor = getSuccessor(tSuccessor, "o"); + verifyLeaf(oSuccessor, "to"); + Node iSuccessor = getSuccessor(subTrie.getRootNode(), "i"); + verifySuccessors(iSuccessor, "n"); + Node n2Successor = getSuccessor(iSuccessor, "n"); + verifySuccessors(n2Successor, "n"); + Node n3Successor = getSuccessor(n2Successor, "n"); + verifyLeaf(n3Successor, "inn"); + } @Test public final void testSubTrie1() { @@ -91,6 +169,32 @@ public final void testSubTrie2() { verifyLeaf(leaf, "ten"); } + @Test + public final void testSubTrieIfSequenceCorrespondsToNode() { + testPutWithNullKey(); + Trie subTrie = trie.subTrie(new StringSequence("in")); + assertFalse(subTrie.isEmpty()); + assertEquals(1, subTrie.size()); + assertEquals("inn", subTrie.get(new StringSequence("inn"))); + verifyRootNode(subTrie.getRootNode()); + verifySuccessors(subTrie.getRootNode(), "i"); + Node iSuccessor = getSuccessor(subTrie.getRootNode(), "i"); + verifySuccessors(iSuccessor, "n"); + Node nSuccessor = getSuccessor(iSuccessor, "n"); + verifySuccessors(nSuccessor, "n"); + Node n2Successor = getSuccessor(nSuccessor, "n"); + verifyLeaf(n2Successor, "inn"); + } + + @Test + public final void testSubTrieIsEmpty() { + testPutWithNullKey(); + Trie subTrie = trie.subTrie(new StringSequence("tea")); + assertTrue(subTrie.isEmpty()); + assertEquals(0, subTrie.size()); + assertNull(subTrie.getRootNode()); + } + @Test public void testToString() { testPut3(); diff --git a/src/test/java/de/mrapp/tries/PatriciaStringTrieTest.java b/src/test/java/de/mrapp/tries/PatriciaStringTrieTest.java index 338fa90..d4e2ad2 100644 --- a/src/test/java/de/mrapp/tries/PatriciaStringTrieTest.java +++ b/src/test/java/de/mrapp/tries/PatriciaStringTrieTest.java @@ -21,8 +21,7 @@ import java.util.Map; import static junit.framework.TestCase.assertNotNull; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.Assert.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -31,8 +30,8 @@ * * @author Michael Rapp */ -public class PatriciaStringTrieTest extends - AbstractPatriciaTrieTest> { +public class PatriciaStringTrieTest + extends AbstractPatriciaTrieTest> { @Override final PatriciaStringTrie onCreateTrie() { @@ -92,7 +91,177 @@ public void testConstructorWithComparatorAndMapParameter() { assertNotNull(trie.comparator()); } - // TODO: Test subTrie method + @Test + public final void testSubTrieWithEmptySequence() { + testPutWithNullKey(); + SortedStringTrie subTrie = trie.subTrie(""); + assertFalse(subTrie.isEmpty()); + assertEquals(11, subTrie.size()); + assertNull("A", subTrie.get("A")); + assertEquals("romulus", subTrie.get("B")); + assertEquals("romane", subTrie.get("romane")); + assertEquals("romanus", subTrie.get("romanus")); + assertEquals("rom", subTrie.get("rom")); + assertEquals("romulus", subTrie.get("romulus")); + assertEquals("rubens", subTrie.get("rubens")); + assertEquals("ruber", subTrie.get("ruber")); + assertEquals("rubicon", subTrie.get("rubicon")); + assertEquals("rubicundus", subTrie.get("rubicundus")); + verifyRootNode(getRootNode(trie), "null"); + verifySuccessors(getRootNode(trie), "r", "A", "B"); + Node successor = getSuccessor(getRootNode(trie), "r"); + verifySuccessors(successor, "om", "ub"); + Node successorOm = getSuccessor(successor, "om"); + verifySuccessors(successorOm, "an", "ulus"); + Node successorAn = getSuccessor(successorOm, "an"); + verifySuccessors(successorAn, "e", "us"); + Node successorE = getSuccessor(successorAn, "e"); + verifyLeaf(successorE, "romane"); + Node successorUs = getSuccessor(successorAn, "us"); + verifyLeaf(successorUs, "romanus"); + Node successorUlus = getSuccessor(successorOm, "ulus"); + verifyLeaf(successorUlus, "romulus"); + Node successorUb = getSuccessor(successor, "ub"); + verifySuccessors(successorUb, "e", "ic"); + Node successorE2 = getSuccessor(successorUb, "e"); + verifySuccessors(successorE2, "ns", "r"); + Node successorNs = getSuccessor(successorE2, "ns"); + verifyLeaf(successorNs, "rubens"); + Node successorR = getSuccessor(successorE2, "r"); + verifyLeaf(successorR, "ruber"); + Node successorIc = getSuccessor(successorUb, "ic"); + verifySuccessors(successorIc, "on", "un"); + Node successorOn = getSuccessor(successorIc, "on"); + verifyLeaf(successorOn, "rubicon"); + Node successorUn = getSuccessor(successorIc, "un"); + verifySuccessors(successorUn, "dus"); + Node successorDus = getSuccessor(successorUn, "dus"); + verifyLeaf(successorDus, "rubicundus"); + Node successorA = getSuccessor(getRootNode(trie), "A"); + verifyLeaf(successorA, null); + Node successorB = getSuccessor(getRootNode(trie), "B"); + verifyLeaf(successorB, "romulus"); + } + + @Test + public final void testSubTrieWithNullSequence() { + testPutWithNullKey(); + SortedStringTrie subTrie = trie.subTrie(null); + assertFalse(subTrie.isEmpty()); + assertEquals(11, subTrie.size()); + assertNull("A", subTrie.get("A")); + assertEquals("romulus", subTrie.get("B")); + assertEquals("romane", subTrie.get("romane")); + assertEquals("romanus", subTrie.get("romanus")); + assertEquals("rom", subTrie.get("rom")); + assertEquals("romulus", subTrie.get("romulus")); + assertEquals("rubens", subTrie.get("rubens")); + assertEquals("ruber", subTrie.get("ruber")); + assertEquals("rubicon", subTrie.get("rubicon")); + assertEquals("rubicundus", subTrie.get("rubicundus")); + verifyRootNode(getRootNode(trie), "null"); + verifySuccessors(getRootNode(trie), "r", "A", "B"); + Node successor = getSuccessor(getRootNode(trie), "r"); + verifySuccessors(successor, "om", "ub"); + Node successorOm = getSuccessor(successor, "om"); + verifySuccessors(successorOm, "an", "ulus"); + Node successorAn = getSuccessor(successorOm, "an"); + verifySuccessors(successorAn, "e", "us"); + Node successorE = getSuccessor(successorAn, "e"); + verifyLeaf(successorE, "romane"); + Node successorUs = getSuccessor(successorAn, "us"); + verifyLeaf(successorUs, "romanus"); + Node successorUlus = getSuccessor(successorOm, "ulus"); + verifyLeaf(successorUlus, "romulus"); + Node successorUb = getSuccessor(successor, "ub"); + verifySuccessors(successorUb, "e", "ic"); + Node successorE2 = getSuccessor(successorUb, "e"); + verifySuccessors(successorE2, "ns", "r"); + Node successorNs = getSuccessor(successorE2, "ns"); + verifyLeaf(successorNs, "rubens"); + Node successorR = getSuccessor(successorE2, "r"); + verifyLeaf(successorR, "ruber"); + Node successorIc = getSuccessor(successorUb, "ic"); + verifySuccessors(successorIc, "on", "un"); + Node successorOn = getSuccessor(successorIc, "on"); + verifyLeaf(successorOn, "rubicon"); + Node successorUn = getSuccessor(successorIc, "un"); + verifySuccessors(successorUn, "dus"); + Node successorDus = getSuccessor(successorUn, "dus"); + verifyLeaf(successorDus, "rubicundus"); + Node successorA = getSuccessor(getRootNode(trie), "A"); + verifyLeaf(successorA, null); + Node successorB = getSuccessor(getRootNode(trie), "B"); + verifyLeaf(successorB, "romulus"); + } + + @Test + public final void testSubTrieIfSequenceCorrespondsToNode() { + testPutWithNullKey(); + SortedStringTrie subTrie = trie.subTrie("rom"); + assertFalse(subTrie.isEmpty()); + assertEquals(3, subTrie.size()); + assertEquals("romane", subTrie.get("romane")); + assertEquals("romanus", subTrie.get("romanus")); + assertEquals("romulus", subTrie.get("romulus")); + verifyRootNode(subTrie.getRootNode()); + verifySuccessors(subTrie.getRootNode(), "rom"); + Node romSuccessor = getSuccessor(subTrie.getRootNode(), "rom"); + verifySuccessors(romSuccessor, "an", "ulus"); + Node anSuccessor = getSuccessor(romSuccessor, "an"); + verifySuccessors(anSuccessor, "e", "us"); + Node leaf = getSuccessor(anSuccessor, "e"); + verifyLeaf(leaf, "romane"); + leaf = getSuccessor(anSuccessor, "us"); + verifyLeaf(leaf, "romanus"); + leaf = getSuccessor(romSuccessor, "ulus"); + verifyLeaf(leaf, "romulus"); + } + + @Test + public final void testSubTrie1() { + testPutWithNullKey(); + SortedStringTrie subTrie = trie.subTrie("roman"); + assertFalse(subTrie.isEmpty()); + assertEquals(2, subTrie.size()); + assertEquals("romane", subTrie.get("romane")); + assertEquals("romanus", subTrie.get("romanus")); + verifyRootNode(subTrie.getRootNode()); + verifySuccessors(subTrie.getRootNode(), "roman"); + Node romanSuccessor = getSuccessor(subTrie.getRootNode(), "roman"); + verifySuccessors(romanSuccessor, "e", "us"); + Node leaf = getSuccessor(romanSuccessor, "e"); + verifyLeaf(leaf, "romane"); + leaf = getSuccessor(romanSuccessor, "us"); + verifyLeaf(leaf, "romanus"); + } + + @Test + public final void testSubTrie2() { + testPutWithNullKey(); + SortedStringTrie subTrie = trie.subTrie("roma"); + assertFalse(subTrie.isEmpty()); + assertEquals(2, subTrie.size()); + assertEquals("romane", subTrie.get("romane")); + assertEquals("romanus", subTrie.get("romanus")); + verifyRootNode(subTrie.getRootNode()); + verifySuccessors(subTrie.getRootNode(), "roman"); + Node romanSuccessor = getSuccessor(subTrie.getRootNode(), "roman"); + verifySuccessors(romanSuccessor, "e", "us"); + Node leaf = getSuccessor(romanSuccessor, "e"); + verifyLeaf(leaf, "romane"); + leaf = getSuccessor(romanSuccessor, "us"); + verifyLeaf(leaf, "romanus"); + } + + @Test + public final void testSubTrieIsEmpty() { + testPutWithNullKey(); + SortedStringTrie subTrie = trie.subTrie("rubicundus"); + assertTrue(subTrie.isEmpty()); + assertEquals(0, subTrie.size()); + assertNull(subTrie.getRootNode()); + } @Test public final void testToString() { diff --git a/src/test/java/de/mrapp/tries/PatriciaTrieTest.java b/src/test/java/de/mrapp/tries/PatriciaTrieTest.java index ad32768..6df11ce 100644 --- a/src/test/java/de/mrapp/tries/PatriciaTrieTest.java +++ b/src/test/java/de/mrapp/tries/PatriciaTrieTest.java @@ -29,8 +29,8 @@ * * @author Michael Rapp */ -public class PatriciaTrieTest extends - AbstractPatriciaTrieTest> { +public class PatriciaTrieTest + extends AbstractPatriciaTrieTest> { @Override final PatriciaTrie onCreateTrie() { @@ -84,6 +84,182 @@ public void testConstructorWithComparatorAndMapParameter() { assertEquals(comparator, trie.comparator()); } - // TODO: test subTrie method + @Test + public final void testSubTrieWithEmptySequence() { + testPutWithNullKey(); + SortedTrie subTrie = trie.subTrie(new StringSequence("")); + assertFalse(subTrie.isEmpty()); + assertEquals(11, subTrie.size()); + assertNull("A", subTrie.get(new StringSequence("A"))); + assertEquals("romulus", subTrie.get(new StringSequence("B"))); + assertEquals("romane", subTrie.get(new StringSequence("romane"))); + assertEquals("romanus", subTrie.get(new StringSequence("romanus"))); + assertEquals("rom", subTrie.get(new StringSequence("rom"))); + assertEquals("romulus", subTrie.get(new StringSequence("romulus"))); + assertEquals("rubens", subTrie.get(new StringSequence("rubens"))); + assertEquals("ruber", subTrie.get(new StringSequence("ruber"))); + assertEquals("rubicon", subTrie.get(new StringSequence("rubicon"))); + assertEquals("rubicundus", subTrie.get(new StringSequence("rubicundus"))); + verifyRootNode(getRootNode(trie), "null"); + verifySuccessors(getRootNode(trie), "r", "A", "B"); + Node successor = getSuccessor(getRootNode(trie), "r"); + verifySuccessors(successor, "om", "ub"); + Node successorOm = getSuccessor(successor, "om"); + verifySuccessors(successorOm, "an", "ulus"); + Node successorAn = getSuccessor(successorOm, "an"); + verifySuccessors(successorAn, "e", "us"); + Node successorE = getSuccessor(successorAn, "e"); + verifyLeaf(successorE, "romane"); + Node successorUs = getSuccessor(successorAn, "us"); + verifyLeaf(successorUs, "romanus"); + Node successorUlus = getSuccessor(successorOm, "ulus"); + verifyLeaf(successorUlus, "romulus"); + Node successorUb = getSuccessor(successor, "ub"); + verifySuccessors(successorUb, "e", "ic"); + Node successorE2 = getSuccessor(successorUb, "e"); + verifySuccessors(successorE2, "ns", "r"); + Node successorNs = getSuccessor(successorE2, "ns"); + verifyLeaf(successorNs, "rubens"); + Node successorR = getSuccessor(successorE2, "r"); + verifyLeaf(successorR, "ruber"); + Node successorIc = getSuccessor(successorUb, "ic"); + verifySuccessors(successorIc, "on", "un"); + Node successorOn = getSuccessor(successorIc, "on"); + verifyLeaf(successorOn, "rubicon"); + Node successorUn = getSuccessor(successorIc, "un"); + verifySuccessors(successorUn, "dus"); + Node successorDus = getSuccessor(successorUn, "dus"); + verifyLeaf(successorDus, "rubicundus"); + Node successorA = getSuccessor(getRootNode(trie), "A"); + verifyLeaf(successorA, null); + Node successorB = getSuccessor(getRootNode(trie), "B"); + verifyLeaf(successorB, "romulus"); + } + + @Test + public final void testSubTrieWithNullSequence() { + testPutWithNullKey(); + SortedTrie subTrie = trie.subTrie(null); + assertFalse(subTrie.isEmpty()); + assertEquals(11, subTrie.size()); + assertNull("A", subTrie.get(new StringSequence("A"))); + assertEquals("romulus", subTrie.get(new StringSequence("B"))); + assertEquals("romane", subTrie.get(new StringSequence("romane"))); + assertEquals("romanus", subTrie.get(new StringSequence("romanus"))); + assertEquals("rom", subTrie.get(new StringSequence("rom"))); + assertEquals("romulus", subTrie.get(new StringSequence("romulus"))); + assertEquals("rubens", subTrie.get(new StringSequence("rubens"))); + assertEquals("ruber", subTrie.get(new StringSequence("ruber"))); + assertEquals("rubicon", subTrie.get(new StringSequence("rubicon"))); + assertEquals("rubicundus", subTrie.get(new StringSequence("rubicundus"))); + verifyRootNode(getRootNode(trie), "null"); + verifySuccessors(getRootNode(trie), "r", "A", "B"); + Node successor = getSuccessor(getRootNode(trie), "r"); + verifySuccessors(successor, "om", "ub"); + Node successorOm = getSuccessor(successor, "om"); + verifySuccessors(successorOm, "an", "ulus"); + Node successorAn = getSuccessor(successorOm, "an"); + verifySuccessors(successorAn, "e", "us"); + Node successorE = getSuccessor(successorAn, "e"); + verifyLeaf(successorE, "romane"); + Node successorUs = getSuccessor(successorAn, "us"); + verifyLeaf(successorUs, "romanus"); + Node successorUlus = getSuccessor(successorOm, "ulus"); + verifyLeaf(successorUlus, "romulus"); + Node successorUb = getSuccessor(successor, "ub"); + verifySuccessors(successorUb, "e", "ic"); + Node successorE2 = getSuccessor(successorUb, "e"); + verifySuccessors(successorE2, "ns", "r"); + Node successorNs = getSuccessor(successorE2, "ns"); + verifyLeaf(successorNs, "rubens"); + Node successorR = getSuccessor(successorE2, "r"); + verifyLeaf(successorR, "ruber"); + Node successorIc = getSuccessor(successorUb, "ic"); + verifySuccessors(successorIc, "on", "un"); + Node successorOn = getSuccessor(successorIc, "on"); + verifyLeaf(successorOn, "rubicon"); + Node successorUn = getSuccessor(successorIc, "un"); + verifySuccessors(successorUn, "dus"); + Node successorDus = getSuccessor(successorUn, "dus"); + verifyLeaf(successorDus, "rubicundus"); + Node successorA = getSuccessor(getRootNode(trie), "A"); + verifyLeaf(successorA, null); + Node successorB = getSuccessor(getRootNode(trie), "B"); + verifyLeaf(successorB, "romulus"); + } + + @Test + public final void testSubTrieIfSequenceCorrespondsToNode() { + testPutWithNullKey(); + SortedTrie subTrie = trie.subTrie(new StringSequence("rom")); + assertFalse(subTrie.isEmpty()); + assertEquals(3, subTrie.size()); + assertEquals("romane", subTrie.get(new StringSequence("romane"))); + assertEquals("romanus", subTrie.get(new StringSequence("romanus"))); + assertEquals("romulus", subTrie.get(new StringSequence("romulus"))); + verifyRootNode(subTrie.getRootNode()); + verifySuccessors(subTrie.getRootNode(), "rom"); + Node romSuccessor = getSuccessor(subTrie.getRootNode(), "rom"); + verifySuccessors(romSuccessor, "an", "ulus"); + Node anSuccessor = getSuccessor(romSuccessor, "an"); + verifySuccessors(anSuccessor, "e", "us"); + Node leaf = getSuccessor(anSuccessor, "e"); + verifyLeaf(leaf, "romane"); + leaf = getSuccessor(anSuccessor, "us"); + verifyLeaf(leaf, "romanus"); + leaf = getSuccessor(romSuccessor, "ulus"); + verifyLeaf(leaf, "romulus"); + } + + @Test + public final void testSubTrie1() { + testPutWithNullKey(); + SortedTrie subTrie = trie.subTrie(new StringSequence("roman")); + assertFalse(subTrie.isEmpty()); + assertEquals(2, subTrie.size()); + assertEquals("romane", subTrie.get(new StringSequence("romane"))); + assertEquals("romanus", subTrie.get(new StringSequence("romanus"))); + verifyRootNode(subTrie.getRootNode()); + verifySuccessors(subTrie.getRootNode(), "roman"); + Node romanSuccessor = getSuccessor(subTrie.getRootNode(), "roman"); + verifySuccessors(romanSuccessor, "e", "us"); + Node leaf = getSuccessor(romanSuccessor, "e"); + verifyLeaf(leaf, "romane"); + leaf = getSuccessor(romanSuccessor, "us"); + verifyLeaf(leaf, "romanus"); + } + + @Test + public final void testSubTrie2() { + testPutWithNullKey(); + SortedTrie subTrie = trie.subTrie(new StringSequence("roma")); + assertFalse(subTrie.isEmpty()); + assertEquals(2, subTrie.size()); + assertEquals("romane", subTrie.get(new StringSequence("romane"))); + assertEquals("romanus", subTrie.get(new StringSequence("romanus"))); + verifyRootNode(subTrie.getRootNode()); + verifySuccessors(subTrie.getRootNode(), "roman"); + Node romanSuccessor = getSuccessor(subTrie.getRootNode(), "roman"); + verifySuccessors(romanSuccessor, "e", "us"); + Node leaf = getSuccessor(romanSuccessor, "e"); + verifyLeaf(leaf, "romane"); + leaf = getSuccessor(romanSuccessor, "us"); + verifyLeaf(leaf, "romanus"); + } + + @Test + public final void testSubTrieIsEmpty() { + testPutWithNullKey(); + SortedTrie subTrie = trie.subTrie(new StringSequence("rubicundus")); + assertTrue(subTrie.isEmpty()); + assertEquals(0, subTrie.size()); + assertNull(subTrie.getRootNode()); + } + + @Test + public void testToString() { + testPut3(); + assertEquals("PatriciaTrie [rom=rom, romane=romane, romanus=romanus]", trie.toString()); + } } \ No newline at end of file diff --git a/src/test/java/de/mrapp/tries/SortedListStringTrieTest.java b/src/test/java/de/mrapp/tries/SortedListStringTrieTest.java index bb8aa28..eb3c473 100644 --- a/src/test/java/de/mrapp/tries/SortedListStringTrieTest.java +++ b/src/test/java/de/mrapp/tries/SortedListStringTrieTest.java @@ -80,6 +80,86 @@ public void testConstructorWithComparatorAndMapParameter() { assertNotNull(trie.comparator()); } + @Test + public final void testSubTrieWithEmptySequence() { + testPutWithNullKey(); + SortedStringTrie subTrie = trie.subTrie(""); + assertFalse(subTrie.isEmpty()); + assertEquals(8, subTrie.size()); + assertNull("A", subTrie.get("A")); + assertEquals("tea", subTrie.get("B")); + assertEquals("tea", subTrie.get("tea")); + assertEquals("ted", subTrie.get("ted")); + assertEquals("ten", subTrie.get("ten")); + assertEquals("to", subTrie.get("to")); + assertEquals("in", subTrie.get("in")); + assertEquals("inn", subTrie.get("inn")); + verifyRootNode(subTrie.getRootNode()); + verifySuccessors(subTrie.getRootNode(), "A", "B", "t", "i"); + Node ASuccessor = getSuccessor(subTrie.getRootNode(), "A"); + verifyLeaf(ASuccessor, null); + Node BSuccessor = getSuccessor(subTrie.getRootNode(), "B"); + verifyLeaf(BSuccessor, "tea"); + Node tSuccessor = getSuccessor(subTrie.getRootNode(), "t"); + verifySuccessors(tSuccessor, "e", "o"); + Node eSuccessor = getSuccessor(tSuccessor, "e"); + verifySuccessors(eSuccessor, "a", "d", "n"); + Node aSuccessor = getSuccessor(eSuccessor, "a"); + verifyLeaf(aSuccessor, "tea"); + Node dSuccessor = getSuccessor(eSuccessor, "d"); + verifyLeaf(dSuccessor, "ted"); + Node nSuccessor = getSuccessor(eSuccessor, "n"); + verifyLeaf(nSuccessor, "ten"); + Node oSuccessor = getSuccessor(tSuccessor, "o"); + verifyLeaf(oSuccessor, "to"); + Node iSuccessor = getSuccessor(subTrie.getRootNode(), "i"); + verifySuccessors(iSuccessor, "n"); + Node n2Successor = getSuccessor(iSuccessor, "n"); + verifySuccessors(n2Successor, "n"); + Node n3Successor = getSuccessor(n2Successor, "n"); + verifyLeaf(n3Successor, "inn"); + } + + @Test + public final void testSubTrieWithNullSequence() { + testPutWithNullKey(); + SortedStringTrie subTrie = trie.subTrie(null); + assertFalse(subTrie.isEmpty()); + assertEquals(8, subTrie.size()); + assertNull("A", subTrie.get("A")); + assertEquals("tea", subTrie.get("B")); + assertEquals("tea", subTrie.get("tea")); + assertEquals("ted", subTrie.get("ted")); + assertEquals("ten", subTrie.get("ten")); + assertEquals("to", subTrie.get("to")); + assertEquals("in", subTrie.get("in")); + assertEquals("inn", subTrie.get("inn")); + verifyRootNode(subTrie.getRootNode()); + verifySuccessors(subTrie.getRootNode(), "A", "B", "t", "i"); + Node ASuccessor = getSuccessor(subTrie.getRootNode(), "A"); + verifyLeaf(ASuccessor, null); + Node BSuccessor = getSuccessor(subTrie.getRootNode(), "B"); + verifyLeaf(BSuccessor, "tea"); + Node tSuccessor = getSuccessor(subTrie.getRootNode(), "t"); + verifySuccessors(tSuccessor, "e", "o"); + Node eSuccessor = getSuccessor(tSuccessor, "e"); + verifySuccessors(eSuccessor, "a", "d", "n"); + Node aSuccessor = getSuccessor(eSuccessor, "a"); + verifyLeaf(aSuccessor, "tea"); + Node dSuccessor = getSuccessor(eSuccessor, "d"); + verifyLeaf(dSuccessor, "ted"); + Node nSuccessor = getSuccessor(eSuccessor, "n"); + verifyLeaf(nSuccessor, "ten"); + Node oSuccessor = getSuccessor(tSuccessor, "o"); + verifyLeaf(oSuccessor, "to"); + Node iSuccessor = getSuccessor(subTrie.getRootNode(), "i"); + verifySuccessors(iSuccessor, "n"); + Node n2Successor = getSuccessor(iSuccessor, "n"); + verifySuccessors(n2Successor, "n"); + Node n3Successor = getSuccessor(n2Successor, "n"); + verifyLeaf(n3Successor, "inn"); + } + @Test public final void testSubTrie1() { testPutWithNullKey(); @@ -122,6 +202,32 @@ public final void testSubTrie2() { verifyLeaf(leaf, "ten"); } + @Test + public final void testSubTrieIfSequenceCorrespondsToNode() { + testPutWithNullKey(); + SortedStringTrie subTrie = trie.subTrie("in"); + assertFalse(subTrie.isEmpty()); + assertEquals(1, subTrie.size()); + assertEquals("inn", subTrie.get("inn")); + verifyRootNode(subTrie.getRootNode()); + verifySuccessors(subTrie.getRootNode(), "i"); + Node iSuccessor = getSuccessor(subTrie.getRootNode(), "i"); + verifySuccessors(iSuccessor, "n"); + Node nSuccessor = getSuccessor(iSuccessor, "n"); + verifySuccessors(nSuccessor, "n"); + Node n2Successor = getSuccessor(nSuccessor, "n"); + verifyLeaf(n2Successor, "inn"); + } + + @Test + public final void testSubTrieIsEmpty() { + testPutWithNullKey(); + SortedStringTrie subTrie = trie.subTrie("tea"); + assertTrue(subTrie.isEmpty()); + assertEquals(0, subTrie.size()); + assertNull(subTrie.getRootNode()); + } + @Test public final void testToString() { SortedListStringTrie trie = new SortedListStringTrie<>(); diff --git a/src/test/java/de/mrapp/tries/SortedListTrieTest.java b/src/test/java/de/mrapp/tries/SortedListTrieTest.java index c472506..62b9dc3 100644 --- a/src/test/java/de/mrapp/tries/SortedListTrieTest.java +++ b/src/test/java/de/mrapp/tries/SortedListTrieTest.java @@ -20,8 +20,7 @@ import java.util.HashMap; import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.Assert.*; import static org.mockito.Mockito.mock; /** @@ -73,6 +72,86 @@ public void testConstructorWithComparatorAndMapParameter() { assertEquals(comparator, trie.comparator()); } + @Test + public final void testSubTrieWithEmptySequence() { + testPutWithNullKey(); + SortedTrie subTrie = trie.subTrie(new StringSequence("")); + assertFalse(subTrie.isEmpty()); + assertEquals(8, subTrie.size()); + assertNull("A", subTrie.get(new StringSequence("A"))); + assertEquals("tea", subTrie.get(new StringSequence("B"))); + assertEquals("tea", subTrie.get(new StringSequence("tea"))); + assertEquals("ted", subTrie.get(new StringSequence("ted"))); + assertEquals("ten", subTrie.get(new StringSequence("ten"))); + assertEquals("to", subTrie.get(new StringSequence("to"))); + assertEquals("in", subTrie.get(new StringSequence("in"))); + assertEquals("inn", subTrie.get(new StringSequence("inn"))); + verifyRootNode(subTrie.getRootNode()); + verifySuccessors(subTrie.getRootNode(), "A", "B", "t", "i"); + Node ASuccessor = getSuccessor(subTrie.getRootNode(), "A"); + verifyLeaf(ASuccessor, null); + Node BSuccessor = getSuccessor(subTrie.getRootNode(), "B"); + verifyLeaf(BSuccessor, "tea"); + Node tSuccessor = getSuccessor(subTrie.getRootNode(), "t"); + verifySuccessors(tSuccessor, "e", "o"); + Node eSuccessor = getSuccessor(tSuccessor, "e"); + verifySuccessors(eSuccessor, "a", "d", "n"); + Node aSuccessor = getSuccessor(eSuccessor, "a"); + verifyLeaf(aSuccessor, "tea"); + Node dSuccessor = getSuccessor(eSuccessor, "d"); + verifyLeaf(dSuccessor, "ted"); + Node nSuccessor = getSuccessor(eSuccessor, "n"); + verifyLeaf(nSuccessor, "ten"); + Node oSuccessor = getSuccessor(tSuccessor, "o"); + verifyLeaf(oSuccessor, "to"); + Node iSuccessor = getSuccessor(subTrie.getRootNode(), "i"); + verifySuccessors(iSuccessor, "n"); + Node n2Successor = getSuccessor(iSuccessor, "n"); + verifySuccessors(n2Successor, "n"); + Node n3Successor = getSuccessor(n2Successor, "n"); + verifyLeaf(n3Successor, "inn"); + } + + @Test + public final void testSubTrieWithNullSequence() { + testPutWithNullKey(); + SortedTrie subTrie = trie.subTrie(null); + assertFalse(subTrie.isEmpty()); + assertEquals(8, subTrie.size()); + assertNull("A", subTrie.get(new StringSequence("A"))); + assertEquals("tea", subTrie.get(new StringSequence("B"))); + assertEquals("tea", subTrie.get(new StringSequence("tea"))); + assertEquals("ted", subTrie.get(new StringSequence("ted"))); + assertEquals("ten", subTrie.get(new StringSequence("ten"))); + assertEquals("to", subTrie.get(new StringSequence("to"))); + assertEquals("in", subTrie.get(new StringSequence("in"))); + assertEquals("inn", subTrie.get(new StringSequence("inn"))); + verifyRootNode(subTrie.getRootNode()); + verifySuccessors(subTrie.getRootNode(), "A", "B", "t", "i"); + Node ASuccessor = getSuccessor(subTrie.getRootNode(), "A"); + verifyLeaf(ASuccessor, null); + Node BSuccessor = getSuccessor(subTrie.getRootNode(), "B"); + verifyLeaf(BSuccessor, "tea"); + Node tSuccessor = getSuccessor(subTrie.getRootNode(), "t"); + verifySuccessors(tSuccessor, "e", "o"); + Node eSuccessor = getSuccessor(tSuccessor, "e"); + verifySuccessors(eSuccessor, "a", "d", "n"); + Node aSuccessor = getSuccessor(eSuccessor, "a"); + verifyLeaf(aSuccessor, "tea"); + Node dSuccessor = getSuccessor(eSuccessor, "d"); + verifyLeaf(dSuccessor, "ted"); + Node nSuccessor = getSuccessor(eSuccessor, "n"); + verifyLeaf(nSuccessor, "ten"); + Node oSuccessor = getSuccessor(tSuccessor, "o"); + verifyLeaf(oSuccessor, "to"); + Node iSuccessor = getSuccessor(subTrie.getRootNode(), "i"); + verifySuccessors(iSuccessor, "n"); + Node n2Successor = getSuccessor(iSuccessor, "n"); + verifySuccessors(n2Successor, "n"); + Node n3Successor = getSuccessor(n2Successor, "n"); + verifyLeaf(n3Successor, "inn"); + } + @Test public final void testSubTrie1() { testPutWithNullKey(); @@ -115,6 +194,32 @@ public final void testSubTrie2() { verifyLeaf(leaf, "ten"); } + @Test + public final void testSubTrieIfSequenceCorrespondsToNode() { + testPutWithNullKey(); + SortedTrie subTrie = trie.subTrie(new StringSequence("in")); + assertFalse(subTrie.isEmpty()); + assertEquals(1, subTrie.size()); + assertEquals("inn", subTrie.get(new StringSequence("inn"))); + verifyRootNode(subTrie.getRootNode()); + verifySuccessors(subTrie.getRootNode(), "i"); + Node iSuccessor = getSuccessor(subTrie.getRootNode(), "i"); + verifySuccessors(iSuccessor, "n"); + Node nSuccessor = getSuccessor(iSuccessor, "n"); + verifySuccessors(nSuccessor, "n"); + Node n2Successor = getSuccessor(nSuccessor, "n"); + verifyLeaf(n2Successor, "inn"); + } + + @Test + public final void testSubTrieIsEmpty() { + testPutWithNullKey(); + SortedTrie subTrie = trie.subTrie(new StringSequence("tea")); + assertTrue(subTrie.isEmpty()); + assertEquals(0, subTrie.size()); + assertNull(subTrie.getRootNode()); + } + @Test public void testToString() { testPut3(); diff --git a/src/test/java/de/mrapp/tries/datastructure/SingletonSortedTrieTest.java b/src/test/java/de/mrapp/tries/datastructure/SingletonSortedTrieTest.java index 58422f1..0dfaf37 100644 --- a/src/test/java/de/mrapp/tries/datastructure/SingletonSortedTrieTest.java +++ b/src/test/java/de/mrapp/tries/datastructure/SingletonSortedTrieTest.java @@ -16,6 +16,7 @@ import de.mrapp.tries.Node; import de.mrapp.tries.SortedTrie; import de.mrapp.tries.Trie; +import de.mrapp.tries.datastructure.node.UnmodifiableNode; import de.mrapp.tries.sequence.StringSequence; import org.junit.Test; diff --git a/src/test/java/de/mrapp/tries/datastructure/SingletonTrieTest.java b/src/test/java/de/mrapp/tries/datastructure/SingletonTrieTest.java index 493737f..ba61771 100644 --- a/src/test/java/de/mrapp/tries/datastructure/SingletonTrieTest.java +++ b/src/test/java/de/mrapp/tries/datastructure/SingletonTrieTest.java @@ -15,6 +15,7 @@ import de.mrapp.tries.Node; import de.mrapp.tries.Trie; +import de.mrapp.tries.datastructure.node.UnmodifiableNode; import de.mrapp.tries.sequence.StringSequence; import org.junit.Test; diff --git a/src/test/java/de/mrapp/tries/datastructure/StringNodeWrapperTest.java b/src/test/java/de/mrapp/tries/datastructure/StringNodeWrapperTest.java index 48152cb..9ab7adc 100644 --- a/src/test/java/de/mrapp/tries/datastructure/StringNodeWrapperTest.java +++ b/src/test/java/de/mrapp/tries/datastructure/StringNodeWrapperTest.java @@ -15,6 +15,8 @@ import de.mrapp.tries.Node; import de.mrapp.tries.NodeValue; +import de.mrapp.tries.datastructure.node.HashNode; +import de.mrapp.tries.datastructure.node.UnmodifiableNode; import de.mrapp.tries.sequence.StringSequence; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/src/test/java/de/mrapp/tries/datastructure/HashNodeTest.java b/src/test/java/de/mrapp/tries/datastructure/node/HashNodeTest.java similarity index 96% rename from src/test/java/de/mrapp/tries/datastructure/HashNodeTest.java rename to src/test/java/de/mrapp/tries/datastructure/node/HashNodeTest.java index b6fe5ed..b491e8f 100644 --- a/src/test/java/de/mrapp/tries/datastructure/HashNodeTest.java +++ b/src/test/java/de/mrapp/tries/datastructure/node/HashNodeTest.java @@ -11,10 +11,11 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package de.mrapp.tries.datastructure; +package de.mrapp.tries.datastructure.node; import de.mrapp.tries.Node; import de.mrapp.tries.NodeValue; +import de.mrapp.tries.datastructure.node.HashNode; import de.mrapp.tries.sequence.StringSequence; import org.junit.Test; @@ -168,6 +169,12 @@ public final void testIndexOf() { node.indexOf(new StringSequence("c")); } + @Test(expected = UnsupportedOperationException.class) + public final void testIndexOfFirstElement() { + HashNode node = new HashNode<>(); + node.indexOfFirstElement(new StringSequence("c")); + } + @Test(expected = UnsupportedOperationException.class) public final void testRemoveSuccessorByIndex() { HashNode node = new HashNode<>(); diff --git a/src/test/java/de/mrapp/tries/datastructure/SortedListNodeTest.java b/src/test/java/de/mrapp/tries/datastructure/node/SortedListNodeTest.java similarity index 94% rename from src/test/java/de/mrapp/tries/datastructure/SortedListNodeTest.java rename to src/test/java/de/mrapp/tries/datastructure/node/SortedListNodeTest.java index 664558f..4ab5e13 100644 --- a/src/test/java/de/mrapp/tries/datastructure/SortedListNodeTest.java +++ b/src/test/java/de/mrapp/tries/datastructure/node/SortedListNodeTest.java @@ -11,7 +11,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package de.mrapp.tries.datastructure; +package de.mrapp.tries.datastructure.node; import de.mrapp.tries.Node; import de.mrapp.tries.NodeValue; @@ -207,6 +207,7 @@ public final void testIndexOf() { SortedListNode node = new SortedListNode<>(null); node.addSuccessor(new StringSequence("a")); node.addSuccessor(new StringSequence("b")); + assertEquals(-1, node.indexOf(new StringSequence("c"))); node.addSuccessor(new StringSequence("c")); node.addSuccessor(new StringSequence("d")); node.addSuccessor(new StringSequence("e")); @@ -214,6 +215,19 @@ public final void testIndexOf() { assertEquals(2, node.indexOf(new StringSequence("c"))); } + @Test + public final void testIndexOfFirstElement() { + SortedListNode node = new SortedListNode<>(null); + node.addSuccessor(new StringSequence("axx")); + node.addSuccessor(new StringSequence("bxx")); + assertEquals(-1, node.indexOfFirstElement(new StringSequence("cyy"))); + node.addSuccessor(new StringSequence("cxx")); + node.addSuccessor(new StringSequence("dxx")); + node.addSuccessor(new StringSequence("exx")); + node.addSuccessor(new StringSequence("fxx")); + assertEquals(2, node.indexOfFirstElement(new StringSequence("cyy"))); + } + @Test public final void testRemoveSuccessorByIndex() { SortedListNode node = new SortedListNode<>(null); diff --git a/src/test/java/de/mrapp/tries/datastructure/UnmodifiableNodeTest.java b/src/test/java/de/mrapp/tries/datastructure/node/UnmodifiableNodeTest.java similarity index 98% rename from src/test/java/de/mrapp/tries/datastructure/UnmodifiableNodeTest.java rename to src/test/java/de/mrapp/tries/datastructure/node/UnmodifiableNodeTest.java index d554eb8..1d89734 100644 --- a/src/test/java/de/mrapp/tries/datastructure/UnmodifiableNodeTest.java +++ b/src/test/java/de/mrapp/tries/datastructure/node/UnmodifiableNodeTest.java @@ -11,10 +11,11 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package de.mrapp.tries.datastructure; +package de.mrapp.tries.datastructure.node; import de.mrapp.tries.Node; import de.mrapp.tries.NodeValue; +import de.mrapp.tries.datastructure.node.UnmodifiableNode; import de.mrapp.tries.sequence.StringSequence; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/src/test/java/de/mrapp/tries/util/EntryUtilTest.java b/src/test/java/de/mrapp/tries/util/EntryUtilTest.java index 1951bd2..05ccd64 100644 --- a/src/test/java/de/mrapp/tries/util/EntryUtilTest.java +++ b/src/test/java/de/mrapp/tries/util/EntryUtilTest.java @@ -15,7 +15,7 @@ import de.mrapp.tries.Node; import de.mrapp.tries.NodeValue; -import de.mrapp.tries.datastructure.HashNode; +import de.mrapp.tries.datastructure.node.HashNode; import de.mrapp.tries.sequence.StringSequence; import org.junit.Test;