Record Class StructArray<T>
java.lang.Object
java.lang.Record
org.lwjgl.system.ffm.StructArray<T>
- Record Components:
binder- the binder used to access the array elementssegment- the memory segment to wrap
- All Implemented Interfaces:
Iterable<T>, GroupArray<StructLayout, T>, Pointer
public record StructArray<T>(StructBinder<T> binder, MemorySegment segment)
extends Record
implements GroupArray<StructLayout, T>
Can be used to create a
MemorySegment view as an array of structs.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface Pointer
Pointer.Default -
Field Summary
Fields inherited from interface Pointer
BITS32, BITS64, CLONG_SHIFT, CLONG_SIZE, POINTER_SHIFT, POINTER_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionStructArray(StructBinder<T> binder, MemorySegment segment) Creates an instance of aStructArrayrecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongaddress()Returns the array memory address.Applies the specified consumer to the element at the specified index.binder()Returns the value of thebinderrecord component.voidclear(long fromIndex, long toIndex) Clears the elements in the specified index range.<GA extends GroupArray<StructLayout, T>>
StructArray<T> copy(long thisIndex, GA other, long otherIndex, long length) Copies elements from this array to another array.final booleanIndicates whether some other object is "equal to" this one.get(long index) Returns the array element at the specified index.final inthashCode()Returns a hash code value for this object.segment()Returns the value of thesegmentrecord component.Sets the array element at the specified index to the specified value.slice(long index) Returns a new array that is a slice of this array starting at the specified index.slice(long index, long elementCount) Returns a new array that is a slice of this array starting at the specified index and containing the specified number of elements.final StringtoString()Returns a string representation of this record class.Methods inherited from interface GroupArray
alignof, clear, copy, copy, forEach, iterator, length, parallelStream, sizeof, spliterator, stream
-
Constructor Details
-
Method Details
-
address
public long address()Description copied from interface:GroupArrayReturns the array memory address.This address will be equal to the wrapped
MemorySegmentaddress.- Specified by:
addressin interfaceGroupArray<StructLayout, T>- Specified by:
addressin interfacePointer- Returns:
- the pointer address
-
get
Description copied from interface:GroupArrayReturns the array element at the specified index.- Specified by:
getin interfaceGroupArray<StructLayout, T>- Parameters:
index- the array index- Returns:
- the array element
-
set
Description copied from interface:GroupArraySets the array element at the specified index to the specified value.- Specified by:
setin interfaceGroupArray<StructLayout, T>- Parameters:
index- the array indexvalue- the new value- Returns:
- this array
-
copy
public <GA extends GroupArray<StructLayout, T>> StructArray<T> copy(long thisIndex, GA other, long otherIndex, long length) Description copied from interface:GroupArrayCopies elements from this array to another array.- Specified by:
copyin interfaceGroupArray<StructLayout, T>- Parameters:
thisIndex- the starting index in this arrayother- the destination arrayotherIndex- the starting index in the destination arraylength- the number of elements to copy- Returns:
- this array
-
clear
public void clear(long fromIndex, long toIndex) Description copied from interface:GroupArrayClears the elements in the specified index range.- Specified by:
clearin interfaceGroupArray<StructLayout, T>- Parameters:
fromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)
-
apply
Description copied from interface:GroupArrayApplies the specified consumer to the element at the specified index.- Specified by:
applyin interfaceGroupArray<StructLayout, T>- Parameters:
index- the array indexconsumer- the consumer to apply- Returns:
- this array
-
slice
Description copied from interface:GroupArrayReturns a new array that is a slice of this array starting at the specified index.- Specified by:
slicein interfaceGroupArray<StructLayout, T>- Parameters:
index- the starting index- Returns:
- the sliced array
-
slice
Description copied from interface:GroupArrayReturns a new array that is a slice of this array starting at the specified index and containing the specified number of elements.- Specified by:
slicein interfaceGroupArray<StructLayout, T>- Parameters:
index- the starting indexelementCount- the number of elements in the slice- Returns:
- the sliced array
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
binder
Returns the value of thebinderrecord component.- Specified by:
binderin interfaceGroupArray<StructLayout, T>- Returns:
- the value of the
binderrecord component
-
segment
Returns the value of thesegmentrecord component.- Specified by:
segmentin interfaceGroupArray<StructLayout, T>- Returns:
- the value of the
segmentrecord component
-