All Packages Class Hierarchy This Package Previous Next Index
Class COM.taligent.util.IntegerVector
java.lang.Object
|
+----COM.taligent.util.IntegerVector
- public class IntegerVector
- extends Object
- implements Cloneable, Serializable
A Vector-like class that stores primitive int types instead of
Objects for performance reasons.
- Version:
- 1.0
- Author:
- Andy Clark, Taligent Inc.
-
DEFAULT_CAPACITY
- Default initial size (100).
-
DEFAULT_INCREMENT
- Default increment size (50).
-
IntegerVector()
- Constructs an empty vector.
-
IntegerVector(int)
- Constructs an empty vector with the specified initial capacity.
-
IntegerVector(int, int)
- Constructs an empty vector with the specified initial capacity
and capacity increment.
-
IntegerVector(IntegerVector)
- Copy constructor.
-
addElement(int)
- Adds the specified component to the end of this vector,
increasing its size by one.
-
capacity()
- Resizes the
/**
Returns the current capacity of this vector.
-
clone()
- Returns a clone of this vector.
-
contains(int)
- Tests if the specified object is a component in this vector.
-
copyInto(int[])
- Copies the components of this vector into the specified array.
-
elementAt(int)
- Returns the component at the specified index.
-
elements()
- Returns an enumeration of the components of this vector as
Integer objects.
-
ensureCapacity(int)
- Increases the capacity of this vector, if necessary, to ensure
that it can hold at least the number of components specified by
the minimum capacity argument.
-
firstElement()
- Returns the first component of this vector, or -1 if there are
no elements.
-
indexOf(int)
- Searches for the first occurence of the given argument, testing
for equality using the equality operator.
-
indexOf(int, int)
- Searches for the first occurence of the given argument, beginning
the search at index, and testing for equality using the equality
operator.
-
insertElementAt(int, int)
- Inserts the specified object as a component in this vector at the
specified index.
-
isEmpty()
- Tests if this vector has no components.
-
lastElement()
- Returns the last component of the vector, or -1 if there are
no elements in the vector.
-
lastIndexOf(int)
- Returns the index of the last occurrence of the specified object
in this vector, or -1 if the element is not found.
-
lastIndexOf(int, int)
- Searches backwards for the specified object, starting from the
specified index, and returns an index to it.
-
removeAllElements()
- Removes all components from this vector and sets its size to zero.
-
removeElement(int)
- Removes the first occurrence of the argument from this vector.
-
removeElementAt(int)
- Deletes the component at the specified index.
-
setElementAt(int, int)
- Sets the component at the specified index of this vector to be
the specified object.
-
setSize(int)
- Sets the size of this vector.
-
size()
- Returns the number of components in this vector.
-
toString()
- Returns a string representation of this vector.
-
trimToSize()
- Trims the capacity of this vector to be the vector's current
size.
DEFAULT_CAPACITY
public static final int DEFAULT_CAPACITY
- Default initial size (100).
DEFAULT_INCREMENT
public static final int DEFAULT_INCREMENT
- Default increment size (50).
IntegerVector
public IntegerVector()
- Constructs an empty vector.
IntegerVector
public IntegerVector(int capacity)
- Constructs an empty vector with the specified initial capacity.
- Parameters:
- capacity - The initial capacity.
IntegerVector
public IntegerVector(int capacity,
int increment)
- Constructs an empty vector with the specified initial capacity
and capacity increment.
- Parameters:
- capacity - The initial capacity.
- increment - The capacity increment.
IntegerVector
public IntegerVector(IntegerVector original)
- Copy constructor.
addElement
public synchronized void addElement(int value)
- Adds the specified component to the end of this vector,
increasing its size by one.
- Parameters:
- element - The new value to add.
capacity
public synchronized int capacity()
- Resizes the
/**
Returns the current capacity of this vector.
clone
public Object clone()
- Returns a clone of this vector.
- Overrides:
- clone in class Object
contains
public synchronized boolean contains(int value)
- Tests if the specified object is a component in this vector.
- Parameters:
- value - The value to find.
copyInto
public synchronized void copyInto(int array[])
- Copies the components of this vector into the specified array.
- Parameters:
- array - The destination array.
elementAt
public int elementAt(int index)
- Returns the component at the specified index.
- Parameters:
- index - The index of the value to return.
elements
public Enumeration elements()
- Returns an enumeration of the components of this vector as
Integer objects.
ensureCapacity
public synchronized void ensureCapacity(int capacity)
- Increases the capacity of this vector, if necessary, to ensure
that it can hold at least the number of components specified by
the minimum capacity argument.
- Parameters:
- capacity - The new capacity.
firstElement
public synchronized int firstElement()
- Returns the first component of this vector, or -1 if there are
no elements.
indexOf
public int indexOf(int value)
- Searches for the first occurence of the given argument, testing
for equality using the equality operator. Returns -1 if the
element is not found.
- Parameters:
- value - The value to find.
indexOf
public synchronized int indexOf(int value,
int index)
- Searches for the first occurence of the given argument, beginning
the search at index, and testing for equality using the equality
operator. Returns -1 if the element is not found.
- Parameters:
- value - The value to find.
- index - The starting index.
insertElementAt
public synchronized void insertElementAt(int value,
int index)
- Inserts the specified object as a component in this vector at the
specified index.
- Parameters:
- value - The value to insert.
- index - The insertion index.
isEmpty
public boolean isEmpty()
- Tests if this vector has no components.
lastElement
public synchronized int lastElement()
- Returns the last component of the vector, or -1 if there are
no elements in the vector.
lastIndexOf
public int lastIndexOf(int value)
- Returns the index of the last occurrence of the specified object
in this vector, or -1 if the element is not found.
- Parameters:
- value - The value to find.
lastIndexOf
public synchronized int lastIndexOf(int value,
int index)
- Searches backwards for the specified object, starting from the
specified index, and returns an index to it. Returns -1 if the
element is not found.
- Parameters:
- value - The value to find.
- index - The starting index.
removeAllElements
public synchronized void removeAllElements()
- Removes all components from this vector and sets its size to zero.
removeElement
public synchronized void removeElement(int value)
- Removes the first occurrence of the argument from this vector.
- Parameters:
- value - The value to remove.
removeElementAt
public synchronized void removeElementAt(int index)
- Deletes the component at the specified index.
- Parameters:
- index - The index of the value to remove.
setElementAt
public synchronized void setElementAt(int value,
int index)
- Sets the component at the specified index of this vector to be
the specified object.
- Parameters:
- value - The new value.
- index - The index where to replace.
setSize
public synchronized void setSize(int size)
- Sets the size of this vector.
- Parameters:
- size - The new vector size.
size
public int size()
- Returns the number of components in this vector.
trimToSize
public synchronized void trimToSize()
- Trims the capacity of this vector to be the vector's current
size.
toString
public synchronized String toString()
- Returns a string representation of this vector.
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index