Package org.geotools.metadata.math
Class Statistics.Delta
Object
Statistics
Delta
- All Implemented Interfaces:
Serializable,Cloneable,Cloneable
- Enclosing class:
- Statistics
Holds some statistics about a series of sample values and the difference between them. Given a series of sample
values s0, s1, s2, s3...,
this class computes statistics in the same way than
Statistics and additionnaly computes statistics for
s1-s0, s2-s1,
s3-s2..., which are stored in a delta
statistics object.- Author:
- Martin Desruisseaux (IRD)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Statistics
Statistics.Delta -
Constructor Summary
ConstructorsConstructorDescriptionDelta()Constructs an initially empty set of statistics.Delta(Statistics delta) Constructs an initially empty set of statistics using the specified object fordeltastatistics. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(double sample) Updates statistics for the specified sample.voidadd(long sample) Updates statistics for the specified sample.voidadd(Statistics stats) Update statistics with all samples from the specifiedstats.clone()Returns a clone of this statistics.booleanTests this statistics with the specified object for equality.Returns the statistics about difference between consecutives values.inthashCode()Returns a hash code value for this statistics.voidreset()Resets the statistics to their initialNaNvalues.
-
Constructor Details
-
Delta
public Delta()Constructs an initially empty set of statistics. All statistical values are initialized toDouble.NaN. -
Delta
Constructs an initially empty set of statistics using the specified object fordeltastatistics. This method allows chaining different kind of statistics objects. For example, one could write:
Which would compute statistics of sample values, statistics of difference between consecutive sample values, and statistics of difference of difference between consecutive sample values. Other kinds ofnew Statistics.Delta(new Statistics.Delta());
Statisticsobject could be chained as well.
-
-
Method Details
-
getDeltaStatistics
Returns the statistics about difference between consecutives values. Given a series of sample values s0, s1, s2, s3..., this is statistics for s1-s0, s2-s1, s3-s2..., -
reset
public void reset()Resets the statistics to their initialNaNvalues. This method reset this object state as if it was just created.- Overrides:
resetin classStatistics
-
add
public void add(double sample) Updates statistics for the specified sample. Thedeltastatistics are updated withsample - samplelastvalue, wheresamplelastis the last value given to the previous call of anadd(...)method.- Overrides:
addin classStatistics- Parameters:
sample- The sample value.NaNvalues are ignored.- See Also:
-
add
public void add(long sample) Updates statistics for the specified sample. Thedeltastatistics are updated withsample - samplelastvalue, wheresamplelastis the last value given to the previous call of anadd(...)method.- Overrides:
addin classStatistics- Parameters:
sample- The sample value.- See Also:
-
add
Update statistics with all samples from the specifiedstats. Invoking this method is equivalent (except for rounding errors) to invokingaddfor all samples that were added tostats. Thestatsargument must be an instance ofStatistics.Delta.- Overrides:
addin classStatistics- Parameters:
stats- The statistics to be added tothis, ornullif none.- Throws:
ClassCastException- Ifstatsis not an instance ofStatistics.Delta.
-
clone
Returns a clone of this statistics.- Specified by:
clonein interfaceCloneable- Overrides:
clonein classStatistics- Returns:
- A copy of this object.
- See Also:
-
equals
Tests this statistics with the specified object for equality.- Overrides:
equalsin classStatistics
-
hashCode
public int hashCode()Returns a hash code value for this statistics.- Overrides:
hashCodein classStatistics
-