Package org.bytedeco.javacpp.indexer
Class Indexer
- java.lang.Object
-
- org.bytedeco.javacpp.indexer.Indexer
-
- All Implemented Interfaces:
java.lang.AutoCloseable
- Direct Known Subclasses:
Bfloat16Indexer,BooleanIndexer,ByteIndexer,CharIndexer,DoubleIndexer,FloatIndexer,HalfIndexer,IntIndexer,LongIndexer,ShortIndexer,UByteIndexer,UIntIndexer,ULongIndexer,UShortIndexer
public abstract class Indexer extends java.lang.Object implements java.lang.AutoCloseableTop-level class of all data indexers, providing easy-to-use and efficient multidimensional access to primitive arrays, NIO buffers, and the raw memory interface.Subclasses have
create()factory methods for arrays, buffers, and pointers. The latter ones feature adirectargument that, when set tofalse, instructs the method to create a large enough array, fill its content with the data from the pointer, and return an array-backed indexer, with therelease()method overridden to write back changes to the pointer. This doubles the memory usage, but is the only way to get acceptable performance on some implementations, such as Android. Whendirect == true, the raw memory interface (supporting long indexing) is used if available, and if not a buffer-backed indexer is returned.- See Also:
Raw
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.Objectarray()Returns the backing array, ornullif nonejava.nio.Bufferbuffer()Returns the backing buffer, ornullif nonelongchannels()Deprecated.protected static longcheckIndex(long i, long size)voidclose()Callsrelease().longcols()Deprecated.abstract doublegetDouble(long... indices)Callsget(int...indices)and returns the value as a double.longheight()Deprecated.longindex(long i)Returnsindex.index(i).longindex(long... indices)Returnsindex.index(indices).longindex(long i, long j)Returnsindex.index(i, j).longindex(long i, long j, long k)Returnsindex.index(i, j, k).Indexableindexable()Returnsindexable.Indexerindexable(Indexable indexable)Setsindexableand returns this.Pointerpointer()Returns the backing pointer, ornullif noneabstract IndexerputDouble(long[] indices, double value)Casts value to primitive type and callsput(long[] indices, <type> value).intrank()Returnsindex.rank().abstract <I extends Indexer>
Ireindex(Index index)Returns a new Indexer using the same data, but with a different Index.abstract voidrelease()Makes sure changes are reflected onto the backing memory and clears any references.longrows()Deprecated.longsize(int i)Returnsindex.size(i).long[]sizes()Returnsindex.sizes().longstride(int i)Deprecated.long[]strides()Deprecated.static long[]strides(long... sizes)Deprecated.java.lang.StringtoString()longwidth()Deprecated.
-
-
-
Field Detail
-
sizes
@Deprecated protected long[] sizes
Deprecated.SeeIndex.sizes.
-
strides
@Deprecated protected long[] strides
Deprecated.SeeStrideIndex.strides.
-
index
protected final Index index
The Index to be used forindex(long...).
-
-
Method Detail
-
close
public void close()
Callsrelease().- Specified by:
closein interfacejava.lang.AutoCloseable
-
rank
public int rank()
Returnsindex.rank().
-
sizes
public long[] sizes()
Returnsindex.sizes().
-
strides
@Deprecated public long[] strides()
Deprecated.Returnsstridesornullif there are no strides.
-
size
public long size(int i)
Returnsindex.size(i).
-
stride
@Deprecated public long stride(int i)
Deprecated.Returnsstrides[i]or-1if there are no strides.
-
rows
@Deprecated public long rows()
Deprecated.Returnssizes.length > 0 && sizes.length < 4 ? sizes[0] : -1.
-
cols
@Deprecated public long cols()
Deprecated.Returnssizes.length > 1 && sizes.length < 4 ? sizes[1] : -1.
-
width
@Deprecated public long width()
Deprecated.Returnssizes.length > 1 && sizes.length < 4 ? sizes[1] : -1.
-
height
@Deprecated public long height()
Deprecated.Returnssizes.length > 0 && sizes.length < 4 ? sizes[0] : -1.
-
channels
@Deprecated public long channels()
Deprecated.Returnssizes.length > 2 && sizes.length < 4 ? sizes[2] : -1.
-
checkIndex
protected static final long checkIndex(long i, long size)
-
strides
@Deprecated public static long[] strides(long... sizes)
Deprecated.
-
index
public long index(long i)
Returnsindex.index(i).
-
index
public long index(long i, long j)Returnsindex.index(i, j).
-
index
public long index(long i, long j, long k)Returnsindex.index(i, j, k).
-
index
public long index(long... indices)
Returnsindex.index(indices).
-
array
public java.lang.Object array()
Returns the backing array, ornullif none
-
buffer
public java.nio.Buffer buffer()
Returns the backing buffer, ornullif none
-
pointer
public Pointer pointer()
Returns the backing pointer, ornullif none
-
release
public abstract void release()
Makes sure changes are reflected onto the backing memory and clears any references.
-
getDouble
public abstract double getDouble(long... indices)
Callsget(int...indices)and returns the value as a double.
-
putDouble
public abstract Indexer putDouble(long[] indices, double value)
Casts value to primitive type and callsput(long[] indices, <type> value).
-
reindex
public abstract <I extends Indexer> I reindex(Index index)
Returns a new Indexer using the same data, but with a different Index.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-