Class CritBit<V>

    • Method Detail

      • create1D

        public static <V> CritBit1D<V> create1D​(int width)
        Create a 1D crit-bit tree with arbitrary key length.
        Type Parameters:
        V - value type
        Parameters:
        width - The number of bits per value
        Returns:
        a 1D crit-bit tree
      • createKD

        public static <V> CritBitKD<V> createKD​(int width,
                                                int dim)
        Create a kD crit-bit tree with maximum 64bit key length.
        Type Parameters:
        V - value type
        Parameters:
        width - The number of bits per value
        dim - The number of dimensions
        Returns:
        k-dimensional tree
      • put

        public V put​(long[] key,
                     V val)
        Add a key value pair to the tree or replace the value if the key already exists.
        Specified by:
        put in interface CritBit1D<V>
        Parameters:
        key - key
        val - value
        Returns:
        The previous value or null if there was no previous value
        See Also:
        put(long[], Object)
      • checkTree

        public boolean checkTree()
      • readInfix

        protected static <T> void readInfix​(org.tinspin.index.critbit.CritBit.Node<T> n,
                                            long[] currentPrefix)
        Type Parameters:
        T - value type
        Parameters:
        n - node
        currentPrefix - prefix
      • size

        public int size()
        Get the size of the tree.
        Specified by:
        size in interface CritBit1D<V>
        Specified by:
        size in interface CritBitKD<V>
        Returns:
        the number of keys in the tree
        See Also:
        size()
      • contains

        public boolean contains​(long[] key)
        Check whether a given key exists in the tree.
        Specified by:
        contains in interface CritBit1D<V>
        Parameters:
        key - key
        Returns:
        true if the key exists otherwise false
        See Also:
        contains(long[])
      • get

        public V get​(long[] key)
        Get the value for a given key.
        Specified by:
        get in interface CritBit1D<V>
        Parameters:
        key - key
        Returns:
        the values associated with key or null if the key does not exist.
        See Also:
        get(long[])
      • remove

        public V remove​(long[] key)
        Remove a key and its value
        Specified by:
        remove in interface CritBit1D<V>
        Parameters:
        key - key
        Returns:
        The value of the key of null if the value was not found.
        See Also:
        remove(long[])
      • query

        public CritBit.QueryIterator<V> query​(long[] min,
                                              long[] max)
        Specified by:
        query in interface CritBit1D<V>
        Parameters:
        min - Lower left corner of the query window
        max - Upper right corner of the query window
        Returns:
        Iterator over query result
        See Also:
        query(long[], long[])
      • putKD

        public V putKD​(long[] key,
                       V val)
        Add a key value pair to the tree or replace the value if the key already exists.
        Specified by:
        putKD in interface CritBitKD<V>
        Parameters:
        key - key
        val - value
        Returns:
        The previous value or null if there was no previous value
        See Also:
        putKD(long[], Object)
      • containsKD

        public boolean containsKD​(long[] key)
        Check whether a given key exists in the tree.
        Specified by:
        containsKD in interface CritBitKD<V>
        Parameters:
        key - key
        Returns:
        true if the key exists otherwise false
        See Also:
        containsKD(long[])
      • getKD

        public V getKD​(long[] key)
        Get the value for a given key.
        Specified by:
        getKD in interface CritBitKD<V>
        Parameters:
        key - key
        Returns:
        the values associated with key or null if the key does not exist.
        See Also:
        getKD(long[])
      • removeKD

        public V removeKD​(long[] key)
        Remove a key and its value
        Specified by:
        removeKD in interface CritBitKD<V>
        Parameters:
        key - key
        Returns:
        The value of the key of null if the value was not found.
        See Also:
        removeKD(long[])