public final class Util
extends java.lang.Object
| 限定符和类型 | 字段和说明 |
|---|---|
static boolean |
USE_HYBRID_BINSEARCH
optimization flag: whether to use hybrid binary search: hybrid formats
combine a binary search with a sequential search
|
| 限定符和类型 | 方法和说明 |
|---|---|
static Container[] |
addOffset(Container source,
char offsets)
Add value "offset" to all values in the container, producing
two new containers.
|
static int |
advanceUntil(char[] array,
int pos,
int length,
char min)
Find the smallest integer larger than pos such that array[pos]>= min.
|
protected static int |
branchyUnsignedBinarySearch(char[] array,
int begin,
int end,
char k) |
static int |
cardinalityInBitmapRange(long[] bitmap,
int start,
int end)
Hamming weight of the bitset in the range
start, start+1,..., end-1
|
static int |
cardinalityInBitmapWordRange(long[] bitmap,
int start,
int end)
已过时。
|
static void |
fillArrayAND(char[] container,
long[] bitmap1,
long[] bitmap2)
Compute the bitwise AND between two long arrays and write the set bits in the container.
|
static void |
fillArrayANDNOT(char[] container,
long[] bitmap1,
long[] bitmap2)
Compute the bitwise ANDNOT between two long arrays and write the set bits in the container.
|
static void |
fillArrayXOR(char[] container,
long[] bitmap1,
long[] bitmap2)
Compute the bitwise XOR between two long arrays and write the set bits in the container.
|
static void |
flipBitmapRange(long[] bitmap,
int start,
int end)
flip bits at start, start+1,..., end-1
|
static int |
flipBitmapRangeAndCardinalityChange(long[] bitmap,
int start,
int end)
已过时。
|
protected static char |
highbits(int x) |
protected static char |
highbits(long x) |
protected static int |
hybridUnsignedBinarySearch(char[] array,
int begin,
int end,
char k) |
static int |
intersectArrayIntoBitmap(long[] bitmap,
char[] array,
int length)
Intersects the bitmap with the array, returning the cardinality of the result
|
static int |
iterateUntil(char[] array,
int pos,
int length,
int min)
Find the smallest integer larger than pos such that array[pos]>= min.
|
protected static char |
lowbits(int x) |
protected static char |
lowbits(long x) |
protected static int |
lowbitsAsInteger(int x) |
protected static int |
lowbitsAsInteger(long x) |
static int |
maxLowBitAsInteger() |
static void |
partialRadixSort(int[] data)
Sorts the data by the 16 bit prefix using Radix sort.
|
static void |
resetBitmapRange(long[] bitmap,
int start,
int end)
clear bits at start, start+1,..., end-1
|
static int |
resetBitmapRangeAndCardinalityChange(long[] bitmap,
int start,
int end)
已过时。
|
static int |
reverseUntil(char[] array,
int pos,
int length,
char max)
Find the largest integer smaller than pos such that array[pos]<= max.
|
static int |
select(long w,
int j)
Given a word w, return the position of the jth true bit.
|
static void |
setBitmapRange(long[] bitmap,
int start,
int end)
set bits at start, start+1,..., end-1
|
static int |
setBitmapRangeAndCardinalityChange(long[] bitmap,
int start,
int end)
已过时。
|
static long |
toUnsignedLong(int x)
Converts the argument to a
long by an unsigned conversion. |
static int |
unsignedBinarySearch(char[] array,
int begin,
int end,
char k)
Look for value k in array in the range [begin,end).
|
static int |
unsignedDifference(char[] set1,
int length1,
char[] set2,
int length2,
char[] buffer)
Compute the difference between two sorted lists and write the result to the provided output
array
|
static int |
unsignedDifference(CharIterator set1,
CharIterator set2,
char[] buffer)
Compute the difference between two sorted lists and write the result to the provided output
array
|
static int |
unsignedExclusiveUnion2by2(char[] set1,
int length1,
char[] set2,
int length2,
char[] buffer)
Compute the exclusive union of two sorted lists and write the result to the provided output
array
|
static int |
unsignedIntersect2by2(char[] set1,
int length1,
char[] set2,
int length2,
char[] buffer)
Intersect two sorted lists and write the result to the provided output array
|
static boolean |
unsignedIntersects(char[] set1,
int length1,
char[] set2,
int length2)
Checks if two arrays intersect
|
protected static int |
unsignedLocalIntersect2by2(char[] set1,
int length1,
char[] set2,
int length2,
char[] buffer) |
static int |
unsignedLocalIntersect2by2Cardinality(char[] set1,
int length1,
char[] set2,
int length2)
Compute the cardinality of the intersection
|
protected static int |
unsignedOneSidedGallopingIntersect2by2(char[] smallSet,
int smallLength,
char[] largeSet,
int largeLength,
char[] buffer) |
static int |
unsignedUnion2by2(char[] set1,
int offset1,
int length1,
char[] set2,
int offset2,
int length2,
char[] buffer)
Unite two sorted lists and write the result to the provided output array
|
public static final boolean USE_HYBRID_BINSEARCH
public static Container[] addOffset(Container source, char offsets)
source - source containeroffsets - value to add to each value in the containerpublic static int advanceUntil(char[] array,
int pos,
int length,
char min)
array - array to search withinpos - starting position of the searchlength - length of the array to searchmin - minimum valuepublic static int reverseUntil(char[] array,
int pos,
int length,
char max)
array - array to search withinpos - starting position of the searchlength - length of the array to searchmax - maximum valuepublic static int iterateUntil(char[] array,
int pos,
int length,
int min)
array - array to search withinpos - starting position of the searchlength - length of the array to searchmin - minimum valueprotected static int branchyUnsignedBinarySearch(char[] array,
int begin,
int end,
char k)
public static void fillArrayAND(char[] container,
long[] bitmap1,
long[] bitmap2)
container - where we writebitmap1 - first bitmapbitmap2 - second bitmappublic static void fillArrayANDNOT(char[] container,
long[] bitmap1,
long[] bitmap2)
container - where we writebitmap1 - first bitmapbitmap2 - second bitmappublic static void fillArrayXOR(char[] container,
long[] bitmap1,
long[] bitmap2)
container - where we writebitmap1 - first bitmapbitmap2 - second bitmappublic static void flipBitmapRange(long[] bitmap,
int start,
int end)
bitmap - array of words to be modifiedstart - first index to be modified (inclusive)end - last index to be modified (exclusive)@Deprecated
public static int cardinalityInBitmapWordRange(long[] bitmap,
int start,
int end)
bitmap - array of words representing a bitsetstart - first index (inclusive)end - last index (exclusive)public static int cardinalityInBitmapRange(long[] bitmap,
int start,
int end)
bitmap - array of words representing a bitsetstart - first index (inclusive)end - last index (exclusive)protected static char highbits(int x)
protected static char highbits(long x)
protected static int hybridUnsignedBinarySearch(char[] array,
int begin,
int end,
char k)
protected static char lowbits(int x)
protected static char lowbits(long x)
protected static int lowbitsAsInteger(int x)
protected static int lowbitsAsInteger(long x)
public static int maxLowBitAsInteger()
public static void resetBitmapRange(long[] bitmap,
int start,
int end)
bitmap - array of words to be modifiedstart - first index to be modified (inclusive)end - last index to be modified (exclusive)public static int intersectArrayIntoBitmap(long[] bitmap,
char[] array,
int length)
bitmap - the bitmap, modifiedarray - the array, not modifiedlength - how much of the array to consumepublic static int select(long w,
int j)
w - wordj - indexpublic static void setBitmapRange(long[] bitmap,
int start,
int end)
bitmap - array of words to be modifiedstart - first index to be modified (inclusive)end - last index to be modified (exclusive)@Deprecated
public static int setBitmapRangeAndCardinalityChange(long[] bitmap,
int start,
int end)
bitmap - array of words to be modifiedstart - first index to be modified (inclusive)end - last index to be modified (exclusive)@Deprecated
public static int flipBitmapRangeAndCardinalityChange(long[] bitmap,
int start,
int end)
bitmap - array of words to be modifiedstart - first index to be modified (inclusive)end - last index to be modified (exclusive)@Deprecated
public static int resetBitmapRangeAndCardinalityChange(long[] bitmap,
int start,
int end)
bitmap - array of words to be modifiedstart - first index to be modified (inclusive)end - last index to be modified (exclusive)public static int unsignedBinarySearch(char[] array,
int begin,
int end,
char k)
array - array where we searchbegin - first index (inclusive)end - last index (exclusive)k - value we search forpublic static int unsignedDifference(char[] set1,
int length1,
char[] set2,
int length2,
char[] buffer)
set1 - first arraylength1 - length of first arrayset2 - second arraylength2 - length of second arraybuffer - output arraypublic static int unsignedDifference(CharIterator set1, CharIterator set2, char[] buffer)
set1 - first arrayset2 - second arraybuffer - output arraypublic static int unsignedExclusiveUnion2by2(char[] set1,
int length1,
char[] set2,
int length2,
char[] buffer)
set1 - first arraylength1 - length of first arrayset2 - second arraylength2 - length of second arraybuffer - output arraypublic static int unsignedIntersect2by2(char[] set1,
int length1,
char[] set2,
int length2,
char[] buffer)
set1 - first arraylength1 - length of first arrayset2 - second arraylength2 - length of second arraybuffer - output arraypublic static boolean unsignedIntersects(char[] set1,
int length1,
char[] set2,
int length2)
set1 - first arraylength1 - length of first arrayset2 - second arraylength2 - length of second arrayprotected static int unsignedLocalIntersect2by2(char[] set1,
int length1,
char[] set2,
int length2,
char[] buffer)
public static int unsignedLocalIntersect2by2Cardinality(char[] set1,
int length1,
char[] set2,
int length2)
set1 - first setlength1 - how many values to consider in the first setset2 - second setlength2 - how many values to consider in the second setprotected static int unsignedOneSidedGallopingIntersect2by2(char[] smallSet,
int smallLength,
char[] largeSet,
int largeLength,
char[] buffer)
public static int unsignedUnion2by2(char[] set1,
int offset1,
int length1,
char[] set2,
int offset2,
int length2,
char[] buffer)
set1 - first arrayoffset1 - offset of first arraylength1 - length of first arrayset2 - second arrayoffset2 - offset of second arraylength2 - length of second arraybuffer - output arraypublic static long toUnsignedLong(int x)
long by an unsigned conversion. In an unsigned conversion to
a long, the high-order 32 bits of the long are zero and the low-order 32 bits
are equal to the bits of the integer argument.
Consequently, zero and positive int values are mapped to a numerically equal
long value and negative int values are mapped to a long value equal to the input plus 232.x - the value to convert to an unsigned longlong by an unsigned conversionpublic static void partialRadixSort(int[] data)
data - - the data (sorted in place)