Constructor and Description |
---|
DoubleList()
This is the default constructor that creates a
DoubleList with
initial length 10. |
DoubleList(int size)
This is the default constructor that creates a
DoubleList with
initial length size . |
DoubleList(StringBuffer rep)
This is the constructor for the interface
Storable . |
Modifier and Type | Method and Description |
---|---|
void |
add(double val)
Adds the element
val at the end of the list. |
void |
add(double val,
int fromIndex,
int toIndex)
Adds the element
val from fromIndex to
toIndex (exclusive). |
void |
addAll(DoubleList list2)
This method adds all elements of
DoubleList list2 to the current list. |
void |
addTo(int start,
int end,
double summand)
Adds to all values in the list from index
start to
end the value summand . |
void |
clear()
Removes all elements from the list.
|
DoubleList |
clone() |
double |
get(int index)
Returns the element with the specified
index . |
int |
getMaxIndex()
Returns the index of the first value that is equal to the maximal value.
|
int |
getMinIndex()
Returns the index of the first value that is equal to the minimal value.
|
int |
length()
Returns the number of inserted elements.
|
double |
max(int start,
int end)
This method computes the maximum of a part of the list.
|
double |
mean(int start,
int end)
This method computes the mean of a part of the list.
|
double |
median(int start,
int end)
This method computes the median of a part of the list.
|
double |
min(int start,
int end)
This method computes the minimum of a part of the list.
|
void |
multiply(int start,
int end,
double factor)
Multiplies all values in the list from index
start to
end with the value factor . |
double |
sd(int start,
int end)
This method computes the standard deviation of a part of the list.
|
void |
sort()
Sorts the elements of this
DoubleList |
double[] |
toArray()
This method returns a
double array containing all elements
of the list. |
double[] |
toArray(double[] erg)
This method returns a
double array containing all elements
of the list. |
double[] |
toArray(int start,
int end)
This method returns a
double array containing all elements
of the list between start and end (exclusive). |
String |
toString() |
StringBuffer |
toXML()
This method returns an XML representation as
StringBuffer of an
instance of the implementing class. |
public DoubleList()
DoubleList
with
initial length 10.public DoubleList(int size) throws IllegalArgumentException
DoubleList
with
initial length size
.size
- the initial size, has to be positiveIllegalArgumentException
- if size
is less than 1public DoubleList(StringBuffer rep) throws NonParsableException
Storable
. Constructs a
DoubleList
out of an XML representation.rep
- the XML representation as StringBuffer
NonParsableException
- if the XML representation could not be parsedpublic DoubleList clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public void addAll(DoubleList list2)
DoubleList
list2
to the current list.list2
- a list of elements to be addedpublic final void add(double val)
val
at the end of the list.val
- the element that should be insertedpublic void add(double val, int fromIndex, int toIndex)
val
from fromIndex
to
toIndex
(exclusive).val
- the element that should be insertedfromIndex
- the start index (inclusive)toIndex
- the end index (exclusive)public final void clear()
public final double get(int index)
index
.index
- the specified index of the element to returnpublic final int length()
public double[] toArray()
double
array containing all elements
of the list.double
array containing all elements of the listpublic double[] toArray(double[] erg)
double
array containing all elements
of the list.erg
- this array will be used to return the values if it is not equal to >code<null>/code< and larger than the internal arraydouble
array containing all elements of the listpublic double[] toArray(int start, int end)
double
array containing all elements
of the list between start and end (exclusive).start
- the first position to considerend
- the index after the last position to considerdouble
array containing the elements of the listpublic void multiply(int start, int end, double factor)
start
to
end
with the value factor
.start
- the start index (inclusive)end
- the end index (exclusive)factor
- the factor with which the values in the list are multipliedpublic void addTo(int start, int end, double summand)
start
to
end
the value summand
.start
- the start index (inclusive)end
- the end index (exclusive)summand
- the summand which is added to the values in the listpublic double mean(int start, int end)
start
has to be smaller than end
and
end
has to be smaller than length()
.start
- the start index (inclusive)end
- the end index (exclusive)public double sd(int start, int end)
start
has to be smaller than end
and
end
has to be smaller than length()
.start
- the start index (inclusive)end
- the end index (exclusive)public double min(int start, int end)
start
has to be smaller than end
and
end
has to be smaller than length()
.start
- the start index (inclusive)end
- the end index (exclusive)public double max(int start, int end)
start
has to be smaller than end
and
end
has to be smaller than length()
.start
- the start index (inclusive)end
- the end index (exclusive)public double median(int start, int end)
start
has to be smaller than end
and
end
has to be smaller than length()
.start
- the start index (inclusive)end
- the end index (exclusive)public StringBuffer toXML()
Storable
StringBuffer
of an
instance of the implementing class.public int getMinIndex()
public int getMaxIndex()
public void sort()
DoubleList
Arrays.sort(double[])