public class LongFrequency extends Frequency<Long>
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 to getCount()
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.
Constructor and Description |
---|
LongFrequency()
Default constructor.
|
LongFrequency(Comparator<? super Long> comparator)
Constructor allowing values Comparator to be specified.
|
Modifier and Type | Method and 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.
|
addValue, clear, entrySetIterator, equals, getCount, getCumFreq, getCumPct, getMode, getPct, getSumFreq, getUniqueCount, hashCode, incrementValue, merge, merge, toString, valuesIterator
public LongFrequency()
public LongFrequency(Comparator<? super Long> comparator)
comparator
- Comparator used to order valuespublic void addValue(int v)
v
- the value to add.public void incrementValue(int v, long increment)
v
- the value to add.increment
- the amount by which the value should be incrementedpublic long getCount(int v)
v
- the value to lookup.public double getPct(int v)
Returns Double.NaN
if no values have been added.
v
- the value to lookuppublic long getCumFreq(int v)
v
- the value to lookup.public double getCumPct(int v)
Returns Double.NaN
if no values have been added.
v
- the value to lookupCopyright © 2016–2019 Hipparchus.org. All rights reserved.