public class IntVector
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
elementCount |
protected int[] |
elements |
Constructor and Description |
---|
IntVector()
Constructs a int vector with the default size.
|
IntVector(int size)
Constructs an fast vector instance with the specified size
|
IntVector(int[] array) |
Modifier and Type | Method and Description |
---|---|
void |
add(int v)
Adds an element to the fast vector
|
void |
add(int index,
int v)
Adds an element at the specified index
|
void |
addArray(int[] v)
Adds elements to the fast vector
|
void |
clear()
This method empties the fast vector
|
boolean |
contains(int v) |
int |
elementAt(int index)
Gets the object at the specified index
|
java.util.Enumeration |
elements()
This method returns an enumeration from the fast vector
|
int |
indexOf(int v)
Gets the index of the specified object
|
java.util.Enumeration |
inversedElements()
This method returns an enumeration from the fast vector
This enumeration travels in the reverse order.
|
void |
moveElement(int indexSrc,
int indexDest) |
int |
remove(int v)
Removes the specified object from the vector
|
int |
removeAt(int index)
Removes the object at the specified index from the fast vector
|
void |
reverse() |
int |
size()
Gets the size of the fast vector
|
int[] |
toArray()
Return all elements contained in this Vector in an array.
|
void |
toArray(int[] targetArray)
This method copies the element of the vectors to a specified array
|
java.lang.String |
toString() |
public IntVector()
public IntVector(int[] array)
public IntVector(int size)
size
- the specified size of the fast vectorpublic void reverse()
public boolean contains(int v)
public void add(int v)
v
- the object to be addedpublic void addArray(int[] v)
v
- the objects to be addedpublic void add(int index, int v)
index
- the speciefied indexv
- the object to be addedpublic int remove(int v)
v
- the specified value to be removedpublic int[] toArray()
public int removeAt(int index)
index
- the specified index of the object to be removepublic int indexOf(int v)
v
- the specified objectpublic void toArray(int[] targetArray)
targetArray
- the array in which the elements of the fast vector will be copied inpublic int size()
public java.util.Enumeration elements()
public java.util.Enumeration inversedElements()
public int elementAt(int index)
index
- the specified indexpublic void clear()
public void moveElement(int indexSrc, int indexDest)
public java.lang.String toString()
toString
in class java.lang.Object