Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.jstacs.utils
Class DoubleList

    java.lang.Object
      de.jstacs.utils.DoubleList

All Implemented Interfaces:
  Storable

    public final class DoubleList

extends Object
implements Storable

A simple list of primitive type `double`.

Author:
  Jens Keilwagen

Constructor Summary
`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`.

Method Summary
`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` | `clear()` Removes all elements from the list.
`double` | `get(int index)` Returns the element with the specified `index`.
`int` | `length()` Returns the number of inserted elements.
`double` | `mean(int start, int end)` This method computes the mean 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[]` | `toArray()` This method returns a `double` array containing all elements of the list.
`StringBuffer` | `toXML()` This method returns an XML representation as `StringBuffer` of an instance of the implementing class.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DoubleList

    public DoubleList()

  This is the default constructor that creates a `DoubleList` with initial length 10.

### DoubleList

    public DoubleList(int size)
               throws IllegalArgumentException

  This is the default constructor that creates a `DoubleList` with initial length `size`.

  Parameters:
    `size` - the initial size, has to be positive
  Throws:
    `IllegalArgumentException` - if `size` is less than 1

### DoubleList

    public DoubleList(StringBuffer rep)
               throws NonParsableException

  This is the constructor for the interface `Storable`. Constructs a `DoubleList` out of an XML representation.

  Parameters:
    `rep` - the XML representation as `StringBuffer`
  Throws:
    `NonParsableException` - if the XML representation could not be parsed

Method Detail

### add

    public void add(double val)

  Adds the element `val` at the end of the list.

  Parameters:
    `val` - the element that should be inserted

### add

    public void add(double val,
                    int fromIndex,
                    int toIndex)

  Adds the element `val` from `fromIndex` to `toIndex` (exclusive).

  Parameters:
    `val` - the element that should be inserted
    `fromIndex` - the start index (inclusive)
    `toIndex` - the end index (exclusive)

### clear

    public void clear()

  Removes all elements from the list.

### get

    public double get(int index)

  Returns the element with the specified `index`.

  Parameters:
    `index` - the specified index of the element to return
  Returns:
    the corresponding element

### length

    public int length()

  Returns the number of inserted elements.

  Returns:
    the number of inserted elements

### toArray

    public double[] toArray()

  This method returns a `double` array containing all elements of the list.

  Returns:
    a `double` array containing all elements of the list

### multiply

    public void multiply(int start,
                         int end,
                         double factor)

  Multiplies all values in the list from index `start` to `end` with the value `factor`.

  Parameters:
    `start` - the start index (inclusive)
    `end` - the end index (exclusive)
    `factor` - the factor with which the values in the list are multiplied

### mean

    public double mean(int start,
                       int end)

  This method computes the mean of a part of the list. Please note that `start` has to be smaller than `end` and `end` has to be smaller than `length()`.

  Parameters:
    `start` - the start index (inclusive)
    `end` - the end index (exclusive)
  Returns:
    the mean of the part of the list

### toXML

    public StringBuffer toXML()

  Description copied from interface: `Storable`
  This method returns an XML representation as `StringBuffer` of an instance of the implementing class.

  Specified by:
    `toXML` in interface `Storable`
  Returns:
    the XML representation

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD