| JGL - The Generic Collection Library for Java |
All Packages Class Hierarchy This Package Previous Next Index
Class com.objectspace.jgl.adapters.VectorArray
java.lang.Object
|
+----com.objectspace.jgl.adapters.ArrayAdapter
|
+----com.objectspace.jgl.adapters.VectorArray
- public class VectorArray
- extends ArrayAdapter
VectorArray allows a java.util.Vector to be accessed like a Container.
It is particularly useful for applying generic algorithms such as
Sorting.sort() to a java.util.Vector.
- See Also:
- Vector
-
VectorArray()
- Construct myself to refer to an empty array.
-
VectorArray(Vector)
- Construct myself to refer to a java.util.Vector.
-
VectorArray(VectorArray)
- Construct myself to refer to an existing VectorArray.
-
add(Object)
- Add an object to myself.
-
at(int)
- Return the object at the specified index.
-
begin()
- Return an iterator positioned at my first item.
-
clear()
- Remove all of my objects.
-
clone()
- Return a shallow copy of myself.
-
elements()
- Return an Enumeration of my elements.
-
end()
- Return an iterator positioned immediately after my last item.
-
equals(Object)
- Return true if I'm equal to a specified object.
-
finish()
- Return an iterator positioned immediately after my last item.
-
get()
- Retrieve the underlying Vector.
-
maxSize()
- Return the maximum number of objects that I can contain.
-
popBack()
- Remove and return my last element.
-
popFront()
- Remove and return my first element.
-
pushBack(Object)
- Add an object at my end.
-
pushFront(Object)
- Insert an object in front of my first element.
-
put(int, Object)
- Set the object at a specified index.
-
remove(int, int, Object)
- Remove all elements within a specified range that match a particular object
and return the number of objects that were removed.
-
remove(Object)
- Remove all elements that match a specified object and return the number of
objects that were removed.
-
remove(Object, int)
- Remove at most a given number of elements that match a specified object and return the number of
objects that were removed.
-
size()
- Return the number of objects that I contain.
-
start()
- Return an iterator positioned at my first item.
-
toString()
- Return a string that describes me.
VectorArray
public VectorArray()
- Construct myself to refer to an empty array.
VectorArray
public VectorArray(Vector vector)
- Construct myself to refer to a java.util.Vector.
- Parameters:
- array - The Vector to ape.
VectorArray
public VectorArray(VectorArray vector)
- Construct myself to refer to an existing VectorArray.
- Parameters:
- array - The VectorArray to copy.
clone
public synchronized Object clone()
- Return a shallow copy of myself.
- Overrides:
- clone in class ArrayAdapter
toString
public synchronized String toString()
- Return a string that describes me.
- Overrides:
- toString in class Object
equals
public boolean equals(Object object)
- Return true if I'm equal to a specified object.
- Parameters:
- object - The object to compare myself against.
- Returns:
- true if I'm equal to the specified object.
- Overrides:
- equals in class ArrayAdapter
get
public Vector get()
- Retrieve the underlying Vector.
size
public int size()
- Return the number of objects that I contain.
maxSize
public int maxSize()
- Return the maximum number of objects that I can contain.
- Overrides:
- maxSize in class ArrayAdapter
elements
public Enumeration elements()
- Return an Enumeration of my elements.
start
public ForwardIterator start()
- Return an iterator positioned at my first item.
begin
public synchronized VectorIterator begin()
- Return an iterator positioned at my first item.
finish
public ForwardIterator finish()
- Return an iterator positioned immediately after my last item.
end
public synchronized VectorIterator end()
- Return an iterator positioned immediately after my last item.
at
public synchronized Object at(int index)
- Return the object at the specified index.
- Parameters:
- index - The index.
put
public synchronized void put(int index,
Object object)
- Set the object at a specified index. The object must be a Integer
- Parameters:
- index - The index.
- object - The object to place at the specified index.
- Throws: IndexOutOfBoundsException
- if index is not in range.
clear
public void clear()
- Remove all of my objects.
- Overrides:
- clear in class ArrayAdapter
add
public synchronized Object add(Object object)
- Add an object to myself.
- Overrides:
- add in class ArrayAdapter
pushFront
public synchronized void pushFront(Object object)
- Insert an object in front of my first element.
- Parameters:
- object - The object to insert.
- Overrides:
- pushFront in class ArrayAdapter
popFront
public synchronized Object popFront()
- Remove and return my first element.
- Overrides:
- popFront in class ArrayAdapter
pushBack
public void pushBack(Object object)
- Add an object at my end.
- Parameters:
- object - The object to add.
- Overrides:
- pushBack in class ArrayAdapter
popBack
public synchronized Object popBack()
- Remove and return my last element.
- Overrides:
- popBack in class ArrayAdapter
remove
public synchronized int remove(Object object)
- Remove all elements that match a specified object and return the number of
objects that were removed.
- Parameters:
- object - The object to remove.
- Returns:
- The number of objects removed.
- Overrides:
- remove in class ArrayAdapter
remove
public synchronized int remove(Object object,
int count)
- Remove at most a given number of elements that match a specified object and return the number of
objects that were removed.
- Parameters:
- object - The object to remove.
- count - The maximum number of objects to remove.
- Returns:
- The number of objects removed.
- Overrides:
- remove in class ArrayAdapter
remove
public synchronized int remove(int first,
int last,
Object object)
- Remove all elements within a specified range that match a particular object
and return the number of objects that were removed.
- Parameters:
- first - The index of the first object to remove.
- last - The index of the last object to remove.
- object - The object to remove.
- Returns:
- The number of objects removed.
- Throws: IndexOutOfBoundsException
- If either index is invalid.
- Overrides:
- remove in class ArrayAdapter
All Packages Class Hierarchy This Package Previous Next Index