|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--nrc.fuzzy.DoubleVector
The DoubleVector class implements a growable array of double
values. Like an array,
the values can be accessed using an integer index. However, the size of a DoubleVector can
grow as needed to accommodate adding items after the DoubleVector has been created.
This class was created for the utility of the package and was not written with the intention
of allowing user access.
Field Summary | |
protected double[] |
d
The array of doubles values. |
protected int |
increment
The increment amount by which the DoubleVector expands when it reaches capacity and has to insert another double value. |
protected int |
index
The current number of double values in the array, and the index of the array at which the next double value should be inserted. |
protected static int |
INITIAL_CAPACITY
The default initial capacity of the DoubleVector. |
Constructor Summary | |
DoubleVector()
Creates an empty DoubleVector with the default initial capacity and increment values. |
|
DoubleVector(double[] doubleArray,
int length)
Creates a DoubleVector with the length specified in the parameters, and initialized for the full length of the DoubleVector from the double values contained in the passed array. |
|
DoubleVector(int initialCapacity)
Creates an empty DoubleVector with the specified initial capacity and the default increment value. |
|
DoubleVector(int initialCapacity,
int increment)
Creates an empty DoubleVector with the specified initial capacity and increment value. |
Method Summary | |
void |
addDouble(double value)
Adds a double value to the end of the DoubleVector, increasing its size by one. |
void |
concat(nrc.fuzzy.DoubleVector other)
Concatenates the DoubleVector argument with this DoubleVector. |
double |
doubleAt(int i)
Returns the double value at the specified index. |
void |
insertDoubleAt(double value,
int i)
Inserts the double argument into the DoubleVector at the specified index. |
void |
removeDoubleAt(int i)
Removes the double value from the DoubleVector at the specified index. |
void |
setDoubleAt(double value,
int i)
Sets the double value in the DoubleVector at the specified index. |
int |
size()
Returns the size of the DoubleVector, or the number of double values in the DoubleVector. |
double[] |
todoubleArray()
Returns the array of doubles, trimmed to size, that this DoubleVector contains. |
void |
trimToSize()
Trims the capacity of this DoubleVector to be the DoubleVector's current size. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final int INITIAL_CAPACITY
protected int increment
protected double[] d
protected int index
Constructor Detail |
public DoubleVector()
public DoubleVector(int initialCapacity)
initialCapacity
- the int which specifies the desired initial capacity of
the DoubleVector. This is best used it is known that
the DoubleVector will be quite large so as to avoid multiple
expansions of the DoubleVector, which is inefficient.public DoubleVector(int initialCapacity, int increment)
initialCapacity
- the int to specify the desired initial capacity of
the DoubleVector. This is best used it is known that
the DoubleVector will be quite large so as to avoid multiple
expansions of the DoubleVector, which is inefficient.increment
- the int to specify the desired increment of the DoubleVectorpublic DoubleVector(double[] doubleArray, int length)
doubleArray
- the array of doubles which contains the double values
with which to initialize the DoubleVector.length
- this parameter is basically equivalent to the initial
capacity parameter in the other constructors. However,
it has one additional implication. It is expected
that length
is less than or equal to the length of
doubleArray
.
java.lang.ArrayIndexOutOfBoundsException
- if the length
parameter is
greater than the length of doubleArray
.Method Detail |
public void addDouble(double value)
value
- the double value to be added to the DoubleVectorpublic void concat(nrc.fuzzy.DoubleVector other)
other
- the DoubleVector to concatenate onto the end of
this DoubleVectorpublic double doubleAt(int i)
i
- the index in the DoubleVector of the desired
double value
public void setDoubleAt(double value, int i)
value
- the double value to set the specified position in the
DoubleVector toi
- the index in the DoubleVector of the double value position
that is desired to be setpublic void removeDoubleAt(int i)
i
- the position of the double value to removepublic void insertDoubleAt(double value, int i)
value
- the double value to be inserted into the DoubleVectori
- the index position of the DoubleVector into which the
double value argument is to be insertedpublic void trimToSize()
public int size()
public double[] todoubleArray()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |