Class BKDUtil


  • final class BKDUtil
    extends java.lang.Object
    Utility functions to build BKD trees.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  BKDUtil.ByteArrayPredicate
      Predicate for a fixed number of bytes.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private BKDUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int commonPrefixLength4​(byte[] a, int aOffset, byte[] b, int bOffset)
      Return the length of the common prefix across the next 4 bytes of both provided arrays.
      static int commonPrefixLength8​(byte[] a, int aOffset, byte[] b, int bOffset)
      Return the length of the common prefix across the next 8 bytes of both provided arrays.
      (package private) static int commonPrefixLengthN​(byte[] a, int aOffset, byte[] b, int bOffset, int numBytes)  
      static boolean equals4​(byte[] a, int aOffset, byte[] b, int bOffset)
      Check whether the next 4 bytes are exactly the same in the provided arrays.
      static boolean equals8​(byte[] a, int aOffset, byte[] b, int bOffset)
      Check whether the next 8 bytes are exactly the same in the provided arrays.
      static BKDUtil.ByteArrayPredicate getEqualsPredicate​(int numBytes)
      Return a predicate that tells whether the next numBytes bytes are equal.
      static ArrayUtil.ByteArrayComparator getPrefixLengthComparator​(int numBytes)
      Return a comparator that computes the common prefix length across the next numBytes of the provided arrays.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BKDUtil

        private BKDUtil()
    • Method Detail

      • getPrefixLengthComparator

        public static ArrayUtil.ByteArrayComparator getPrefixLengthComparator​(int numBytes)
        Return a comparator that computes the common prefix length across the next numBytes of the provided arrays.
      • commonPrefixLength8

        public static int commonPrefixLength8​(byte[] a,
                                              int aOffset,
                                              byte[] b,
                                              int bOffset)
        Return the length of the common prefix across the next 8 bytes of both provided arrays.
      • commonPrefixLength4

        public static int commonPrefixLength4​(byte[] a,
                                              int aOffset,
                                              byte[] b,
                                              int bOffset)
        Return the length of the common prefix across the next 4 bytes of both provided arrays.
      • commonPrefixLengthN

        static int commonPrefixLengthN​(byte[] a,
                                       int aOffset,
                                       byte[] b,
                                       int bOffset,
                                       int numBytes)
      • getEqualsPredicate

        public static BKDUtil.ByteArrayPredicate getEqualsPredicate​(int numBytes)
        Return a predicate that tells whether the next numBytes bytes are equal.
      • equals8

        public static boolean equals8​(byte[] a,
                                      int aOffset,
                                      byte[] b,
                                      int bOffset)
        Check whether the next 8 bytes are exactly the same in the provided arrays.
      • equals4

        public static boolean equals4​(byte[] a,
                                      int aOffset,
                                      byte[] b,
                                      int bOffset)
        Check whether the next 4 bytes are exactly the same in the provided arrays.