Enum Class WrapMode
- All Implemented Interfaces:
Serializable
,Comparable<WrapMode>
,Constable
Determines how values outside of bounds are transformed.
Can be used to transform any given number into an index for an item in an array.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionabstract int
transform
(int value, int min, int max) Transforms a value based on the given bounds.<E> int
transformIndex
(int index, E[] array) Transforms an index based on the size of an array.int
transformIndex
(int index, Collection<?> collection) Transforms an index based on the size of a collection.static WrapMode
Returns the enum constant of this class with the specified name.static WrapMode[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
REPEAT
-
CLIP
-
CLAMP
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
transformIndex
Transforms an index based on the size of a collection.- Parameters:
index
- The index to transformcollection
- The collection- Returns:
- The transformed index. (
-1
represents an empty value.)
-
transformIndex
public <E> int transformIndex(int index, E[] array) Transforms an index based on the size of an array.- Parameters:
index
- The index to transformarray
- The array- Returns:
- The transformed index. (
-1
represents an empty value.)
-
transform
Transforms a value based on the given bounds.- Parameters:
value
- The value to wrapmin
- The lower boundmax
- The upper bound- Returns:
- The transformed value. (
-1
represents an empty value.) - Throws:
IllegalArgumentException
- If the bounds are invalid.
-