Package com.scurrilous.circe
Enum HashSupport
- java.lang.Object
-
- java.lang.Enum<HashSupport>
-
- com.scurrilous.circe.HashSupport
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<HashSupport>
public enum HashSupport extends java.lang.Enum<HashSupport>
Flags indicating the support available for some set of hash algorithm.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
HashSupport.SetComparator
Comparator
forEnumSets
for hash support flags.
-
Enum Constant Summary
Enum Constants Enum Constant Description HARDWARE
Indicates that the hash algorithm is available in hardware-accelerated native code.HARDWARE_INCREMENTAL
Indicates that the hash algorithm is available in hardware-accelerated native code as anIncrementalIntHash
orIncrementalLongHash
, depending on which ofINT_SIZED
orLONG_SIZED
is set.INCREMENTAL
Indicates that the hash algorithm is available as an incremental stateful hash function, for whichStatefulHash.supportsIncremental()
returnstrue
.INT_SIZED
Indicates that the hash algorithm is available as aStatefulIntHash
andStatelessIntHash
.LONG_SIZED
Indicates that the hash algorithm is available as aStatefulLongHash
andStatelessLongHash
.NATIVE
Indicates that the hash algorithm is available in native code.NATIVE_INCREMENTAL
Indicates that the hash algorithm is available in native code as aIncrementalIntHash
orIncrementalLongHash
, depending on which ofINT_SIZED
orLONG_SIZED
is set.STATEFUL
Indicates that the hash algorithm is available as aStatefulHash
.STATELESS_INCREMENTAL
Indicates that the hash algorithm is available as aIncrementalIntHash
orIncrementalLongHash
, depending on which ofINT_SIZED
orLONG_SIZED
is set.UNSAFE
Indicates that the stateful hash algorithm unsafe memory access viaStatefulHash.update(long, long)
.UNSAFE_INCREMENTAL
Indicates that the incremental hash algorithm supports unsafe memory access viaIncrementalIntHash.resume(int, long, long)
orIncrementalLongHash.resume(long, long, long)
, depending on which ofINT_SIZED
orLONG_SIZED
is set.
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_PRIORITY
The maximum priority value, indicating the lowest priority.static int
MIN_PRIORITY
The minimum priority value, indicating the highest priority.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int
compare(java.util.EnumSet<HashSupport> set1, java.util.EnumSet<HashSupport> set2)
Compares the given sets of hash algorithm support flags for priority order.static int
getMaxPriority(java.util.EnumSet<HashSupport> set)
Returns the priority of the highest-priority hash algorithm support flag in the given set of flags.int
getPriority()
Returns the relative priority of a hash algorithm support flag, which is an indicator of its performance and flexibility.static HashSupport
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static HashSupport[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
HARDWARE_INCREMENTAL
public static final HashSupport HARDWARE_INCREMENTAL
Indicates that the hash algorithm is available in hardware-accelerated native code as anIncrementalIntHash
orIncrementalLongHash
, depending on which ofINT_SIZED
orLONG_SIZED
is set.
-
HARDWARE
public static final HashSupport HARDWARE
Indicates that the hash algorithm is available in hardware-accelerated native code.
-
NATIVE_INCREMENTAL
public static final HashSupport NATIVE_INCREMENTAL
Indicates that the hash algorithm is available in native code as aIncrementalIntHash
orIncrementalLongHash
, depending on which ofINT_SIZED
orLONG_SIZED
is set.
-
NATIVE
public static final HashSupport NATIVE
Indicates that the hash algorithm is available in native code.
-
UNSAFE_INCREMENTAL
public static final HashSupport UNSAFE_INCREMENTAL
Indicates that the incremental hash algorithm supports unsafe memory access viaIncrementalIntHash.resume(int, long, long)
orIncrementalLongHash.resume(long, long, long)
, depending on which ofINT_SIZED
orLONG_SIZED
is set.
-
UNSAFE
public static final HashSupport UNSAFE
Indicates that the stateful hash algorithm unsafe memory access viaStatefulHash.update(long, long)
. IfINT_SIZED
is also set, the function returned byStatefulIntHash.asStateless()
also supportsStatelessIntHash.calculate(long, long)
. Similarly, ifLONG_SIZED
is also set, the function returned byStatefulLongHash.asStateless()
also supportsStatelessLongHash.calculate(long, long)
.
-
STATELESS_INCREMENTAL
public static final HashSupport STATELESS_INCREMENTAL
Indicates that the hash algorithm is available as aIncrementalIntHash
orIncrementalLongHash
, depending on which ofINT_SIZED
orLONG_SIZED
is set.
-
INCREMENTAL
public static final HashSupport INCREMENTAL
Indicates that the hash algorithm is available as an incremental stateful hash function, for whichStatefulHash.supportsIncremental()
returnstrue
. This flag is implied bySTATELESS_INCREMENTAL
.
-
INT_SIZED
public static final HashSupport INT_SIZED
Indicates that the hash algorithm is available as aStatefulIntHash
andStatelessIntHash
.
-
LONG_SIZED
public static final HashSupport LONG_SIZED
Indicates that the hash algorithm is available as aStatefulLongHash
andStatelessLongHash
.
-
STATEFUL
public static final HashSupport STATEFUL
Indicates that the hash algorithm is available as aStatefulHash
. If this flag is not set, the algorithm is not supported at all.
-
-
Field Detail
-
MIN_PRIORITY
public static final int MIN_PRIORITY
The minimum priority value, indicating the highest priority. All flags have a priority value greater than this.- See Also:
- Constant Field Values
-
MAX_PRIORITY
public static final int MAX_PRIORITY
The maximum priority value, indicating the lowest priority. All flags have a priority value less than this.- See Also:
- Constant Field Values
-
-
Method Detail
-
values
public static HashSupport[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (HashSupport c : HashSupport.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static HashSupport valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getPriority
public int getPriority()
Returns the relative priority of a hash algorithm support flag, which is an indicator of its performance and flexibility. Lower values indicate higher priority.- Returns:
- the priority of this flag (currently between 10 and 90)
-
getMaxPriority
public static int getMaxPriority(java.util.EnumSet<HashSupport> set)
Returns the priority of the highest-priority hash algorithm support flag in the given set of flags. If the set is empty,MAX_PRIORITY
is returned.- Parameters:
set
- a set of hash algorithm support flags- Returns:
- the highest priority (lowest value) in the set, or
MAX_PRIORITY
if empty
-
compare
public static int compare(java.util.EnumSet<HashSupport> set1, java.util.EnumSet<HashSupport> set2)
Compares the given sets of hash algorithm support flags for priority order. The set with the highest priority flag without a flag of matching priority in the other set has higher priority.- Parameters:
set1
- the first set to be comparedset2
- the second set to be compared- Returns:
- a negative integer, zero, or a positive integer if the first set has priority higher than, equal to, or lower than the second
-
-