[marf-cvs] marf/src/marf/util FreeVector.java,1.6,1.7
Brought to you by:
mokhov
From: Serguei A. M. <mo...@us...> - 2005-03-21 00:58:54
|
Update of /cvsroot/marf/marf/src/marf/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11810/src/marf/util Modified Files: FreeVector.java Log Message: Document all of the FreeVector with javadocs. Add all parent's constructors. Fix a few typos. Add TODOs. Index: FreeVector.java =================================================================== RCS file: /cvsroot/marf/marf/src/marf/util/FreeVector.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FreeVector.java 27 Feb 2005 18:18:33 -0000 1.6 --- FreeVector.java 21 Mar 2005 00:58:44 -0000 1.7 *************** *** 11,15 **** * will be automaticall adjusted as appropriate.</p> * ! * <p>Useful in the applications where desireble vector's grows by setting an element * beyond its upper boundary automatticaly lengthens the vector to accomondate the * change (similar to Perl arrays).</p> --- 11,15 ---- * will be automaticall adjusted as appropriate.</p> * ! * <p>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).</p> *************** *** 19,22 **** --- 19,24 ---- * in length.</p> * + * TODO: allow negative index boundaries. + * * @author Serguei Mokhov, <mailto:mo...@cs...> * @since 0.3.0 *************** *** 24,33 **** public class FreeVector extends Vector { ! /* public FreeVector() { super(); } - */ public Object elementAt(int piIndex) { --- 26,74 ---- public class FreeVector extends Vector { ! /** ! * A free vector with default capacity as specified by java.util.Vector. ! */ ! public FreeVector() { super(); } + /** + * Constructs this vector given capacity other than default. + * Inherited from java.util.Vector. + * @param piInitialCapacity initial element capacity (number of object placeholders) + */ + public FreeVector(int piInitialCapacity) + { + super(piInitialCapacity); + } + + /** + * Constructs this vector given capacity and its increment. + * Inherited from java.util.Vector. + * @param piInitialCapacity initial element capacity (number of object placeholders) + * @param piCapacityIncrement when current capacity reached, until how much capacity should be extened + */ + public FreeVector(int piInitialCapacity, int piCapacityIncrement) + { + super(piInitialCapacity, piCapacityIncrement); + } + + /** + * Constructs this vector out of a collection. + * Inherited from java.util.Vector. + * @param poCollection collection for the vector elements. + */ + public FreeVector(Collection poCollection) + { + super(poCollection); + } + + /** + * Access an element of the vector given index. + * Overridden from java.util.Vector. + * @param piIndex vector element index to retrieve + * @return object cotained at specified index, null if beyond boundary + */ public Object elementAt(int piIndex) { *************** *** 38,41 **** --- 79,91 ---- } + /** + * Set an element of the vector given index. + * Capacity is always ensured to be able to accomodate + * any positive inidex (barring out of memory problems). + * Overridden from java.util.Vector. + * + * @param poElement element to set at the index + * @param piIndex the index + */ public void setElementAt(Object poElement, int piIndex) { *************** *** 44,47 **** --- 94,106 ---- } + /** + * Inserts an element of the vector after given index. + * Capacity is always ensured to be able to accomodate + * any positive inidex (barring out of memory problems). + * Overridden from java.util.Vector. + * + * @param poElement element to set after the index + * @param piIndex the index + */ public void insertElementAt(Object poElement, int piIndex) { *************** *** 50,53 **** --- 109,120 ---- } + /** + * Make sure the capacity of the vector is enough + * to hold an element with the specified index. + * Has effect only if the index is greater than + * the current vector's size. + * + * @param piIndex the index to accomodate + */ public void ensureIndexCapacity(int piIndex) { *************** *** 59,62 **** --- 126,135 ---- } + /** + * Access an element of the vector given index. + * Overridden from java.util.Vector. Calls the overridden elementAt(). + * @param piIndex vector element index to retrieve + * @return object cotained at specified index, null if beyond boundary + */ public Object get(int piIndex) { *************** *** 64,67 **** --- 137,150 ---- } + /** + * Set an element of the vector given index. + * Capacity is always ensured to be able to accomodate + * any positive inidex (barring out of memory problems). + * Overridden from java.util.Vector. + * + * @param poElement element to set at the index + * @param piIndex the index + * @return object that was previously at that index. + */ public Object set(int piIndex, Object poElement) { *************** *** 71,74 **** --- 154,163 ---- } + /** + * Adds an element of the vector at the specified index. + * Overridden from java.util.Vector. Calls the overridden insertElementAt(). + * @param piIndex the index + * @param poElement element to set after the index + */ public void add(int piIndex, Object poElement) { *************** *** 76,79 **** --- 165,175 ---- } + /** + * Removes an element at index. + * If the index is beyond the upper boundary, returns null. + * Overrides java.util.Vector. + * @param piIndex index of the element to be removed + * @return object reference of the element just removed; null if index exceeds the upper bound + */ public Object remove(int piIndex) { *************** *** 90,93 **** --- 186,196 ---- } + /** + * Adds a collection of elements to this vector starting at given index. + * Makes sure the capacity of the current vector reaches the piIndex. + * Overrides java.util.Vector. + * @param piIndex starting index to add elements from + * @param poCollection collection of elements to add + */ public boolean addAll(int piIndex, Collection poCollection) { *************** *** 96,99 **** --- 199,209 ---- } + /** + * Retrieves a sublist subset of vector elements given index boundaries. + * Makes sure the capacity of the current vector reaches the piToIndex. + * Overrides java.util.Vector. + * @param piFromIndex starting index to fetch elements from + * @param piToIndex last index to fetch elements to + */ public List subList(int piFromIndex, int piToIndex) { *************** *** 102,108 **** } public void removeRange(int piFromIndex, int piToIndex) { ! } } --- 212,226 ---- } + /** + * Not implemented. + * Meant to remove a set of elements between two specified indices. + * @param piFromIndex starting index to remove elements from + * @param piToIndex last index to remove elements to + * @throws NotImplementedException + */ public void removeRange(int piFromIndex, int piToIndex) { ! // TODO: implement ! throw new NotImplementedException(this.getClass().getName() + ".removeRange()"); } } |