public final class Util extends Object
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static void |
checkSeedHashes(short seedHashA,
short seedHashB)
Checks the two given seed hashes.
|
static short |
computeSeedHash(long seed)
Computes and checks the 16-bit seed hash from the given long seed.
|
static <S extends Summary> |
copySummaryArray(S[] summaryArr)
Will copy compact summary arrays as well as hashed summary tables (with nulls).
|
static long[] |
doubleToLongArray(double value)
Converts a double to a long[].
|
static int |
getStartingCapacity(int nomEntries,
int lgResizeFactor)
Gets the starting capacity of a new sketch given the Nominal Entries and the log Resize Factor.
|
static <S extends Summary> |
newSummaryArray(S[] summaryArr,
int length)
Creates a new Summary Array with the specified length
|
static long |
stringArrHash(String[] strArray) |
static String |
stringConcat(String[] strArr)
Concatenate array of Strings to a single String.
|
static long |
stringHash(String s) |
static byte[] |
stringToByteArray(String value)
Converts a String to a UTF_8 byte array.
|
public static final long[] doubleToLongArray(double value)
value
- the given double valuepublic static final byte[] stringToByteArray(String value)
value
- the given String valuepublic static short computeSeedHash(long seed)
seed
- See Update Hash Seedpublic static final void checkSeedHashes(short seedHashA, short seedHashB)
seedHashA
- given seed hash AseedHashB
- given seed hash Bpublic static int getStartingCapacity(int nomEntries, int lgResizeFactor)
nomEntries
- the given Nominal EntrieslgResizeFactor
- the given log Resize Factorpublic static String stringConcat(String[] strArr)
strArr
- the given String arraypublic static long stringHash(String s)
s
- the string to hashpublic static long stringArrHash(String[] strArray)
strArray
- array of Stringspublic static <S extends Summary> S[] copySummaryArray(S[] summaryArr)
S
- type of summarysummaryArr
- the given summary array or tablepublic static <S extends Summary> S[] newSummaryArray(S[] summaryArr, int length)
S
- the summary class typesummaryArr
- example array, only used to obtain the component type. It has no data.length
- the desired length of the returned array.Copyright © 2015–2024 The Apache Software Foundation. All rights reserved.