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 fordelta
statistics. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(double sample) Updates statistics for the specified sample.void
add
(long sample) Updates statistics for the specified sample.void
add
(Statistics stats) Update statistics with all samples from the specifiedstats
.clone()
Returns a clone of this statistics.boolean
Tests this statistics with the specified object for equality.Returns the statistics about difference between consecutives values.int
hashCode()
Returns a hash code value for this statistics.void
reset()
Resets the statistics to their initialNaN
values.
-
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 fordelta
statistics. This method allows chaining different kind of statistics objects. For example, one could write:new Statistics.Delta(new Statistics.Delta());
Statistics
object 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 initialNaN
values. This method reset this object state as if it was just created.- Overrides:
reset
in classStatistics
-
add
public void add(double sample) Updates statistics for the specified sample. Thedelta
statistics are updated withsample - samplelast
value, wheresamplelast
is the last value given to the previous call of anadd(...)
method.- Overrides:
add
in classStatistics
- Parameters:
sample
- The sample value.NaN
values are ignored.- See Also:
-
add
public void add(long sample) Updates statistics for the specified sample. Thedelta
statistics are updated withsample - samplelast
value, wheresamplelast
is the last value given to the previous call of anadd(...)
method.- Overrides:
add
in 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 invokingadd
for all samples that were added tostats
. Thestats
argument must be an instance ofStatistics.Delta
.- Overrides:
add
in classStatistics
- Parameters:
stats
- The statistics to be added tothis
, ornull
if none.- Throws:
ClassCastException
- Ifstats
is not an instance ofStatistics.Delta
.
-
clone
Returns a clone of this statistics.- Specified by:
clone
in interfaceCloneable
- Overrides:
clone
in classStatistics
- Returns:
- A copy of this object.
- See Also:
-
equals
Tests this statistics with the specified object for equality.- Overrides:
equals
in classStatistics
-
hashCode
public int hashCode()Returns a hash code value for this statistics.- Overrides:
hashCode
in classStatistics
-