|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection java.util.AbstractList java.util.Vector marf.util.FreeVector
public class FreeVector
Adaptive extension of the java.util.Vector class.
You may access elements of a Vector beyond it's initial length --- the Vector will be automatically adjusted as appropriate.
Useful in the applications where desirable vector's growth by setting an element beyond its upper boundary automatically lengthens the vector to accommodate the change (similar to Perl arrays).
Similarly, getting an element beyond the upper boundary is not desirable failure, but an empty element returned. This makes the application to see as vector of a theoretically infinite in length.
TODO: allow negative index boundaries. $Id: FreeVector.java,v 1.13 2007/12/23 06:29:47 mokhov Exp $
Field Summary |
---|
Fields inherited from class java.util.Vector |
---|
capacityIncrement, elementCount, elementData |
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
FreeVector()
A free vector with default capacity as specified by java.util.Vector. |
|
FreeVector(java.util.Collection poCollection)
Constructs this vector out of a collection. |
|
FreeVector(int piInitialCapacity)
Constructs this vector given capacity other than default. |
|
FreeVector(int piInitialCapacity,
int piCapacityIncrement)
Constructs this vector given capacity and its increment. |
Method Summary | |
---|---|
void |
add(int piIndex,
java.lang.Object poElement)
Adds an element of the vector at the specified index. |
boolean |
addAll(int piIndex,
java.util.Collection poCollection)
Adds a collection of elements to this vector starting at given index. |
java.lang.Object |
elementAt(int piIndex)
Access an element of the vector given index. |
void |
ensureIndexCapacity(int piIndex)
Make sure the capacity of the vector is enough to hold an element with the specified index. |
java.lang.Object |
get(int piIndex)
Access an element of the vector given index. |
static java.lang.String |
getMARFSourceCodeRevision()
Retrieves class' revision. |
void |
insertElementAt(java.lang.Object poElement,
int piIndex)
Inserts an element of the vector after given index. |
java.lang.Object |
remove(int piIndex)
Removes an element at index. |
void |
removeRange(int piFromIndex,
int piToIndex)
Not implemented. |
java.lang.Object |
set(int piIndex,
java.lang.Object poElement)
Set an element of the vector given index. |
void |
setElementAt(java.lang.Object poElement,
int piIndex)
Set an element of the vector given index. |
java.util.List |
subList(int piFromIndex,
int piToIndex)
Retrieves a sublist subset of vector elements given index boundaries. |
Methods inherited from class java.util.Vector |
---|
add, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elements, ensureCapacity, equals, firstElement, hashCode, indexOf, indexOf, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, removeAll, removeAllElements, removeElement, removeElementAt, retainAll, setSize, size, toArray, toArray, toString, trimToSize |
Methods inherited from class java.util.AbstractList |
---|
iterator, listIterator, listIterator |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
iterator, listIterator, listIterator |
Constructor Detail |
---|
public FreeVector()
public FreeVector(int piInitialCapacity)
piInitialCapacity
- initial element capacity (number of object placeholders)public FreeVector(int piInitialCapacity, int piCapacityIncrement)
piInitialCapacity
- initial element capacity (number of object placeholders)piCapacityIncrement
- when current capacity reached, until how much capacity should be extendedpublic FreeVector(java.util.Collection poCollection)
poCollection
- collection for the vector elements.Method Detail |
---|
public java.lang.Object elementAt(int piIndex)
elementAt
in class java.util.Vector
piIndex
- vector element index to retrieve
public void setElementAt(java.lang.Object poElement, int piIndex)
setElementAt
in class java.util.Vector
poElement
- element to set at the indexpiIndex
- the indexpublic void insertElementAt(java.lang.Object poElement, int piIndex)
insertElementAt
in class java.util.Vector
poElement
- element to set after the indexpiIndex
- the indexpublic void ensureIndexCapacity(int piIndex)
piIndex
- the index to accommodatepublic java.lang.Object get(int piIndex)
get
in interface java.util.List
get
in class java.util.Vector
piIndex
- vector element index to retrieve
public java.lang.Object set(int piIndex, java.lang.Object poElement)
set
in interface java.util.List
set
in class java.util.Vector
poElement
- element to set at the indexpiIndex
- the index
public void add(int piIndex, java.lang.Object poElement)
add
in interface java.util.List
add
in class java.util.Vector
piIndex
- the indexpoElement
- element to set after the indexpublic java.lang.Object remove(int piIndex)
remove
in interface java.util.List
remove
in class java.util.Vector
piIndex
- index of the element to be removed
public boolean addAll(int piIndex, java.util.Collection poCollection)
addAll
in interface java.util.List
addAll
in class java.util.Vector
piIndex
- starting index to add elements frompoCollection
- collection of elements to add
true
if the vector has changedpublic java.util.List subList(int piFromIndex, int piToIndex)
subList
in interface java.util.List
subList
in class java.util.Vector
piFromIndex
- starting index to fetch elements frompiToIndex
- last index to fetch elements to
public void removeRange(int piFromIndex, int piToIndex)
removeRange
in class java.util.Vector
piFromIndex
- starting index to remove elements frompiToIndex
- last index to remove elements to
NotImplementedException
public static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |