|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectSciLib.Math.byteVector
public class byteVector
This class defines a dynamic vector of type intger.
| Constructor Summary | |
|---|---|
byteVector()
Allocates an empty vector. |
|
byteVector(byte[] vec)
Allocates a vector from the array vec. |
|
byteVector(byteVector x)
Make a copy of the vector x. |
|
byteVector(int n)
Allocates a vector of size n with initiařized values 0. |
|
byteVector(java.lang.String s)
Make a byteVector from s String s. |
|
| Method Summary | |
|---|---|
void |
add(byte x)
Add a byte x to the vector. |
void |
add(short x)
Add a short value x to the vector. |
void |
append(byteVector x)
Append an byteVector x to this vector |
int |
argmax()
Compute the index of the maximum element in the vector. |
int |
argmin()
Compute the index of the minimum element in the vector. |
static byte |
BitsNeeded(int n)
|
static int |
byteValue(byte b)
get the value of a byte |
void |
concat(byteVector x)
Append a vector x to this vector |
static byteVector |
copy(byteVector x)
Make a copy of the vector x. |
byte |
elementAt(int i)
return the value of vector at index i. |
static vector |
generate(int from,
int to)
create a uniform vector that has elements from an integer "from" to an integer "to". |
byte[] |
getData()
Make an intger array that contains all data of the vector. |
int |
max()
return the maximum value of the vector. |
int |
min()
return the minimum value of the vector. |
static byteVector |
ones(int n)
Make a vector of length n whose elements have value 1. |
void |
print()
Print all elements of the vector using System.out. |
void |
read(java.io.InputStream in,
int n)
read n bytes from an InputStream to a byteVector |
void |
read(java.lang.String fileName)
Read data from a file to an integer vector. |
static byte |
readByte(java.io.InputStream in)
read byte |
static short |
readShort(java.io.InputStream in)
read short |
void |
resize(int n)
Change the size of the vector to n. |
void |
setElementAt(byte x,
int i)
change the value of element at index i with the integer x. |
int |
size()
Return the length of the vector. |
byteVector |
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. |
byteVector |
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 |
translate(int s)
plus all elements of the vector with an integer factor s. |
void |
trimToSize()
Remove all the unused elements of the vector. |
int |
value()
|
void |
write(java.io.OutputStream out)
write an byteVector to an OutputStream |
void |
write(java.lang.String fileName)
write an byteVector to a file |
static byteVector |
zeros(int n)
Make a vector of length n whose elements have value 0. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public byteVector()
public byteVector(int n)
n - The length of the vectorpublic byteVector(byte[] vec)
vec - An array of type doublepublic byteVector(java.lang.String s)
s - A Stringpublic byteVector(byteVector x)
x - An byteVector| Method Detail |
|---|
public static byteVector copy(byteVector x)
x - An byteVectorpublic void add(byte x)
x - A byte valuepublic void add(short x)
x - A short valuepublic void append(byteVector x)
x - A vectorpublic final int argmax()
public final int argmin()
public void concat(byteVector x)
x - A vector
public byte elementAt(int i)
throws java.lang.ArrayIndexOutOfBoundsException
i - An integer
java.lang.ArrayIndexOutOfBoundsException
public static vector generate(int from,
int to)
from - An integerto - An integer
public byte[] getData()
public final int max()
public final int min()
public static byteVector ones(int n)
public void print()
public void resize(int n)
n - The new length of the vector
public void setElementAt(byte x,
int i)
throws java.lang.ArrayIndexOutOfBoundsException
x - An integer valuei - An index integer
java.lang.ArrayIndexOutOfBoundsExceptionpublic final int size()
public byteVector subvector(int from,
int to)
from - start indexto - end index
public byteVector subvector(int from)
from - start index
public java.lang.String toString()
toString in class java.lang.Objectpublic void translate(int s)
s - A double valuepublic void trimToSize()
public static byteVector zeros(int n)
n - An integerpublic void write(java.lang.String fileName)
fileName - A Stringpublic void read(java.lang.String fileName)
fileName - a Stringpublic void write(java.io.OutputStream out)
out - An OutputStream
public void read(java.io.InputStream in,
int n)
in - An InputStreampublic static short readShort(java.io.InputStream in)
in - An InputStreampublic static byte readByte(java.io.InputStream in)
in - An InputStreampublic static int byteValue(byte b)
b - A byte
public int value()
public static byte BitsNeeded(int n)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||