|
|||||||||||
| 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
Adaptive extension of the java.util.Vector class.
You may access elements of a Vector beyond it's initial length --- the Vector will be automaticall adjusted as appropriate.
Useful in the applications where desirable vector's growth by setting an element beyond its upper boundary automatticaly lengthens the vector to accomondate 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.9 2005/06/01 19:38:50 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 |
getRevision()
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 extenedpublic 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.VectorpiIndex - vector element index to retrieve
public void setElementAt(java.lang.Object poElement,
int piIndex)
setElementAt in class java.util.VectorpoElement - element to set at the indexpiIndex - the index
public void insertElementAt(java.lang.Object poElement,
int piIndex)
insertElementAt in class java.util.VectorpoElement - element to set after the indexpiIndex - the indexpublic void ensureIndexCapacity(int piIndex)
piIndex - the index to accomodatepublic java.lang.Object get(int piIndex)
get in interface java.util.Listget in class java.util.VectorpiIndex - vector element index to retrieve
public java.lang.Object set(int piIndex,
java.lang.Object poElement)
set in interface java.util.Listset in class java.util.VectorpoElement - element to set at the indexpiIndex - the index
public void add(int piIndex,
java.lang.Object poElement)
add in interface java.util.Listadd in class java.util.VectorpiIndex - the indexpoElement - element to set after the indexpublic java.lang.Object remove(int piIndex)
remove in interface java.util.Listremove in class java.util.VectorpiIndex - index of the element to be removed
public boolean addAll(int piIndex,
java.util.Collection poCollection)
addAll in interface java.util.ListaddAll in class java.util.VectorpiIndex - starting index to add elements frompoCollection - collection of elements to add
true if the vector has changed
public java.util.List subList(int piFromIndex,
int piToIndex)
subList in interface java.util.ListsubList in class java.util.VectorpiFromIndex - starting index to fetch elements frompiToIndex - last index to fetch elements to
public void removeRange(int piFromIndex,
int piToIndex)
removeRange in class java.util.VectorpiFromIndex - starting index to remove elements frompiToIndex - last index to remove elements to
NotImplementedExceptionpublic static java.lang.String getRevision()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||