Class PVectorByteBufferedIntegral2s32<T>
java.lang.Object
com.io7m.jtensors.storage.bytebuffered.PVectorByteBufferedIntegral2s32<T>
- Type Parameters:
T
- A phantom type parameter
- All Implemented Interfaces:
PVectorReadable2LType<T>
,VectorReadable2LType
,PVectorStorageIntegral2Type<T>
,VectorStorageIntegral2Type
,VectorStorageType
,PVectorByteBufferedIntegral2Type<T>
,TensorByteBufferedType
,VectorByteBufferedType
public final class PVectorByteBufferedIntegral2s32<T> extends java.lang.Object implements PVectorByteBufferedIntegral2Type<T>
A storage vector.
Storage component type: int
Storage component count: 2
-
Method Summary
Modifier and Type Method Description java.nio.ByteBuffer
byteBuffer()
long
byteOffset()
protected int
byteOffsetForIndex(int component_index)
protected int
componentBytes()
protected int
componentCount()
static <T> PVectorByteBufferedIntegral2s32<T>
createWithBase(java.nio.ByteBuffer b, com.io7m.mutable.numbers.core.MutableLongType base, int offset)
Return a new vector that is backed by the given byte bufferb
int
offset()
void
setX(long x)
Set thex
component.void
setY(long y)
Set theY
component.int
sizeBytes()
long
x()
long
y()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.io7m.jtensors.storage.api.parameterized.vectors.PVectorStorageIntegral2Type
setPVector2I, setPVector2L
Methods inherited from interface com.io7m.jtensors.storage.bytebuffered.TensorByteBufferedType
byteBuffer, byteOffset, offset, sizeBytes
Methods inherited from interface com.io7m.jtensors.storage.api.unparameterized.vectors.VectorStorageIntegral2Type
setVector2I, setVector2L, setXY
-
Method Details
-
createWithBase
public static <T> PVectorByteBufferedIntegral2s32<T> createWithBase(java.nio.ByteBuffer b, com.io7m.mutable.numbers.core.MutableLongType base, int offset)Return a new vector that is backed by the given byte buffer
b
The data for the instance will be taken from the data at the current value of
base.get() + offset
, each time a field is requested or set.No initialization of the data is performed.
- Type Parameters:
T
- A phantom type parameter- Parameters:
b
- The byte bufferbase
- The base addressoffset
- A constant offset- Returns:
- A new buffered vector
-
componentCount
protected int componentCount() -
x
public long x()- Specified by:
x
in interfaceVectorReadable2LType
- Returns:
- The
x
component
-
y
public long y()- Specified by:
y
in interfaceVectorReadable2LType
- Returns:
- The
y
component
-
setX
public void setX(long x)Description copied from interface:VectorStorageIntegral2Type
Set thex
component.- Specified by:
setX
in interfaceVectorStorageIntegral2Type
- Parameters:
x
- The X component
-
setY
public void setY(long y)Description copied from interface:VectorStorageIntegral2Type
Set theY
component.- Specified by:
setY
in interfaceVectorStorageIntegral2Type
- Parameters:
y
- The Y component
-
componentBytes
protected final int componentBytes() -
byteBuffer
public final java.nio.ByteBuffer byteBuffer()- Specified by:
byteBuffer
in interfaceTensorByteBufferedType
- Returns:
- The byte buffer that backs the tensor
-
byteOffset
public final long byteOffset()- Specified by:
byteOffset
in interfaceTensorByteBufferedType
- Returns:
- The byte offset of the current tensor
-
offset
public final int offset()- Specified by:
offset
in interfaceTensorByteBufferedType
- Returns:
- A constant offset added to
TensorByteBufferedType.byteOffset()
.
-
sizeBytes
public final int sizeBytes()- Specified by:
sizeBytes
in interfaceTensorByteBufferedType
- Returns:
- The size of a single tensor in bytes
-
byteOffsetForIndex
protected final int byteOffsetForIndex(int component_index)
-