Package org.geotools.metadata.math
Class Statistics.Delta
- Object
-
- Statistics
-
- Delta
-
- All Implemented Interfaces:
Serializable,Cloneable,Cloneable
- Enclosing class:
- Statistics
public static class Statistics.Delta extends 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 thanStatisticsand additionnaly computes statistics for s1-s0, s2-s1, s3-s2..., which are stored in adeltastatistics object.- Author:
- Martin Desruisseaux (IRD)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class Statistics
Statistics.Delta
-
-
Constructor Summary
Constructors Constructor Description Delta()Constructs an initially empty set of statistics.Delta(Statistics delta)Constructs an initially empty set of statistics using the specified object fordeltastatistics.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(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.Statistics.Deltaclone()Returns a clone of this statistics.booleanequals(Object obj)Tests this statistics with the specified object for equality.StatisticsgetDeltaStatistics()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 Detail
-
Delta
public Delta()
Constructs an initially empty set of statistics. All statistical values are initialized toDouble.NaN.
-
Delta
public Delta(Statistics 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 Detail
-
getDeltaStatistics
public Statistics 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:
Statistics.add(long),Statistics.add(Statistics)
-
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:
Statistics.add(double),Statistics.add(Statistics)
-
add
public void add(Statistics stats) throws ClassCastException
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
public Statistics.Delta clone()
Returns a clone of this statistics.- Specified by:
clonein interfaceCloneable- Overrides:
clonein classStatistics- Returns:
- A copy of this object.
- See Also:
Object.clone()
-
equals
public boolean equals(Object obj)
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
-
-