package org.sfc.math.stochastic.statistics;
/**
* With this class, you may obtain <code>double</code>-precision floating
* point values from objects that represent direct/random accessible
* sequences, such as arrays.
*
* @param <CollectionType> The type of objects handled by this value getter.
* This will normally be an array type or such and
* such.
* @author Thomas Weise
*/
public abstract class ValueExtractor<CollectionType>
{
/**
* The singleton instance for arrays of <code>double</code>.
*/
public static final ValueExtractor<double[]> DOUBLE_ARRAY_INSTANCE =
new ValueExtractor<double[]>()
{
@Override
protected final double get_value(final double[] p_collection,
final int p_index)
{
return p_collection[p_index];
}
};
/**
// * The singleton instance for arrays of <code>int</code>.
// */
/**
// * The singleton instance for arrays of <code>long</code>.
// */
/**
// * The singleton instance for arrays of <code>float</code>.
// */
/**
* Obtain a double value from the item at position <code>p_index</code> in
* the collection.
* @param p_collection The collection object to obtain the value from.
* @param p_index The index of the item to return the value of.
* @return The <code>double</code> representation of the item
* at this position.
*/
protected abstract double get_value(final CollectionType p_collection,
final int p_index);
}