|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ostore.util.QSVector
A QSVector
is a cousin of java.lang.Vector
which
implements ostore.util.QuickSerializable
. All elements of the
QSVector
must also be QuickSerializable
.
Most of the functionality from the Vector
has not been
ported. If you require the use of a missing method, implement it.
Field Summary | |
protected int |
capacityIncrement
The number of elements by which to grow the storage array when necessary. |
static int |
DEFAULT_CAPACITY
|
protected int |
elementCount
The number of elements currently in the QSVector . |
protected QuickSerializable[] |
elementData
The array of objects stored in this QSVector . |
Constructor Summary | |
QSVector()
Constructs a small QSVector . |
|
QSVector(byte[] data,
int[] offset)
Constructs a QSVector from its
QuickSerializable form. |
|
QSVector(int initial_capacity)
Constructs a QSVector of the specified capacity. |
|
QSVector(int initial_capacity,
int capacity_increment)
Constructs a QSVector of the specified capacity and
capacity increment. |
|
QSVector(QuickSerializable[] array)
Constructs a QSVector containing the contents of the
specified array |
Method Summary | |
boolean |
add(int index,
QuickSerializable object)
Append the specified object to the QSVector at index
index , shifting up the objects following the index, if any. |
boolean |
add(QuickSerializable object)
Append the specified object to the QSVector . |
boolean |
add(QuickSerializable[] objects)
Append the specified objects, in order, to the QSVector . |
void |
ensureCapacity(int size)
Grow the storage array if necessary. |
boolean |
equals(Object o)
Compare this QSVector to another Object . |
QuickSerializable |
get(int index)
Return the object at the specified index. |
int |
hashCode()
Return a hashcode, generated as in java.util.Vector , which
was in turn specified by java.util.List . |
QuickSerializable |
remove(int index)
Remove the object at the specified index. |
void |
removeAllElements()
Remove all elements. |
void |
removeRange(int from,
int to)
Remove a range of elements. |
QuickSerializable |
set(int index,
QuickSerializable object)
Insert the specified object at the specified index. |
int |
size()
Return the number of elements in this QSVector |
void |
to_bytes(byte[] data,
int[] offset)
Store the object in its "on the wire" form in the byte array data , starting at index offset [0] , and
increment offset [0] by the number of bytes written;
if data == null , increment offset [0] by
the number of bytes that would have been written otherwise. |
QuickSerializable[] |
toArray()
Returns the elements of this QSVector as an array. |
String |
toString()
Produce a human-readable version of this QSVector ,
which includes all the elements. |
int |
type_code()
Returns the unique integer associated with this class in the TypeTable . |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int DEFAULT_CAPACITY
protected QuickSerializable[] elementData
QSVector
. All must by
QuickSerializable
.protected int elementCount
QSVector
.protected int capacityIncrement
Constructor Detail |
public QSVector(int initial_capacity, int capacity_increment)
QSVector
of the specified capacity and
capacity increment.initial_capacity
- The initial size for the storage array.capacity_increment
- The number of elements by which to
increase the storage array when necessary.public QSVector(int initial_capacity)
QSVector
of the specified capacity.initial_capacity
- The initial size for the storage array.public QSVector()
QSVector
.public QSVector(QuickSerializable[] array)
QSVector
containing the contents of the
specified arrayarray
- The array whose contents to addpublic QSVector(byte[] data, int[] offset) throws QSException
QSVector
from its
QuickSerializable
form.Method Detail |
public void to_bytes(byte[] data, int[] offset)
QuickSerializable
data
, starting at index offset [0]
, and
increment offset [0]
by the number of bytes written;
if data == null
, increment offset [0]
by
the number of bytes that would have been written otherwise.to_bytes
in interface QuickSerializable
ostore.util.QuickSerializable
data
- The byte array to store into, or null
.offset
- A single element array whose first
element is the index in data to begin writing at on
function entry, and which on function exit has been
incremented by the number of bytes written.public int type_code()
QuickSerializable
TypeTable
.type_code
in interface QuickSerializable
ostore.util.QuickSerializable
public int size()
QSVector
public boolean add(QuickSerializable object)
QSVector
.object
- The QuickSerializable
to add.true
, just like Vector.add()
.public boolean add(int index, QuickSerializable object)
QSVector
at index
index
, shifting up the objects following the index, if any.object
- The QuickSerializable
to add.index
- The index at which to add the
QuickSerializable
. Must be valid.true
, just like Vector.add()
.ArrayIndexOutOfBoundsException
- if index is out of rangepublic boolean add(QuickSerializable[] objects)
QSVector
.objects
- The QuickSerializable
s to add.true
, just like Vector.add()
.public void ensureCapacity(int size)
size
- The minimum acceptable capacity for the storage array.public QuickSerializable set(int index, QuickSerializable object)
index
- the index for the element.QuickSerializable
object previously stored
at the specified index.public QuickSerializable get(int index)
index
- the index of the element to return.QuickSerializable
object, or
null
if index
is out of range.public QuickSerializable remove(int index)
index
- the index of the element to remove.QuickSerializable
object previously stored
at the specified index.public void removeRange(int from, int to)
from
- The index of the first element to remove.to
- The index after the last element to remove.public void removeAllElements()
public QuickSerializable[] toArray()
QSVector
as an array.
Useful for repeated iterations over the contents.this.size()
containing the
elements of this QSVector
in order.public int hashCode()
java.util.Vector
, which
was in turn specified by java.util.List
.hashCode
in class Object
QSVector
public boolean equals(Object o)
QSVector
to another Object
.equals
in class Object
true
iff the other Object
is also a
QSVector
and contains equal
elements.public String toString()
QSVector
,
which includes all the elements.toString
in class Object
String
representation of this
QSVector
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |