Class VulkanEnumMaps
java.lang.Object
com.io7m.jcoronado.api.VulkanEnumMaps
Functions over enum ←→ integer maps.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Enum<T> & VulkanEnumIntegerType>
Map<Integer, T> map(T[] values) Produce an efficient map of integers to enum constants.static <T extends Enum<T> & VulkanEnumBitmaskType>
intpackValues(Iterable<T> values) Bitwise OR the integer values of all the given constants.static <T extends Enum<T> & VulkanEnumBitmaskLongType>
longpackValuesLong(Iterable<T> values) Bitwise OR the integer values of all the given constants.static <T extends Enum<T> & VulkanEnumBitmaskType>
EnumSet<T> unpackValues(Class<T> enumClass, Supplier<T[]> enumValues, int flags) Unpack flag values from a given integer.
-
Method Details
-
packValuesLong
public static <T extends Enum<T> & VulkanEnumBitmaskLongType> long packValuesLong(Iterable<T> values) Bitwise OR the integer values of all the given constants.- Type Parameters:
T- The precise type of enum- Parameters:
values- The values- Returns:
- The integer-packed values
-
packValues
Bitwise OR the integer values of all the given constants.- Type Parameters:
T- The precise type of enum- Parameters:
values- The values- Returns:
- The integer-packed values
-
unpackValues
public static <T extends Enum<T> & VulkanEnumBitmaskType> EnumSet<T> unpackValues(Class<T> enumClass, Supplier<T[]> enumValues, int flags) Unpack flag values from a given integer.- Type Parameters:
T- The precise type of enum- Parameters:
enumClass- The enum classenumValues- A function that returns the result of the enum's values() method.flags- The flags value- Returns:
- The integer-packed values
-
map
Produce an efficient map of integers to enum constants.- Type Parameters:
T- The precise type of enum- Parameters:
values- The list of enum values- Returns:
- The resulting map
-