Enum Class WrapMode

java.lang.Object
java.lang.Enum<WrapMode>
dev.prozilla.pine.common.property.selection.WrapMode
All Implemented Interfaces:
Serializable, Comparable<WrapMode>, Constable

public enum WrapMode extends Enum<WrapMode>
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.

  • Enum Constant Details

    • REPEAT

      public static final WrapMode REPEAT
    • CLIP

      public static final WrapMode CLIP
    • CLAMP

      public static final WrapMode CLAMP
  • Method Details

    • values

      public static WrapMode[] 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

      public static WrapMode valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • transformIndex

      public int transformIndex(int index, Collection<?> collection)
      Transforms an index based on the size of a collection.
      Parameters:
      index - The index to transform
      collection - 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 transform
      array - The array
      Returns:
      The transformed index. (-1 represents an empty value.)
    • transform

      public abstract int transform(int value, int min, int max) throws IllegalArgumentException
      Transforms a value based on the given bounds.
      Parameters:
      value - The value to wrap
      min - The lower bound
      max - The upper bound
      Returns:
      The transformed value. (-1 represents an empty value.)
      Throws:
      IllegalArgumentException - If the bounds are invalid.