SciLib.Math
Class booleanVector

java.lang.Object
  extended by SciLib.Math.booleanVector

public class booleanVector
extends java.lang.Object

This class defines a dynamic vector of type intger.


Constructor Summary
booleanVector()
          Allocates an empty vector.
booleanVector(boolean[] vec)
          Allocates a vector from the array vec.
booleanVector(booleanVector x)
          Make a copy of the vector x.
booleanVector(int n)
          Allocates a vector of size n with initiařized values 0.
 
Method Summary
 void add(boolean x)
          Add an element of value x to the vector.
 void append(booleanVector x)
          Append an booleanVector x to this vector
 void concat(booleanVector x)
          Append a booleanVector x to this vector
static booleanVector copy(booleanVector x)
          Make a copy of the vector x.
 boolean elementAt(int i)
          return the value of vector at index i.
 boolean[] getData()
          Make an boolean array that contains all data of the vector.
static booleanVector ones(int n)
          Make a booleanVector of length n whose elements have value true.
 void print()
          Print all elements of the vector using System.out.
 void resize(int n)
          Change the size of the vector to n.
 void setElementAt(boolean x, int i)
          change the value of element at index i with the integer x.
 int size()
          Return the length of the vector.
 booleanVector subvector(int from)
          make a vector whose elements are equal to elements of this vector with the indexes from an integer "from" to the end of this vector.
 booleanVector subvector(int from, int to)
          Make a vector whose elements are equal to elements of this vector with the indexes from an integer "from" to an intger "to".
 java.lang.String toString()
          create a String that contains the elements of the vector.
 void trimToSize()
          Remove all the unused elements of the vector.
static booleanVector zeros(int n)
          Make a booleanVector of length n whose elements have value false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

booleanVector

public booleanVector()
Allocates an empty vector.


booleanVector

public booleanVector(int n)
Allocates a vector of size n with initiařized values 0.

Parameters:
n - The length of the vector

booleanVector

public booleanVector(boolean[] vec)
Allocates a vector from the array vec.

Parameters:
vec - An array of type double

booleanVector

public booleanVector(booleanVector x)
Make a copy of the vector x.

Parameters:
x - An booleanVector
Method Detail

copy

public static booleanVector copy(booleanVector x)
Make a copy of the vector x.

Parameters:
x - An booleanVector

add

public void add(boolean x)
Add an element of value x to the vector.

Parameters:
x - An integer value

append

public void append(booleanVector x)
Append an booleanVector x to this vector

Parameters:
x - A vector

concat

public void concat(booleanVector x)
Append a booleanVector x to this vector

Parameters:
x - A vector

elementAt

public boolean elementAt(int i)
                  throws java.lang.ArrayIndexOutOfBoundsException
return the value of vector at index i.

Parameters:
i - An integer
Throws:
java.lang.ArrayIndexOutOfBoundsException

getData

public boolean[] getData()
Make an boolean array that contains all data of the vector.

Returns:
An boolean array

ones

public static booleanVector ones(int n)
Make a booleanVector of length n whose elements have value true.


print

public void print()
Print all elements of the vector using System.out.


resize

public void resize(int n)
Change the size of the vector to n.

Parameters:
n - The new length of the vector

setElementAt

public void setElementAt(boolean x,
                         int i)
                  throws java.lang.ArrayIndexOutOfBoundsException
change the value of element at index i with the integer x.

Parameters:
x - An boolean value
i - An index integer
Throws:
java.lang.ArrayIndexOutOfBoundsException

size

public final int size()
Return the length of the vector.

Returns:
An integer

subvector

public booleanVector subvector(int from,
                               int to)
Make a vector whose elements are equal to elements of this vector with the indexes from an integer "from" to an intger "to".

Parameters:
from - start index
to - end index
Returns:
A vector

subvector

public booleanVector subvector(int from)
make a vector whose elements are equal to elements of this vector with the indexes from an integer "from" to the end of this vector.

Parameters:
from - start index
Returns:
A vector

toString

public java.lang.String toString()
create a String that contains the elements of the vector.

Overrides:
toString in class java.lang.Object
Returns:
A String

trimToSize

public void trimToSize()
Remove all the unused elements of the vector.


zeros

public static booleanVector zeros(int n)
Make a booleanVector of length n whose elements have value false.

Parameters:
n - An integer