org.jaitools.numeric
Interface Processor

All Known Implementing Classes:
AbstractProcessor, ApproxMedianProcessor, ExactMedianProcessor, ExtremaProcessor, MeanVarianceProcessor, SumProcessor

public interface Processor

Defines methods that must be implemented by statistics processors working with StreamingSampleStats.

Since:
1.0
Version:
$Id$
Author:
Michael Bedward, Daniele Romagnoli, GeoSolutions S.A.S.
See Also:
Statistic, StreamingSampleStats

Method Summary
 void addNoDataRange(Range<Double> noData)
          Sets a range of values to be considered as NoData.
 void addNoDataValue(Double noData)
          Convenience method to specify a single value to be considered as NoData.
 void addRange(Range<Double> range)
          Sets a range of values to exclude from or include in from calculations.
 void addRange(Range<Double> range, Range.Type rangeType)
          Sets a range of values to exclude from or include in calculations.
 Map<Statistic,Double> get()
          Gets the value of all statistics calculated by this processor.
 Double get(Statistic stat)
          Gets the value of the statistic calculated by this processor.
 List<Range<Double>> getNoDataRanges()
          Gets the ranges of sample values to be considered as NoData.
 long getNumAccepted()
          Gets the number of samples that have been accepted by this processor (ie.
 long getNumNaN()
          Gets the number of NaN samples passed to the processor
 long getNumNoData()
          Gets the number of NoData samples passed to the processor.
 long getNumOffered()
          Gets the number of samples that have been offered to this processor.
 List<Range<Double>> getRanges()
          Gets the Ranges of sample values excluded from/included in calculations.
 Range.Type getRangesType()
          Gets the type of ranges being used by this processor.
 Collection<Statistic> getSupported()
          Gets the Statistics supported by this processor.
 boolean isAccepted(Double sample)
          Tests whether a sample value will be accepted for calculations by the processor.
 void offer(Double sample)
          Offers a sample value to the processor.
 void setRangesType(Range.Type rangeType)
          Sets the type of the ranges to be added to the processor.
 

Method Detail

getSupported

Collection<Statistic> getSupported()
Gets the Statistics supported by this processor.

Returns:
supported Statistics

addNoDataRange

void addNoDataRange(Range<Double> noData)
Sets a range of values to be considered as NoData. Processors count the number of NoData values offered as samples but exclude them from calculations.

NoData ranges take precedence over included / excluded data ranges.

Parameters:
noData - a range of values to be excluded

addNoDataValue

void addNoDataValue(Double noData)
Convenience method to specify a single value to be considered as NoData.

Parameters:
noData - the value to be treated as NoData
See Also:
addNoDataRange(org.jaitools.numeric.Range)

addRange

void addRange(Range<Double> range,
              Range.Type rangeType)
Sets a range of values to exclude from or include in calculations. Note that you can only add ranges of the same type to a Processor.

Parameters:
range - the range
rangeType - the type of range
Throws:
IllegalArgumentException - if rangeType is different to that of a previously added range.

addRange

void addRange(Range<Double> range)
Sets a range of values to exclude from or include in from calculations. Ie. if a sample value in this range is offered it will be ignored or accepted with the behavior depending on which range type has been set previously.

Parameters:
range - the range

setRangesType

void setRangesType(Range.Type rangeType)
Sets the type of the ranges to be added to the processor. It is worth to point out that this method can be called only one time in case the rangesType haven't been specified at construction time and no ranges have been added yet.

Parameters:
rangeType - the type of range.

getRangesType

Range.Type getRangesType()
Gets the type of ranges being used by this processor.

Returns:
the rangesType of this processor

getNoDataRanges

List<Range<Double>> getNoDataRanges()
Gets the ranges of sample values to be considered as NoData.

Returns:
the NoData Ranges or an empty list if no NoData are defined

getRanges

List<Range<Double>> getRanges()
Gets the Ranges of sample values excluded from/included in calculations.

Returns:
the Ranges or an empty list if no ranges are defined

isAccepted

boolean isAccepted(Double sample)
Tests whether a sample value will be accepted for calculations by the processor.

Parameters:
sample - the sample value
Returns:
true if the sample is accepted in compliance with the ranges settings. false otherwise

offer

void offer(Double sample)
Offers a sample value to the processor.

Parameters:
sample - the sample value

getNumOffered

long getNumOffered()
Gets the number of samples that have been offered to this processor.

Returns:
number of samples offered

getNumAccepted

long getNumAccepted()
Gets the number of samples that have been accepted by this processor (ie. contributed to the calculations).

Returns:
number of samples used for calculations

getNumNaN

long getNumNaN()
Gets the number of NaN samples passed to the processor

Returns:
number of NaN samples

getNumNoData

long getNumNoData()
Gets the number of NoData samples passed to the processor. This count includes values in user-specified NoData ranges as well as Double.NaN values.

Returns:
number of NoData samples
See Also:
addNoDataRange(org.jaitools.numeric.Range), addNoDataValue(java.lang.Double)

get

Double get(Statistic stat)
           throws IllegalArgumentException
Gets the value of the statistic calculated by this processor.

Parameters:
stat - the specified statistic
Returns:
the value of the statistic if it has been calculated or Double.NaN otherwise
Throws:
IllegalArgumentException - if stat is not supported by this processor

get

Map<Statistic,Double> get()
Gets the value of all statistics calculated by this processor.

Returns:
the calculated statistic(s)


Copyright © 2009-2013. All Rights Reserved.