|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | 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(InputBuffer buffer)
|
|
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 |
clear()
Removes all of the elements from this Vector. |
Object |
clone()
Create an exact copy of this hash |
boolean |
contains(QuickSerializable elem)
Tests if the specified QuickSerializable object
is a component in this vector. |
Object |
elementAt(int index)
Returns the component at the specified index. |
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. |
void |
serialize(OutputBuffer buffer)
Add the object to the buffer. |
QuickSerializable |
set(int index,
QuickSerializable object)
Insert the specified object at the specified index. |
int |
size()
Return the number of elements in this QSVector |
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. |
| Methods inherited from class java.lang.Object |
|---|
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 array
array - The array whose contents to add
public QSVector(InputBuffer buffer)
throws QSException
| Method Detail |
public void serialize(OutputBuffer buffer)
QuickSerializablebuffer.
serialize in interface QuickSerializablebuffer - the output buffer to add the object to
public Object clone()
throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedException - if clone() is not supportedpublic 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 QuickSerializables 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 Object elementAt(int index)
This method is identical in functionality to the get method (which is part of the List interface).
index - an index into this vector.
ArrayIndexOutOfBoundsException - if the index
is negative or not less than the current size of this
Vector object.
given.get(int),
List
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()
clear()public boolean contains(QuickSerializable elem)
QuickSerializable object
is a component in this vector.
elem - a QuickSerializable object
true if and only if the specified object is
the same as a component of this vector, as determined by the equals
method, false otherwise.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 ObjectQSVectorpublic boolean equals(Object o)
QSVector to another Object.
equals in class Objecttrue iff the other Object is also a
QSVector and contains equal elements.public void clear()
public String toString()
QSVector,
which includes all the elements.
toString in class ObjectString representation of this
QSVector.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||