Package io.karma.sliced.slice.impl
Class 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
-
Field Summary
Fields inherited from class io.karma.sliced.slice.impl.AbstractSlice
maxIndex, offset, size
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
@NotNull FloatIterator
Creates a newFloatIterator
from the elements referenced by this slice instance.float
getFloat
(int index) Retrieves afloat
value from this slice instance at the given index.int
hashCode()
boolean
@NotNull Float
void
reset()
Resets the internal states of this object instance.slice
(int offset, int size) Creates a new sub-slice from this slice instance, with the given index range relative to the start index of this slice instance.float[]
toFloatArray
(int offset, int size) Creates a newfloat
array with the appropriate size, and copies all values fromstart
toend
into new newly created array usingSystem.arraycopy(Object, int, Object, int, int)
.@NotNull String
toString()
Methods inherited from class io.karma.sliced.slice.impl.AbstractSlice
asSlice, offset, size
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Enumeration
asIterator
Methods inherited from interface io.karma.sliced.slice.FloatSlice
asSlice, get, map, toFloatArray
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface io.karma.sliced.slice.Slice
copy, copy, copy, copyArrayList, copyHashSet, forEachIndexed, getOptional, getOrElse, getOrThrow, map, offset, toArray, toArray
Methods inherited from interface io.karma.sliced.view.View
contains, containsAll, containsAllRefs, containsRef, contentEquals, contentEquals, copyArrayList, copyHashSet, forAll, forAllIndexed, parallelStream, referencesEqual, referencesEqual, size, stream
-
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 afloat
value from this slice instance at the given index.- Specified by:
getFloat
in interfaceFloatSlice
- 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 newfloat
array with the appropriate size, and copies all values fromstart
toend
into new newly created array usingSystem.arraycopy(Object, int, Object, int, int)
.- Specified by:
toFloatArray
in interfaceFloatSlice
- 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
toend
.
-
slice
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 interfaceSlice<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
Description copied from interface:FloatView
Creates a newFloatIterator
from the elements referenced by this slice instance.- Specified by:
floatIterator
in interfaceFloatView
- 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 interfaceResettable
-
hasMoreElements
public boolean hasMoreElements()- Specified by:
hasMoreElements
in interfaceEnumeration<Float>
-
nextElement
- Specified by:
nextElement
in interfaceEnumeration<Float>
-
hashCode
public int hashCode() -
equals
-
toString
-