T - the element typeSerializableLongFrequencypublic class Frequency<T extends Comparable<T>> extends Object implements Serializable
The values are ordered using the default (natural order), unless a
Comparator is supplied in the constructor.
LongFrequency,
Serialized Form| Constructor | Description |
|---|---|
Frequency() |
Default constructor.
|
Frequency(Comparator<? super T> comparator) |
Constructor allowing values Comparator to be specified.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addValue(T v) |
Adds 1 to the frequency count for v.
|
void |
clear() |
Clears the frequency table
|
Iterator<Map.Entry<T,Long>> |
entrySetIterator() |
Return an Iterator over the set of keys and values that have been added.
|
boolean |
equals(Object obj) |
|
long |
getCount(T v) |
Returns the number of values equal to v.
|
long |
getCumFreq(T v) |
Returns the cumulative frequency of values less than or equal to v.
|
double |
getCumPct(T v) |
Returns the cumulative percentage of values less than or equal to v
(as a proportion between 0 and 1).
|
List<T> |
getMode() |
Returns the mode value(s) in comparator order.
|
double |
getPct(T v) |
Returns the percentage of values that are equal to v
(as a proportion between 0 and 1).
|
long |
getSumFreq() |
Returns the sum of all frequencies.
|
int |
getUniqueCount() |
Returns the number of values in the frequency table.
|
int |
hashCode() |
|
void |
incrementValue(T v,
long increment) |
Increments the frequency count for v.
|
void |
merge(Collection<? extends Frequency<? extends T>> others) |
Merge a
Collection of Frequency objects into this instance. |
void |
merge(Frequency<? extends T> other) |
Merge another Frequency object's counts into this instance.
|
String |
toString() |
Return a string representation of this frequency distribution.
|
Iterator<T> |
valuesIterator() |
Returns an Iterator over the set of values that have been added.
|
public Frequency()
public Frequency(Comparator<? super T> comparator)
comparator - Comparator used to order valuespublic void addValue(T v)
v - the value to add.public void incrementValue(T v, long increment)
v - the value to add.increment - the amount by which the value should be incrementedpublic void clear()
public Iterator<T> valuesIterator()
public Iterator<Map.Entry<T,Long>> entrySetIterator()
public long getSumFreq()
public long getCount(T v)
v - the value to lookup.public int getUniqueCount()
valuesIterator()public double getPct(T v)
Returns Double.NaN if no values have been added.
v - the value to lookuppublic long getCumFreq(T v)
v - the value to lookup.public double getCumPct(T v)
Returns Double.NaN if no values have been added.
v - the value to lookuppublic List<T> getMode()
public void merge(Frequency<? extends T> other) throws NullArgumentException
other - the other Frequency object to be mergedNullArgumentException - if other is nullpublic void merge(Collection<? extends Frequency<? extends T>> others) throws NullArgumentException
Collection of Frequency objects into this instance.
This Frequency's counts will be incremented (or set when not already set)
by the counts represented by each of the others.others - the other Frequency objects to be mergedNullArgumentException - if the collection is nullpublic String toString()
Copyright © 2016–2018 Hipparchus.org. All rights reserved.