public final class XDateSequence extends Object implements XDateIterator
An XDateSequence stores a set of bytes in native memory. Its views
the stored bytes as a sequence of dates and provides methods to read and
modify these values.
To use an instance of this class, the user first needs to initialize the instance by wrapping it around a memory region containing the serialized date sequence. This is done using one of the wrap() or setFrom() methods. Once the instance has been initialized, the user can use the data accessor and modification methods to access and/or modify the the sequence managed by this class.
| Modifier and Type | Method and Description |
|---|---|
static XDateSequence |
create()
Create a new date sequence reader
|
int |
getTo(byte[] val,
int offset)
Copy the serialized date sequence to a byte array object
|
int |
getTo(Date[] val,
int offset)
Copy the serialized date sequence to a date array object
|
int |
getTo(long[] val,
int offset)
Copy the serialized date sequence to a long array object
|
int |
getTo(long addr,
int offset)
Copy the serialized date sequence to a native memory region
|
int |
getTo(com.neeve.quark.QuarkBuffer val,
int offset)
Copy the serialized date sequence to a
QuarkBuffer |
boolean |
hasNext()
Implementation of
Iterator.hasNext() |
boolean |
isInitialized()
Get if the sequence has been initialized or nor
|
boolean |
isOwned()
Get if the sequence was initialized by copying or wrapping
|
XDateIterator |
iterator()
Get an iterator to iterate over a date sequence values
|
Date |
next()
Implementation of
Iterator.next() |
long |
nextAsTimestamp()
Implementation of
XDateIterator.nextAsTimestamp() |
int |
numElements()
Get the number of elements in a date sequence
|
void |
remove()
Implementation of
Iterator.remove() |
XDateSequence |
reset()
Reset a date sequence
|
int |
serializedLength()
Get the serialized length of a date sequence
|
XDateSequence |
setFrom(long addr,
int offset,
int len)
Initialize a sequence by copying a date sequence serialized in a native memory region to a private backing store
|
XDateSequence |
setFrom(com.neeve.quark.QuarkBuffer buffer,
int offset,
int len)
Initialize a sequence by copying a date sequence serialized in a
QuarkBuffer |
XDateSequence |
setFrom(XDateIterator iterator)
Initialize a sequence by copying a date sequence using a
XDateIterator |
XDateSequence |
setFrom(XDateSequence sequence)
Initialize a sequence by copying a date sequence from a
XDateSequence |
XDateIterator |
toFirst()
Implementation of
XIterator.toFirst() |
XDateSequence |
wrap(long addr,
int offset,
int len)
Initialize a sequence by wrapping it around a date sequence serialized in a native memory region
|
XDateSequence |
wrap(com.neeve.quark.QuarkBuffer buffer,
int offset,
int len)
Initialize a sequence by wrapping it around a date sequence serialized in a
QuarkBuffer |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic static final XDateSequence create()
public final boolean isInitialized()
public final boolean isOwned()
public XDateIterator toFirst()
XIterator.toFirst()toFirst in interface XIterator<Date>IllegalStateException - Thrown if the sequence has not been initialized via a wrap() or setFrom methodpublic final boolean hasNext()
Iterator.hasNext()hasNext in interface Iterator<Date>IllegalStateException - Thrown if the sequence has not been initialized via a wrap() or setFrom methodpublic final Date next()
Iterator.next()next in interface Iterator<Date>IllegalStateException - Thrown if the sequence has not been initialized via a wrap() or setFrom methodpublic final long nextAsTimestamp()
XDateIterator.nextAsTimestamp()nextAsTimestamp in interface XDateIteratorpublic final void remove()
Iterator.remove()public final XDateSequence wrap(long addr, int offset, int len)
addr - The address of the memory region containing the serialized date sequenceoffset - The offset from the start of the memory region where the serialized sequence is storedlen - The length of the serialized date sequence
This method initializes a sequence's backing data pointers to a native memory region containing
the serialized date sequence. This method does not make a copy of the serialized sequence.
Therefore, the user must ensure that the source is not modified or freed as long as the sequence
is in active use or reset() is invoked.
This method can be invoked repeatedly with different backing stores. Each invocation resets all internal markers.
This method implictly invokes reset() as part of its processing
public final XDateSequence wrap(com.neeve.quark.QuarkBuffer buffer, int offset, int len)
QuarkBufferbuffer - The buffer containing the serialized date sequenceoffset - The offset into the buffer where the serialized date sequence is storedlen - The length of the serialized date sequence
This method initializes a sequence's backing data pointers to the section of a QuarkBuffer
containing the serialized date sequence. This method does not make a copy of the serialized
sequence. Therefore, the user must ensure that the source is not modified or freed as long as the
sequence is in active use or reset() is invoked.
This method can be invoked repeatedly with different backing stores. Each invocation resets all internal markers.
This method implictly invokes reset() as part of its processing
public final XDateSequence setFrom(long addr, int offset, int len)
addr - The address of the memory region containing the serialized date sequenceoffset - The offset from the start of the memory region where the serialized sequence is storedlen - The length of the serialized date sequence
This method initializes a sequence by copying a date sequence serialized in a native memory region
to a backing store that is private to the sequence object. Once done with using the sequence instance,
the user must invoke reset() to release the resources held by the backing store or release the
sequence object to the garbage collector in which case the backing store resources will be released
when the object is collected by the garbage collector.
This method can be invoked repeatedly with different backing stores. Each invocation invokes
reset() and performs a fresh initialization of the backing store.
public final XDateSequence setFrom(com.neeve.quark.QuarkBuffer buffer, int offset, int len)
QuarkBufferbuffer - The buffer containing the serialized date sequenceoffset - The offset into the buffer where the serialized date sequence is storedlen - The length of the serialized date sequence
This method initializes a sequence by copying a date sequence serialized in a QuarkBuffer
to a backing store that is private to the sequence object. Once done with using the sequence instance,
the user must invoke reset() to release the resources held by the backing store or release the
sequence object to the garbage collector in which case the backing store resources will be released
when the object is collected by the garbage collector.
This method can be invoked repeatedly with different backing stores. Each invocation invokes
reset() and performs a fresh initialization of the backing store.
public final XDateSequence setFrom(XDateSequence sequence)
XDateSequenceiterator - The source sequence
This method initializes a sequence by copying a date sequence from a XDateSequence
to a backing store that is private to the sequence object. Once done with using the sequence instance,
the user must invoke reset() to release the resources held by the backing store or release
the sequence object to the garbage collector in which case the backing store resources will be released
when the object is collected by the garbage collector.
This method can be invoked repeatedly with different backing stores. Each invocation invokes
reset() and performs a fresh initialization of the backing store.
public final XDateSequence setFrom(XDateIterator iterator)
XDateIteratoriterator - The iterator to use to access the sequence
This method initializes a sequence by copying a date sequence using a XDateIterator
to a backing store that is private to the sequence object. Once done with using the sequence instance,
the user must invoke reset() to release the resources held by the backing store or release
the sequence object to the garbage collector in which case the backing store resources will be released
when the object is collected by the garbage collector.
This method can be invoked repeatedly with different backing stores. Each invocation invokes
reset() and performs a fresh initialization of the backing store.
public final int numElements()
IllegalStateException - Thrown if the sequence has not been initialized via a wrap() or setFrom methodpublic final int serializedLength()
IllegalStateException - Thrown if the sequence has not been initialized via a wrap() or setFrom methodpublic final int getTo(Date[] val, int offset)
val - The destination array object to copy tooffset - The offset into the destination array to copy toIllegalStateException - Thrown if the sequence has not been initialized via a wrap() or setFrom methodpublic final int getTo(long[] val,
int offset)
val - The destination array object to copy tooffset - The offset into the destination array to copy toIllegalStateException - Thrown if the sequence has not been initialized via a wrap() or setFrom methodpublic final int getTo(byte[] val,
int offset)
val - The destination array object to copy tooffset - The offset into the destination array to copy toIllegalStateException - Thrown if the sequence has not been initialized via a wrap() or setFrom methodpublic final int getTo(long addr,
int offset)
addr - The destination memory region to copy tooffset - The offset into memory region to copy toIllegalStateException - Thrown if the sequence has not been initialized via a wrap() or setFrom methodpublic final int getTo(com.neeve.quark.QuarkBuffer val,
int offset)
QuarkBufferval - The destination buffer to copy tooffset - The offset into buffer to copy toIllegalStateException - Thrown if the sequence has not been initialized via a wrap() or setFrom methodpublic final XDateIterator iterator()
IllegalStateException - Thrown if the sequence has not been initialized via a wrap() or setFrom methodpublic final XDateSequence reset()
This method resets a date sequence. It releases all resources used by the sequence's private backing store
Copyright © 2019 Neeve Research, LLC. All Rights Reserved.