Class ArrayFloatSlice

java.lang.Object
io.karma.sliced.slice.impl.AbstractSlice<Float>
io.karma.sliced.slice.impl.ArrayFloatSlice
All Implemented Interfaces:
FloatSlice, Slice<Float>, Resettable, ResettableEnumeration<Float>, FloatView, View<Float>, Iterable<Float>, Enumeration<Float>

@API(status=INTERNAL) public final class ArrayFloatSlice extends AbstractSlice<Float> implements FloatSlice
Since:
25/08/2022
  • Constructor Details

    • ArrayFloatSlice

      public ArrayFloatSlice(float[] ref, int offset, int size)
  • Method Details

    • getFloat

      public float getFloat(int index)
      Description copied from interface: FloatSlice
      Retrieves a float value from this slice instance at the given index.
      Specified by:
      getFloat in interface FloatSlice
      Parameters:
      index - The index at which to retrieve the element.
      Returns:
      The float value at the given index.
    • toFloatArray

      public float[] toFloatArray(int offset, int size)
      Description copied from interface: FloatSlice
      Creates a new float array with the appropriate size, and copies all values from start to end into new newly created array using System.arraycopy(Object, int, Object, int, int).
      Specified by:
      toFloatArray in interface FloatSlice
      Parameters:
      offset - The index at which the newly created array should begin (relative to the offset of this slice).
      size - The size of the newly created array.
      Returns:
      A new array containing all elements from start to end.
    • slice

      @NotNull public @NotNull Slice<Float> slice(int offset, int size)
      Description copied from interface: Slice
      Creates a new sub-slice from this slice instance, with the given index range relative to the start index of this slice instance.
      Specified by:
      slice in interface Slice<Float>
      Parameters:
      offset - The index at which the newly created slice should begin (relative to the offset of this slice).
      size - The size of the newly created slice.
      Returns:
      A new slice instance containing the same collection/array reference as this slice instance, but with the given relative index range.
    • floatIterator

      @NotNull public @NotNull FloatIterator floatIterator()
      Description copied from interface: FloatView
      Creates a new FloatIterator from the elements referenced by this slice instance.
      Specified by:
      floatIterator in interface FloatView
      Returns:
      A new FloatIterator from the elements referenced by this slice instance.
    • reset

      public void reset()
      Description copied from interface: Resettable
      Resets the internal states of this object instance.
      Specified by:
      reset in interface Resettable
    • hasMoreElements

      public boolean hasMoreElements()
      Specified by:
      hasMoreElements in interface Enumeration<Float>
    • nextElement

      @NotNull public @NotNull Float nextElement()
      Specified by:
      nextElement in interface Enumeration<Float>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@Nullable @Nullable Object obj)
      Overrides:
      equals in class Object
    • toString

      @NotNull public @NotNull String toString()
      Overrides:
      toString in class Object