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.

Variable Index

 o DEFAULT_CAPACITY
Default initial size (100).
 o DEFAULT_INCREMENT
Default increment size (50).

Constructor Index

 o IntegerVector()
Constructs an empty vector.
 o IntegerVector(int)
Constructs an empty vector with the specified initial capacity.
 o IntegerVector(int, int)
Constructs an empty vector with the specified initial capacity and capacity increment.
 o IntegerVector(IntegerVector)
Copy constructor.

Method Index

 o addElement(int)
Adds the specified component to the end of this vector, increasing its size by one.
 o capacity()
Resizes the /** Returns the current capacity of this vector.
 o clone()
Returns a clone of this vector.
 o contains(int)
Tests if the specified object is a component in this vector.
 o copyInto(int[])
Copies the components of this vector into the specified array.
 o elementAt(int)
Returns the component at the specified index.
 o elements()
Returns an enumeration of the components of this vector as Integer objects.
 o 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.
 o firstElement()
Returns the first component of this vector, or -1 if there are no elements.
 o indexOf(int)
Searches for the first occurence of the given argument, testing for equality using the equality operator.
 o 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.
 o insertElementAt(int, int)
Inserts the specified object as a component in this vector at the specified index.
 o isEmpty()
Tests if this vector has no components.
 o lastElement()
Returns the last component of the vector, or -1 if there are no elements in the vector.
 o lastIndexOf(int)
Returns the index of the last occurrence of the specified object in this vector, or -1 if the element is not found.
 o lastIndexOf(int, int)
Searches backwards for the specified object, starting from the specified index, and returns an index to it.
 o removeAllElements()
Removes all components from this vector and sets its size to zero.
 o removeElement(int)
Removes the first occurrence of the argument from this vector.
 o removeElementAt(int)
Deletes the component at the specified index.
 o setElementAt(int, int)
Sets the component at the specified index of this vector to be the specified object.
 o setSize(int)
Sets the size of this vector.
 o size()
Returns the number of components in this vector.
 o toString()
Returns a string representation of this vector.
 o trimToSize()
Trims the capacity of this vector to be the vector's current size.

Variables

 o DEFAULT_CAPACITY
 public static final int DEFAULT_CAPACITY
Default initial size (100).

 o DEFAULT_INCREMENT
 public static final int DEFAULT_INCREMENT
Default increment size (50).

Constructors

 o IntegerVector
 public IntegerVector()
Constructs an empty vector.

 o IntegerVector
 public IntegerVector(int capacity)
Constructs an empty vector with the specified initial capacity.

Parameters:
capacity - The initial capacity.
 o 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.
 o IntegerVector
 public IntegerVector(IntegerVector original)
Copy constructor.

Methods

 o 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.
 o capacity
 public synchronized int capacity()
Resizes the /** Returns the current capacity of this vector.

 o clone
 public Object clone()
Returns a clone of this vector.

Overrides:
clone in class Object
 o contains
 public synchronized boolean contains(int value)
Tests if the specified object is a component in this vector.

Parameters:
value - The value to find.
 o copyInto
 public synchronized void copyInto(int array[])
Copies the components of this vector into the specified array.

Parameters:
array - The destination array.
 o elementAt
 public int elementAt(int index)
Returns the component at the specified index.

Parameters:
index - The index of the value to return.
 o elements
 public Enumeration elements()
Returns an enumeration of the components of this vector as Integer objects.

 o 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.
 o firstElement
 public synchronized int firstElement()
Returns the first component of this vector, or -1 if there are no elements.

 o 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.
 o 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.
 o 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.
 o isEmpty
 public boolean isEmpty()
Tests if this vector has no components.

 o lastElement
 public synchronized int lastElement()
Returns the last component of the vector, or -1 if there are no elements in the vector.

 o 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.
 o 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.
 o removeAllElements
 public synchronized void removeAllElements()
Removes all components from this vector and sets its size to zero.

 o removeElement
 public synchronized void removeElement(int value)
Removes the first occurrence of the argument from this vector.

Parameters:
value - The value to remove.
 o removeElementAt
 public synchronized void removeElementAt(int index)
Deletes the component at the specified index.

Parameters:
index - The index of the value to remove.
 o 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.
 o setSize
 public synchronized void setSize(int size)
Sets the size of this vector.

Parameters:
size - The new vector size.
 o size
 public int size()
Returns the number of components in this vector.

 o trimToSize
 public synchronized void trimToSize()
Trims the capacity of this vector to be the vector's current size.

 o 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