Package com.esri.core.geometry
Class AttributeStreamBase
java.lang.Object
com.esri.core.geometry.AttributeStreamBase
- Direct Known Subclasses:
AttributeStreamOfDbl
,AttributeStreamOfFloat
,AttributeStreamOfInt16
,AttributeStreamOfInt32
,AttributeStreamOfInt64
,AttributeStreamOfInt8
Base class for AttributeStream instances.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
addRange
(AttributeStreamBase src, int srcStart, int count, boolean bForward, int stride) Adds a range of elements from the source stream.abstract int
calculateHashImpl
(int hashCode, int start, int end) (package private) void
clear
(boolean bFreeMemory) Same as resize(0)static AttributeStreamBase
createAttributeStreamWithPersistence
(int persistence, int size) Creates a new attribute stream of given persistence type and size.static AttributeStreamBase
createAttributeStreamWithPersistence
(int persistence, int size, double defaultValue) Creates a new attribute stream of given persistence type and size.static AttributeStreamBase
createAttributeStreamWithSemantics
(int semantics, int vertexCount) Creates a new attribute stream for the given semantics and vertex count.static AttributeStreamBase
createByteStream
(int size) Creates a new attribute stream for storing bytes.static AttributeStreamBase
createByteStream
(int size, byte defaultValue) Creates a new attribute stream for storing bytes.static AttributeStreamBase
createDoubleStream
(int size) Creates a new attribute stream for storing doubles.static AttributeStreamBase
createDoubleStream
(int size, double defaultValue) Creates a new attribute stream for storing doubles.static AttributeStreamBase
createIndexStream
(int size) Creates a new attribute stream for storing vertex indices.static AttributeStreamBase
createIndexStream
(int size, int defaultValue) Creates a new attribute stream for storing vertex indices.abstract boolean
equals
(AttributeStreamBase other, int start, int end) abstract void
eraseRange
(int index, int count, int validSize) Erases a range from the buffer and defragments the result.abstract long
Returns an estimate of this object size in bytes.abstract int
Returns the Persistence type of the stream.abstract void
insertAttributes
(int start, Point pt, int semantics, int validSize) Inserts the attributes of a given semantics from a Point geometry.abstract void
insertRange
(int start, double value, int count, int validSize) Inserts a range of elements of the given value.abstract void
insertRange
(int start, AttributeStreamBase src, int srcStart, int count, boolean bForward, int stride, int validSize) Inserts a range of elements from the source stream.boolean
boolean
void
lockSize()
Lock the size of the stream.abstract double
readAsDbl
(int offset) Reads given element and returns it as double.abstract int
readAsInt
(int offset) Reads given element and returns it as int (truncated if double).abstract long
readAsInt64
(int offset) Reads given element and returns it as int (truncated if double).abstract void
readRange
(int srcStart, int count, ByteBuffer dst, int dstOffsetBytes, boolean bForward) Write a range of elements to the source byte buffer.abstract void
resize
(int newSize) Resizes the AttributeStream to the new size.abstract void
resize
(int newSize, double defaultValue) Resizes the AttributeStream to the new size.abstract void
resizePreserveCapacity
(int newSize) Resizes the AttributeStream to the new size.abstract AttributeStreamBase
restrictedClone
(int maxsize) Creats a copy of the stream that contains upto maxsize elements.abstract void
reverseRange
(int index, int count, int stride) Reverses a range from the buffer.abstract void
setRange
(double value, int start, int count) Sets a range of values to given value.void
Makes the stream to be readonly.abstract int
Returns the number of elements in the stream.abstract void
writeAsDbl
(int offset, double d) Writes given element as double.abstract void
writeAsInt
(int offset, int d) Writes given element as int.abstract void
writeAsInt64
(int offset, long d) Writes given element as int.abstract void
writeRange
(int startElement, int count, AttributeStreamBase src, int sourceStart, boolean bForward, int stride) Adds a range of elements from the source byte buffer.abstract void
writeRange
(int startElement, int count, ByteBuffer src, int offsetBytes, boolean bForward) Adds a range of elements from the source byte buffer.
-
Field Details
-
m_bLockedInSize
protected boolean m_bLockedInSize -
m_bReadonly
protected boolean m_bReadonly
-
-
Constructor Details
-
AttributeStreamBase
public AttributeStreamBase()
-
-
Method Details
-
virtualSize
public abstract int virtualSize()Returns the number of elements in the stream. -
estimateMemorySize
public abstract long estimateMemorySize()Returns an estimate of this object size in bytes.- Returns:
- Returns an estimate of this object size in bytes.
-
getPersistence
public abstract int getPersistence()Returns the Persistence type of the stream. -
readAsDbl
public abstract double readAsDbl(int offset) Reads given element and returns it as double. -
writeAsDbl
public abstract void writeAsDbl(int offset, double d) Writes given element as double. The double is cast to the internal representation (truncated when int). -
readAsInt
public abstract int readAsInt(int offset) Reads given element and returns it as int (truncated if double). -
writeAsInt
public abstract void writeAsInt(int offset, int d) Writes given element as int. The int is cast to the internal representation. -
readAsInt64
public abstract long readAsInt64(int offset) Reads given element and returns it as int (truncated if double). -
writeAsInt64
public abstract void writeAsInt64(int offset, long d) Writes given element as int. The int is cast to the internal representation. -
resize
public abstract void resize(int newSize, double defaultValue) Resizes the AttributeStream to the new size. -
resize
public abstract void resize(int newSize) Resizes the AttributeStream to the new size. -
resizePreserveCapacity
public abstract void resizePreserveCapacity(int newSize) Resizes the AttributeStream to the new size. Does not change the capacity of the stream. -
clear
void clear(boolean bFreeMemory) Same as resize(0) -
addRange
public abstract void addRange(AttributeStreamBase src, int srcStart, int count, boolean bForward, int stride) Adds a range of elements from the source stream. The streams must be of the same type.- Parameters:
src
- The source stream to read elements from.srcStart
- The index of the element in the source stream to start reading from.count
- The number of elements to add.bForward
- True if adding the elements in order of the incoming source stream. False if adding the elements in reverse.stride
- The number of elements to be grouped together if adding the elements in reverse.
-
insertRange
public abstract void insertRange(int start, AttributeStreamBase src, int srcStart, int count, boolean bForward, int stride, int validSize) Inserts a range of elements from the source stream. The streams must be of the same type.- Parameters:
start
- The index where to start the insert.src
- The source stream to read elements from.srcStart
- The index of the element in the source stream to start reading from.count
- The number of elements to read from the source stream.validSize
- The number of valid elements in this stream.
-
insertRange
public abstract void insertRange(int start, double value, int count, int validSize) Inserts a range of elements of the given value.- Parameters:
start
- The index where to start the insert.value
- The value to be inserted.count
- The number of elements to be inserted.validSize
- The number of valid elements in this stream.
-
insertAttributes
Inserts the attributes of a given semantics from a Point geometry.- Parameters:
start
- The index where to start the insert.pt
- The Point geometry holding the attributes to be inserted.semantics
- The attribute semantics that are being inserted.validSize
- The number of valid elements in this stream.
-
setRange
public abstract void setRange(double value, int start, int count) Sets a range of values to given value.- Parameters:
value
- The value to set stream elements to.start
- The index of the element to start writing to.count
- The number of elements to set.
-
writeRange
public abstract void writeRange(int startElement, int count, AttributeStreamBase src, int sourceStart, boolean bForward, int stride) Adds a range of elements from the source byte buffer. This stream is resized automatically to accomodate required number of elements.- Parameters:
startElement
- the index of the element in this stream to start setting elements from.count
- The number of AttributeStream elements to read.src
- The source ByteBuffer to read elements from.sourceStart
- The offset from the start of the ByteBuffer in bytes.bForward
- When False, the source is written in reversed order.stride
- Used for reversed writing only to indicate the unit of writing. elements inside a stride are not reversed. Only the strides are reversed.
-
writeRange
public abstract void writeRange(int startElement, int count, ByteBuffer src, int offsetBytes, boolean bForward) Adds a range of elements from the source byte buffer. The stream is resized automatically to accomodate required number of elements.- Parameters:
startElement
- the index of the element in this stream to start setting elements from.count
- The number of AttributeStream elements to read.src
- The source ByteBuffer to read elements from.offsetBytes
- The offset from the start of the ByteBuffer in bytes.
-
readRange
public abstract void readRange(int srcStart, int count, ByteBuffer dst, int dstOffsetBytes, boolean bForward) Write a range of elements to the source byte buffer.- Parameters:
srcStart
- The element index to start writing from.count
- The number of AttributeStream elements to write.dst
- The destination ByteBuffer. The buffer must be large enough or it will throw.dstOffsetBytes
- The offset in the destination ByteBuffer to start write elements from.
-
eraseRange
public abstract void eraseRange(int index, int count, int validSize) Erases a range from the buffer and defragments the result.- Parameters:
index
- The index in this stream where the erasing starts.count
- The number of elements to be erased.validSize
- The number of valid elements in this stream.
-
reverseRange
public abstract void reverseRange(int index, int count, int stride) Reverses a range from the buffer.- Parameters:
index
- The index in this stream where the reversing starts.count
- The number of elements to be reversed.stride
- The number of elements to be grouped together when doing the reverse.
-
createByteStream
Creates a new attribute stream for storing bytes.- Parameters:
size
- The number of elements in the stream.
-
createByteStream
Creates a new attribute stream for storing bytes.- Parameters:
size
- The number of elements in the stream.defaultValue
- The default value to fill the stream with.
-
createDoubleStream
Creates a new attribute stream for storing doubles.- Parameters:
size
- The number of elements in the stream.
-
createDoubleStream
Creates a new attribute stream for storing doubles.- Parameters:
size
- The number of elements in the stream.defaultValue
- The default value to fill the stream with.
-
restrictedClone
Creats a copy of the stream that contains upto maxsize elements. -
setReadonly
public void setReadonly()Makes the stream to be readonly. Any operation that changes the content or size of the stream will throw. -
isReadonly
public boolean isReadonly() -
lockSize
public void lockSize()Lock the size of the stream. Any operation that changes the size of the stream will throw. -
isLockedSize
public boolean isLockedSize() -
createAttributeStreamWithPersistence
Creates a new attribute stream of given persistence type and size.- Parameters:
persistence
- The persistence type of the stream (see VertexDescription).size
- The number of elements (floats, doubles, or 32 bit integers) of the given type in the stream.
-
createAttributeStreamWithPersistence
public static AttributeStreamBase createAttributeStreamWithPersistence(int persistence, int size, double defaultValue) Creates a new attribute stream of given persistence type and size.- Parameters:
persistence
- The persistence type of the stream (see VertexDescription).size
- The number of elements (floats, doubles, or 32 bit integers) of the given type in the stream.defaultValue
- The default value to fill the stream with.
-
createAttributeStreamWithSemantics
public static AttributeStreamBase createAttributeStreamWithSemantics(int semantics, int vertexCount) Creates a new attribute stream for the given semantics and vertex count.- Parameters:
semantics
- The semantics of the attribute (see VertexDescription).vertexCount
- The number of vertices in the geometry. The actual number of elements in the stream is vertexCount * ncomponents.
-
createIndexStream
Creates a new attribute stream for storing vertex indices.- Parameters:
size
- The number of elements in the stream.
-
createIndexStream
Creates a new attribute stream for storing vertex indices.- Parameters:
size
- The number of elements in the stream.defaultValue
- The default value to fill the stream with.
-
calculateHashImpl
public abstract int calculateHashImpl(int hashCode, int start, int end) -
equals
-