public final class IntegerVector extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected int |
index
The index of the last value of the array.
|
protected int[] |
list
The int array.
|
Constructor and Description |
---|
IntegerVector()
The Constructors.
|
IntegerVector(int initial_list_size) |
IntegerVector(IntegerListInterface i_list) |
IntegerVector(IntegerVector vec) |
Modifier and Type | Method and Description |
---|---|
void |
addInt(int val)
Adds an int to the vector.
|
IntegerVector |
append(IntegerVector vec)
Appends an IntegerVector to the end of the array.
|
void |
clear()
Clears the object to be re-used.
|
boolean |
contains(int val)
Returns true if the vector contains the given value.
|
void |
crop(int start,
int end)
Crops the IntegerVector so it only contains values between start
(inclusive) and end (exclusive).
|
boolean |
equals(IntegerVector ivec)
Returns true if this vector is equal to the given vector.
|
int |
getSize()
Returns the size of the vector.
|
int |
indexOf(int val)
Returns the first index of the given row in the array, or -1 if not
found.
|
void |
insertIntAt(int val,
int pos)
Inserts an int at the given position.
|
int |
intAt(int pos)
Returns the Int at the given position.
|
boolean |
isSorted()
Test routine to check vector is sorted.
|
int |
placeIntAt(int val,
int pos)
Places an int at the given position, overwriting anything that was
previously there.
|
void |
quickSort()
Performs a quick sort on the entire vector.
|
void |
quickSort(int min,
int max)
Performs a quick sort on the array between the min and max bounds.
|
void |
removeInt(int val)
Removes the first Int found that matched the specified value.
|
void |
removeIntAt(int pos)
Removes an Int from the specified position in the list.
|
void |
reverse()
Reverses all the list of integers.
|
int |
setIntAt(int val,
int pos)
Sets an int at the given position, overwriting anything that was
previously there.
|
int |
size()
Returns the size of the vector.
|
int |
sortedIndexOf(int val)
Searches the entire sorted list for the given value and returns the index
of it.
|
int |
sortedIndexOf(int val,
int lower,
int higher)
This is a very quick search for a value given a sorted array.
|
int |
sortedIntCount(int val)
Given a sorted list, this will return the count of this value in the
list.
|
int[] |
toIntArray()
Converts the vector into an int[] array.
|
String |
toString()
Converts the vector into a String.
|
protected int[] list
protected int index
public IntegerVector()
public IntegerVector(int initial_list_size)
public IntegerVector(IntegerVector vec)
public IntegerVector(IntegerListInterface i_list)
public void addInt(int val)
public void removeIntAt(int pos)
public void removeInt(int val)
public void crop(int start, int end)
public void insertIntAt(int val, int pos)
public int setIntAt(int val, int pos)
public int placeIntAt(int val, int pos)
public IntegerVector append(IntegerVector vec)
public int intAt(int pos)
public int indexOf(int val)
public boolean contains(int val)
public int getSize()
public int size()
public int[] toIntArray()
public void clear()
public String toString()
public boolean equals(IntegerVector ivec)
public void reverse()
public final void quickSort(int min, int max)
public final void quickSort()
public final int sortedIndexOf(int val, int lower, int higher)
public final int sortedIndexOf(int val)
public final int sortedIntCount(int val)
public boolean isSorted()
Copyright © 2015. All rights reserved.