All Packages Class Hierarchy This Package Previous Next Index WEKA's home
Class weka.classifiers.functions.pace.IntVector
java.lang.Object
|
+----weka.classifiers.functions.pace.IntVector
- public class IntVector
- extends java.lang.Object
- implements java.lang.Cloneable
IntVector()
- Constructs a null vector.
IntVector(int)
- Constructs an n-vector of zeros.
IntVector(int[])
- Constructs a vector given an int array
IntVector(int, int)
- Constructs an n-vector of a constant
capacity()
- Returns the capacity of the vector
clone()
- Clones the IntVector object.
copy()
- Makes a deep copy of the vector
get(int)
- Gets the value of an element.
getArrayCopy()
- Returns a copy of the internal one-dimensional array.
isEmpty()
- Returns true if the vector is empty
main(String[])
- Tests the IntVector class
seq(int, int)
- Generates an IntVector that stores all integers inclusively between
two integers.
set(int)
- Sets the value of an element.
set(int, int)
- Sets a single element.
set(int, int, int[], int)
- Sets the values of elements from an int array.
set(int, int, IntVector, int)
- Sets the values of elements from another IntVector.
set(IntVector)
- Sets the values of elements from another IntVector.
setCapacity(int)
- Sets the capacity of the vector
setSize(int)
- Sets the size of the vector.
shift(int, int)
- Shifts an element to another position.
shiftToEnd(int)
- Shifts an element to the end of the vector.
size()
- Gets the size of the vector.
sort()
- Sorts the elements in place
subvector(int, int)
- Returns a subvector.
subvector(IntVector)
- Returns a subvector as indexed by an IntVector.
swap(int, int)
- Swaps the values stored at i and j
toString()
- Converts the IntVecor to a string
toString(int, boolean)
- Convert the IntVecor to a string
IntVector
public IntVector()
Constructs a null vector.
IntVector
public IntVector(int n)
Constructs an n-vector of zeros.
- Parameters:
n - Length.
IntVector
public IntVector(int n,
int s)
Constructs an n-vector of a constant
- Parameters:
n - Length.
IntVector
public IntVector(int v[])
Constructs a vector given an int array
- Parameters:
v - the int array
size
public int size()
Gets the size of the vector.
- Returns:
- Size.
setSize
public void setSize(int size)
Sets the size of the vector. The provided size can't be greater than
the capacity of the vector.
- Returns:
- Size.
set
public void set(int s)
Sets the value of an element.
- Parameters:
s - the value for the element
set
public void set(int i0,
int i1,
int v[],
int j0)
Sets the values of elements from an int array.
- Parameters:
i0 - the index of the first element
i1 - the index of the last element
v - the int array that stores the values
j0 - the index of the first element in the int array
set
public void set(int i0,
int i1,
IntVector v,
int j0)
Sets the values of elements from another IntVector.
- Parameters:
i0 - the index of the first element
i1 - the index of the last element
v - the IntVector that stores the values
j0 - the index of the first element in the IntVector
set
public void set(IntVector v)
Sets the values of elements from another IntVector.
- Parameters:
v - the IntVector that stores the values
seq
public static IntVector seq(int i0,
int i1)
Generates an IntVector that stores all integers inclusively between
two integers.
- Parameters:
i0 - the first integer
i1 - the second integer
sort
public void sort()
Sorts the elements in place
getArrayCopy
public int[] getArrayCopy()
Returns a copy of the internal one-dimensional array.
- Returns:
- One-dimensional array copy of vector elements.
capacity
public int capacity()
Returns the capacity of the vector
setCapacity
public void setCapacity(int capacity)
Sets the capacity of the vector
- Parameters:
capacity - the new capacity of the vector
set
public void set(int i,
int s)
Sets a single element.
- Parameters:
i - the index of the element
s - the new value
get
public int get(int i)
Gets the value of an element.
- Parameters:
i - the index of the element
- Returns:
- the value of the element
copy
public IntVector copy()
Makes a deep copy of the vector
clone
public java.lang.Object clone()
Clones the IntVector object.
subvector
public IntVector subvector(int i0,
int i1)
Returns a subvector.
- Parameters:
i0 - the index of the first element
i1 - the index of the last element
- Returns:
- the subvector
subvector
public IntVector subvector(IntVector index)
Returns a subvector as indexed by an IntVector.
- Parameters:
i0 - the index of the first element
i1 - the index of the last element
- Returns:
- the subvector
swap
public void swap(int i,
int j)
Swaps the values stored at i and j
- Parameters:
i - the index i
j - the index j
shift
public void shift(int i,
int j)
Shifts an element to another position. Elements between them are
shifted one position left.
- Parameters:
i - the index of the element
j - the index of the new position
shiftToEnd
public void shiftToEnd(int j)
Shifts an element to the end of the vector. Elements between them are
shifted one position left.
- Parameters:
i - the index of the element
j - the index of the new position
isEmpty
public boolean isEmpty()
Returns true if the vector is empty
toString
public java.lang.String toString()
Converts the IntVecor to a string
- Overrides:
- toString in class java.lang.Object
toString
public java.lang.String toString(int digits,
boolean trailing)
Convert the IntVecor to a string
- Parameters:
digits - number of digits to be shown
trailing - true if trailing zeros are to be shown
main
public static void main(java.lang.String args[])
Tests the IntVector class
All Packages Class Hierarchy This Package Previous Next Index WEKA's home