Package org.hipparchus.stat
Class LongFrequency
- java.lang.Object
-
- org.hipparchus.stat.Frequency<Long>
-
- org.hipparchus.stat.LongFrequency
-
- All Implemented Interfaces:
Serializable
public class LongFrequency extends Frequency<Long>
Maintains a frequency distribution of Long values.Accepts byte, short, int, long primitive or Integer and Long values.
Integer values (byte, short, int, long, Integer, Long) are not distinguished by type, i.e.
addValue(Long.valueOf(2)), addValue(2), addValue(2L)
all have the same effect (similarly for arguments togetCount()
etc.).NOTE: byte and short values will be implicitly converted to int values by the compiler, thus there are no explicit overloaded methods for these primitive types.
The values are ordered using the default (natural order), unless a
Comparator
is supplied in the constructor.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LongFrequency()
Default constructor.LongFrequency(Comparator<? super Long> comparator)
Constructor allowing values Comparator to be specified.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addValue(int v)
Adds 1 to the frequency count for v.long
getCount(int v)
Returns the number of values equal to v.long
getCumFreq(int v)
Returns the cumulative frequency of values less than or equal to v.double
getCumPct(int v)
Returns the cumulative percentage of values less than or equal to v (as a proportion between 0 and 1).double
getPct(int v)
Returns the percentage of values that are equal to v (as a proportion between 0 and 1).void
incrementValue(int v, long increment)
Increments the frequency count for v.-
Methods inherited from class org.hipparchus.stat.Frequency
addValue, clear, entrySetIterator, equals, getCount, getCumFreq, getCumPct, getMode, getPct, getSumFreq, getUniqueCount, hashCode, incrementValue, merge, merge, toString, valuesIterator
-
-
-
-
Constructor Detail
-
LongFrequency
public LongFrequency()
Default constructor.
-
LongFrequency
public LongFrequency(Comparator<? super Long> comparator)
Constructor allowing values Comparator to be specified.- Parameters:
comparator
- Comparator used to order values
-
-
Method Detail
-
addValue
public void addValue(int v)
Adds 1 to the frequency count for v.- Parameters:
v
- the value to add.
-
incrementValue
public void incrementValue(int v, long increment)
Increments the frequency count for v.- Parameters:
v
- the value to add.increment
- the amount by which the value should be incremented
-
getCount
public long getCount(int v)
Returns the number of values equal to v.- Parameters:
v
- the value to lookup.- Returns:
- the frequency of v.
-
getPct
public double getPct(int v)
Returns the percentage of values that are equal to v (as a proportion between 0 and 1).Returns
Double.NaN
if no values have been added.- Parameters:
v
- the value to lookup- Returns:
- the proportion of values equal to v
-
getCumFreq
public long getCumFreq(int v)
Returns the cumulative frequency of values less than or equal to v.- Parameters:
v
- the value to lookup.- Returns:
- the proportion of values equal to v
-
getCumPct
public double getCumPct(int v)
Returns the cumulative percentage of values less than or equal to v (as a proportion between 0 and 1).Returns
Double.NaN
if no values have been added.- Parameters:
v
- the value to lookup- Returns:
- the proportion of values less than or equal to v
-
-