Public Member Functions | |
IntVector () | |
Creates an empty vector. | |
IntVector (int n) | |
Constructs a vector with the specified capacity. | |
int | size () |
Gets the vector size. | |
void | setSize (int n) |
Sets the array size. | |
void | add (int x) |
Adds an element to the end of the vector. | |
int | get (int i) |
Gets an element. | |
void | set (int i, int x) |
Sets an element. | |
void | copy (int start, int[] dst, int dstPos, int len) |
Copies elements into an array. | |
void | add (int[] src, int srcPos, int n) |
Adds array elements. | |
void | set (int i, int[] src, int srcPos, int n) |
Sets array elements. | |
int[] | toArray () |
Converts the vector contents to an array. | |
int[] | internalArray () |
Gets the internal array object. | |
void | ensureCapacity (int n) |
Increases the capacity if necessary, to ensure that the vector can hold at least the number of elements specified by the argument. |
gridripper::util::IntVector::IntVector | ( | int | n | ) | [inline] |
Constructs a vector with the specified capacity.
n | the initial capacity |
int gridripper::util::IntVector::size | ( | ) | [inline] |
Gets the vector size.
void gridripper::util::IntVector::setSize | ( | int | n | ) | [inline] |
Sets the array size.
n | the new size |
void gridripper::util::IntVector::add | ( | int | x | ) | [inline] |
Adds an element to the end of the vector.
x | the value |
int gridripper::util::IntVector::get | ( | int | i | ) | [inline] |
Gets an element.
i | index |
void gridripper::util::IntVector::set | ( | int | i, | |
int | x | |||
) | [inline] |
Sets an element.
i | index | |
x | value |
void gridripper::util::IntVector::copy | ( | int | start, | |
int[] | dst, | |||
int | dstPos, | |||
int | len | |||
) | [inline] |
Copies elements into an array.
start | starting position | |
dst | the output array | |
dstPos | starting position in the output array | |
len | number of elements to copy |
void gridripper::util::IntVector::add | ( | int[] | src, | |
int | srcPos, | |||
int | n | |||
) | [inline] |
Adds array elements.
src | the source array | |
srcPos | starting position in the source array | |
n | number of elements to copy |
void gridripper::util::IntVector::set | ( | int | i, | |
int[] | src, | |||
int | srcPos, | |||
int | n | |||
) | [inline] |
Sets array elements.
i | index of first element to overwrite | |
src | the source array | |
srcPos | starting position in the source array | |
n | number of elements to copy |
int [] gridripper::util::IntVector::toArray | ( | ) | [inline] |
Converts the vector contents to an array.
Note that the returned array is a copy, hence it can only be used for reading, writing it has no effect on the vector contents.
int [] gridripper::util::IntVector::internalArray | ( | ) | [inline] |
Gets the internal array object.
Note that its length is usually larger than size().
void gridripper::util::IntVector::ensureCapacity | ( | int | n | ) | [inline] |
Increases the capacity if necessary, to ensure that the vector can hold at least the number of elements specified by the argument.
n | the desired minimum capacity |