public final class Util extends Object
| Modifier and Type | Field and Description |
|---|---|
static boolean |
USE_HYBRID_BINSEARCH |
| Modifier and Type | Method and Description |
|---|---|
static int |
advanceUntil(short[] array,
int pos,
int length,
short min)
Find the smallest integer larger than pos such that array[pos]>= min.
|
protected static int |
branchyUnsignedBinarySearch(short[] array,
int begin,
int end,
short k) |
static int |
compareUnsigned(short a,
short b)
Compares the two specified
short values, treating them as unsigned values between
0 and 2^16 - 1 inclusive. |
static void |
fillArrayAND(short[] container,
long[] bitmap1,
long[] bitmap2)
Compute the bitwise AND between two long arrays and write
the set bits in the container.
|
static void |
fillArrayANDNOT(short[] container,
long[] bitmap1,
long[] bitmap2)
Compute the bitwise ANDNOT between two long arrays and write
the set bits in the container.
|
static void |
fillArrayXOR(short[] 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
|
protected static short |
highbits(int x) |
protected static int |
hybridUnsignedBinarySearch(short[] array,
int begin,
int end,
short k) |
protected static short |
lowbits(int x) |
protected static short |
maxLowBit() |
protected static int |
maxLowBitAsInteger() |
static void |
resetBitmapRange(long[] bitmap,
int start,
int end)
clear bits at start, start+1,..., end-1
|
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
|
protected static int |
toIntUnsigned(short x) |
static int |
unsignedBinarySearch(short[] array,
int begin,
int end,
short k)
Look for value k in array in the range [begin,end).
|
static int |
unsignedDifference(short[] set1,
int length1,
short[] set2,
int length2,
short[] buffer)
Compute the difference between two sorted lists and write the result to the provided
output array
|
static int |
unsignedDifference(ShortIterator set1,
ShortIterator set2,
short[] buffer)
Compute the difference between two sorted lists and write the result to the provided
output array
|
static int |
unsignedExclusiveUnion2by2(short[] set1,
int length1,
short[] set2,
int length2,
short[] buffer)
Compute the exclusive union of two sorted lists and write the result to the provided
output array
|
static int |
unsignedIntersect2by2(short[] set1,
int length1,
short[] set2,
int length2,
short[] buffer)
Intersect two sorted lists and write the result to the provided
output array
|
static boolean |
unsignedIntersects(short[] set1,
int length1,
short[] set2,
int length2)
Checks if two arrays intersect
|
protected static int |
unsignedLocalIntersect2by2(short[] set1,
int length1,
short[] set2,
int length2,
short[] buffer) |
protected static int |
unsignedOneSidedGallopingIntersect2by2(short[] smallSet,
int smallLength,
short[] largeSet,
int largeLength,
short[] buffer) |
static int |
unsignedUnion2by2(short[] set1,
int length1,
short[] set2,
int length2,
short[] buffer)
Unite two sorted lists and write the result to the provided
output array
|
public static int advanceUntil(short[] array,
int pos,
int length,
short min)
array - array to search withinpos - starting position of the searchlength - length of the array to searchmin - minimum valuepublic static void fillArrayAND(short[] container,
long[] bitmap1,
long[] bitmap2)
container - where we writebitmap1 - first bitmapbitmap2 - second bitmappublic static void fillArrayANDNOT(short[] container,
long[] bitmap1,
long[] bitmap2)
container - where we writebitmap1 - first bitmapbitmap2 - second bitmappublic static void fillArrayXOR(short[] container,
long[] bitmap1,
long[] bitmap2)
container - where we writebitmap1 - first bitmapbitmap2 - second bitmapprotected static short highbits(int x)
protected static short lowbits(int x)
protected static short maxLowBit()
protected static int maxLowBitAsInteger()
protected static int toIntUnsigned(short x)
public static int unsignedBinarySearch(short[] array,
int begin,
int end,
short k)
array - array where we searchbegin - first index (inclusive)end - last index (exclusive)k - value we search forprotected static int hybridUnsignedBinarySearch(short[] array,
int begin,
int end,
short k)
protected static int branchyUnsignedBinarySearch(short[] array,
int begin,
int end,
short k)
public static int unsignedDifference(short[] set1,
int length1,
short[] set2,
int length2,
short[] buffer)
set1 - first arraylength1 - length of first arrayset2 - second arraylength2 - length of second arraybuffer - output arraypublic static int unsignedDifference(ShortIterator set1, ShortIterator set2, short[] buffer)
set1 - first arrayset2 - second arraybuffer - output arraypublic static int unsignedExclusiveUnion2by2(short[] set1,
int length1,
short[] set2,
int length2,
short[] buffer)
set1 - first arraylength1 - length of first arrayset2 - second arraylength2 - length of second arraybuffer - output arraypublic static int unsignedIntersect2by2(short[] set1,
int length1,
short[] set2,
int length2,
short[] buffer)
set1 - first arraylength1 - length of first arrayset2 - second arraylength2 - length of second arraybuffer - output arrayprotected static int unsignedLocalIntersect2by2(short[] set1,
int length1,
short[] set2,
int length2,
short[] buffer)
protected static int unsignedOneSidedGallopingIntersect2by2(short[] smallSet,
int smallLength,
short[] largeSet,
int largeLength,
short[] buffer)
public static int unsignedUnion2by2(short[] set1,
int length1,
short[] set2,
int length2,
short[] buffer)
set1 - first arraylength1 - length of first arrayset2 - second arraylength2 - length of second arraybuffer - output arraypublic static int select(long w,
int j)
w - wordj - indexpublic 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)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 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)public static int compareUnsigned(short a,
short b)
short values, treating them as unsigned values between
0 and 2^16 - 1 inclusive.a - the first unsigned short to compareb - the second unsigned short to comparea is less than b; a positive value if a is
greater than b; or zero if they are equalpublic static boolean unsignedIntersects(short[] set1,
int length1,
short[] set2,
int length2)
set1 - first arraylength1 - length of first arrayset2 - second arraylength2 - length of second arrayCopyright © 2015. All Rights Reserved.