de.jstacs.data
Class DataSet.WeightedDataSetFactory

java.lang.Object
  extended by de.jstacs.data.DataSet.WeightedDataSetFactory
Enclosing class:
DataSet

public static class DataSet.WeightedDataSetFactory
extends Object

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

Author:
Jens Keilwagen

Nested Class Summary
static class DataSet.WeightedDataSetFactory.SortOperation
          This enum defines the different types of sort operations that can be performed while creating a DataSet.WeightedDataSetFactory.
 
Constructor Summary
DataSet.WeightedDataSetFactory(DataSet.WeightedDataSetFactory.SortOperation sort, DataSet... data)
          Creates a new DataSet.WeightedDataSetFactory on the given DataSet(s) with DataSet.WeightedDataSetFactory.SortOperation sort.
DataSet.WeightedDataSetFactory(DataSet.WeightedDataSetFactory.SortOperation sort, DataSet[] data, double[][] weights, int length)
          Creates a new DataSet.WeightedDataSetFactory on the given array of DataSets and an array of weights with a given length and DataSet.WeightedDataSetFactory.SortOperation sort.
DataSet.WeightedDataSetFactory(DataSet.WeightedDataSetFactory.SortOperation sort, DataSet data, double[] weights)
          Creates a new DataSet.WeightedDataSetFactory on the given DataSet and an array of weights with DataSet.WeightedDataSetFactory.SortOperation sort.
DataSet.WeightedDataSetFactory(DataSet.WeightedDataSetFactory.SortOperation sort, DataSet data, double[] weights, int length)
          Creates a new DataSet.WeightedDataSetFactory on the given DataSet and an array of weights with a given length and DataSet.WeightedDataSetFactory.SortOperation sort.
 
Method Summary
 DataSet getDataSet()
          Returns the DataSet, where each Sequence occurs only once.
 Sequence getElementAt(int index)
          Returns the Sequence with index index.
 int getNumberOfElements()
          Returns the number of elements, i.e.
 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 DataSet.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataSet.WeightedDataSetFactory

public DataSet.WeightedDataSetFactory(DataSet.WeightedDataSetFactory.SortOperation sort,
                                      DataSet... data)
                               throws WrongAlphabetException,
                                      WrongLengthException
Creates a new DataSet.WeightedDataSetFactory on the given DataSet(s) with DataSet.WeightedDataSetFactory.SortOperation sort.

Parameters:
sort - the given DataSet.WeightedDataSetFactory.SortOperation
data - the given DataSet(s)
Throws:
WrongAlphabetException - if the alphabets of the DataSets do not match
WrongLengthException - does not happen (forwarded from DataSet.WeightedDataSetFactory(DataSet.WeightedDataSetFactory.SortOperation, DataSet[], double[][], int) )
See Also:
DataSet.WeightedDataSetFactory(DataSet.WeightedDataSetFactory.SortOperation, DataSet[], double[][], int)

DataSet.WeightedDataSetFactory

public DataSet.WeightedDataSetFactory(DataSet.WeightedDataSetFactory.SortOperation sort,
                                      DataSet data,
                                      double[] weights)
                               throws WrongAlphabetException,
                                      WrongLengthException
Creates a new DataSet.WeightedDataSetFactory on the given DataSet and an array of weights with DataSet.WeightedDataSetFactory.SortOperation sort.

Parameters:
sort - the given DataSet.WeightedDataSetFactory.SortOperation
data - the given DataSet
weights - the weights for each element in the DataSet
Throws:
WrongAlphabetException - if the alphabets of the DataSets do not match
WrongLengthException - does not happen (forwarded from DataSet.WeightedDataSetFactory(DataSet.WeightedDataSetFactory.SortOperation, DataSet[], double[][], int) )
See Also:
DataSet.WeightedDataSetFactory(DataSet.WeightedDataSetFactory.SortOperation, DataSet[], double[][], int)

DataSet.WeightedDataSetFactory

public DataSet.WeightedDataSetFactory(DataSet.WeightedDataSetFactory.SortOperation sort,
                                      DataSet data,
                                      double[] weights,
                                      int length)
                               throws WrongAlphabetException,
                                      WrongLengthException
Creates a new DataSet.WeightedDataSetFactory on the given DataSet and an array of weights with a given length and DataSet.WeightedDataSetFactory.SortOperation sort.

Parameters:
sort - the given DataSet.WeightedDataSetFactory.SortOperation
data - the given DataSet
weights - the weight for each element in the DataSet
length - the length of the elements in the resulting DataSet.WeightedDataSetFactory
Throws:
WrongAlphabetException - if the alphabets of the DataSets do not match
WrongLengthException - if the length is not supported
See Also:
DataSet.WeightedDataSetFactory(DataSet.WeightedDataSetFactory.SortOperation, DataSet[], double[][], int)

DataSet.WeightedDataSetFactory

public DataSet.WeightedDataSetFactory(DataSet.WeightedDataSetFactory.SortOperation sort,
                                      DataSet[] data,
                                      double[][] weights,
                                      int length)
                               throws WrongAlphabetException,
                                      WrongLengthException
Creates a new DataSet.WeightedDataSetFactory on the given array of DataSets and an array of weights with a given length and DataSet.WeightedDataSetFactory.SortOperation sort.

Parameters:
sort - the given DataSet.WeightedDataSetFactory.SortOperation
data - the given DataSet
weights - the weights for each element in each DataSet
length - the length of the elements in the resulting DataSet.WeightedDataSetFactory
Throws:
WrongAlphabetException - if the alphabets of the DataSets 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. Sequences, in the internal DataSet.

Returns:
the number of elements, i.e. Sequences, in the internal DataSet

getDataSet

public DataSet getDataSet()
Returns the DataSet, where each Sequence occurs only once.

Returns:
the DataSet, 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 DataSet.

Returns:
the weights for the DataSet

toString

public String toString()
Overrides:
toString in class Object