Record Class AnimationKeyframe

java.lang.Object
java.lang.Record
kr.toxicity.model.api.animation.AnimationKeyframe
Record Components:
progresses - the array of animation progresses
All Implemented Interfaces:
TimedStorage<AnimationProgress>

public record AnimationKeyframe(@NotNull AnimationProgress[] progresses) extends Record implements TimedStorage<AnimationProgress>
Represents a collection of animation keyframes, optimized for efficient storage and access.

This record stores an array of AnimationProgress objects, which define the state of a bone at specific time intervals. It implements TimedStorage for indexed access.

Since:
2.0.0
  • Constructor Details

    • AnimationKeyframe

      public AnimationKeyframe(@NotNull @NotNull AnimationProgress[] progresses)
      Creates an instance of a AnimationKeyframe record class.
      Parameters:
      progresses - the value for the progresses record component
  • Method Details

    • builder

      @NotNull public static @NotNull AnimationKeyframe.Builder builder(int size, boolean rotateGlobal)
      Creates a new builder for constructing an AnimationKeyframe.
      Parameters:
      size - the number of keyframes
      rotateGlobal - whether rotation should be applied globally
      Returns:
      a new builder instance
      Since:
      2.0.0
    • get

      @NotNull public @NotNull AnimationProgress get(int i)
      Description copied from interface: TimedStorage
      Retrieves the element at the specified index.
      Specified by:
      get in interface TimedStorage<AnimationProgress>
      Parameters:
      i - the index of the element
      Returns:
      the element
    • getLast

      @NotNull public @NotNull AnimationProgress getLast()
      Description copied from interface: TimedStorage
      Retrieves the last element in the storage.
      Specified by:
      getLast in interface TimedStorage<AnimationProgress>
      Returns:
      the last element
    • size

      public int size()
      Description copied from interface: TimedStorage
      Returns the number of elements in the storage.
      Specified by:
      size in interface TimedStorage<AnimationProgress>
      Returns:
      the size
    • toEmpty

      @NotNull public @NotNull TimedStorage<AnimationProgress> toEmpty()
      Converts this keyframe collection to a storage of empty progresses.
      Returns:
      a new timed storage with empty progresses
      Since:
      2.0.0
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • progresses

      @NotNull public @NotNull AnimationProgress[] progresses()
      Returns the value of the progresses record component.
      Returns:
      the value of the progresses record component