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.data
Class Sample.WeightedSampleFactory

    java.lang.Object
      de.jstacs.data.Sample.WeightedSampleFactory

Enclosing class:
  Sample

    public static class Sample.WeightedSampleFactory

extends Object

This class enables you to eliminate `Sequence`s that occur more than once in one or more `Sample`s. The number of occurrences is given by the weight for a `Sequence`.

Author:
  Jens Keilwagen

Nested Class Summary
`static class` | `Sample.WeightedSampleFactory.SortOperation` This `enum` defines the different types of sort operations that can be performed while creating a `Sample.WeightedSampleFactory`.

Constructor Summary
`Sample.WeightedSampleFactory(Sample.WeightedSampleFactory.SortOperation sort, Sample... data)` Creates a new `Sample.WeightedSampleFactory` on the given `Sample`(s) with `Sample.WeightedSampleFactory.SortOperation` `sort`.
`Sample.WeightedSampleFactory(Sample.WeightedSampleFactory.SortOperation sort, Sample[] data, double[][] weights, int length)` Creates a new `Sample.WeightedSampleFactory` on the given array of `Sample`s and an array of `weights` with a given `length` and `Sample.WeightedSampleFactory.SortOperation` `sort`.
`Sample.WeightedSampleFactory(Sample.WeightedSampleFactory.SortOperation sort, Sample data, double[] weights)` Creates a new `Sample.WeightedSampleFactory` on the given `Sample` and an array of `weights` with `Sample.WeightedSampleFactory.SortOperation` `sort`.
`Sample.WeightedSampleFactory(Sample.WeightedSampleFactory.SortOperation sort, Sample data, double[] weights, int length)` Creates a new `Sample.WeightedSampleFactory` on the given `Sample` and an array of `weights` with a given `length` and `Sample.WeightedSampleFactory.SortOperation` `sort`.

Method Summary
`Sequence` | `getElementAt(int index)` Returns the `Sequence` with index `index`.
`int` | `getNumberOfElements()` Returns the number of elements, i.e.
`Sample` | `getSample()` Returns the `Sample`, where each `Sequence` occurs only once.
`double` | `getSumOfWeights()` Returns the sum of all weights.
`double` | `getWeight(int index)` Returns the weight for the `Sequence` with index `index`.
`double[]` | `getWeights()` Returns a copy of the weights for the `Sample`.
`String` | `toString()`

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

Constructor Detail

### Sample.WeightedSampleFactory

    public Sample.WeightedSampleFactory(Sample.WeightedSampleFactory.SortOperation sort,
                                        Sample... data)
                                 throws WrongAlphabetException,
                                        WrongLengthException

  Creates a new `Sample.WeightedSampleFactory` on the given `Sample`(s) with `Sample.WeightedSampleFactory.SortOperation` `sort`.

  Parameters:
    `sort` - the given `Sample.WeightedSampleFactory.SortOperation`
    `data` - the given `Sample`(s)
  Throws:
    `WrongAlphabetException` - if the alphabets of the `Sample`s do not match
    `WrongLengthException` - does not happen (forwarded from `Sample.WeightedSampleFactory(de.jstacs.data.Sample.WeightedSampleFactory.SortOperation, de.jstacs.data.Sample[], double[][], int)` )
  See Also:
    `Sample.WeightedSampleFactory#WeightedSampleFactory(de.jstacs.data.Sample.WeightedSampleFactory.SortOperation, de.jstacs.data.Sample[], double[][], int)`

### Sample.WeightedSampleFactory

    public Sample.WeightedSampleFactory(Sample.WeightedSampleFactory.SortOperation sort,
                                        Sample data,
                                        double[] weights)
                                 throws WrongAlphabetException,
                                        WrongLengthException

  Creates a new `Sample.WeightedSampleFactory` on the given `Sample` and an array of `weights` with `Sample.WeightedSampleFactory.SortOperation` `sort`.

  Parameters:
    `sort` - the given `Sample.WeightedSampleFactory.SortOperation`
    `data` - the given `Sample`
    `weights` - the weights for each element in the `Sample`
  Throws:
    `WrongAlphabetException` - if the alphabets of the `Sample`s do not match
    `WrongLengthException` - does not happen (forwarded from `Sample.WeightedSampleFactory(de.jstacs.data.Sample.WeightedSampleFactory.SortOperation, de.jstacs.data.Sample[], double[][], int)` )
  See Also:
    `Sample.WeightedSampleFactory#WeightedSampleFactory(de.jstacs.data.Sample.WeightedSampleFactory.SortOperation, de.jstacs.data.Sample[], double[][], int)`

### Sample.WeightedSampleFactory

    public Sample.WeightedSampleFactory(Sample.WeightedSampleFactory.SortOperation sort,
                                        Sample data,
                                        double[] weights,
                                        int length)
                                 throws WrongAlphabetException,
                                        WrongLengthException

  Creates a new `Sample.WeightedSampleFactory` on the given `Sample` and an array of `weights` with a given `length` and `Sample.WeightedSampleFactory.SortOperation` `sort`.

  Parameters:
    `sort` - the given `Sample.WeightedSampleFactory.SortOperation`
    `data` - the given `Sample`
    `weights` - the weight for each element in the `Sample`
    `length` - the length of the elements in the resulting `Sample.WeightedSampleFactory`
  Throws:
    `WrongAlphabetException` - if the alphabets of the `Sample`s do not match
    `WrongLengthException` - if the length is not supported
  See Also:
    `Sample.WeightedSampleFactory#WeightedSampleFactory(de.jstacs.data.Sample.WeightedSampleFactory.SortOperation, de.jstacs.data.Sample[], double[][], int)`

### Sample.WeightedSampleFactory

    public Sample.WeightedSampleFactory(Sample.WeightedSampleFactory.SortOperation sort,
                                        Sample[] data,
                                        double[][] weights,
                                        int length)
                                 throws WrongAlphabetException,
                                        WrongLengthException

  Creates a new `Sample.WeightedSampleFactory` on the given array of `Sample`s and an array of `weights` with a given `length` and `Sample.WeightedSampleFactory.SortOperation` `sort`.

  Parameters:
    `sort` - the given `Sample.WeightedSampleFactory.SortOperation`
    `data` - the given `Sample`
    `weights` - the weights for each element in each `Sample`
    `length` - the length of the elements in the resulting `Sample.WeightedSampleFactory`
  Throws:
    `WrongAlphabetException` - if the alphabets of the `Sample`s do not match
    `WrongLengthException` - if the length is not supported

Method Detail

### getElementAt

    public Sequence getElementAt(int index)

  Returns the `Sequence` with index `index`.

  Parameters:
    `index` - the index of the `Sequence`
  Returns:
    the `Sequence` with index `index`

### getNumberOfElements

    public int getNumberOfElements()

  Returns the number of elements, i.e. `Sequence`s, in the internal `Sample`.

  Returns:
    the number of elements, i.e. `Sequence`s, in the internal `Sample`

### getSample

    public Sample getSample()

  Returns the `Sample`, where each `Sequence` occurs only once.

  Returns:
    the `Sample`, where each `Sequence` occurs only once

### getSumOfWeights

    public double getSumOfWeights()

  Returns the sum of all weights.

  Returns:
    the sum of all weights

### getWeight

    public double getWeight(int index)

  Returns the weight for the `Sequence` with index `index`.

  Parameters:
    `index` - the index of the `Sequence`
  Returns:
    the weight for the `Sequence` with index `index`

### getWeights

    public double[] getWeights()

  Returns a copy of the weights for the `Sample`.

  Returns:
    the weights for the `Sample`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

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