-
- All Implemented Interfaces:
-
kotlin.collections.Collection,kotlin.collections.Iterable,kotlin.collections.MutableCollection,kotlin.collections.MutableIterable
public final class Frequency<T extends Comparable<T>> implements Collection<T>
Maintains a frequency distribution.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classFrequency.Companion
-
Field Summary
Fields Modifier and Type Field Description private final Integersizeprivate final IntegertotalFrequencyprivate final Multiset.Entry<T>mostEntryprivate final Multiset.Entry<T>leastEntryprivate final Tmodeprivate final List<T>modesprivate final DoublemodePercentageprivate final Stringname
-
Method Summary
Modifier and Type Method Description IntegergetSize()final IntegergetTotalFrequency()final Multiset.Entry<T>getMostEntry()final Multiset.Entry<T>getLeastEntry()final TgetMode()final List<T>getModes()final DoublegetModePercentage()final StringgetName()Booleanadd(T element)Booleanremove(T element)BooleancontainsAll(Collection<T> elements)BooleanaddAll(Collection<T> elements)final UnitaddAll(Array<T> elements)BooleanremoveAll(Collection<T> elements)BooleanretainAll(Collection<T> elements)Unitclear()BooleanisEmpty()Booleancontains(T element)final Integercount(T element)final Set<Multiset.Entry<T>>entrySet()final Set<T>elementSet()Iterator<T>iterator()final Map<T, Integer>ordinalMap()final DoublepercentageOf(T v)Returns the percentage of values that are equal to v (as a proportion between 0 and 1). final DoublecumulativePercentageOf(T v)Returns the cumulative percentage of values less than or equal to v (as a proportion between 0 and 1). final IntegercumulativeFrequencyOf(T v)Returns the cumulative frequency of values less than or equal to v. final IntegertrimEnd(Double freqThreshold)final IntegertrimStart(Double freqThreshold)final UnitexportTo(Path path)final StringtoPString(String prefix, String postfix, String delimiter)final StringtoPString(String prefix, String postfix)final StringtoPString(String prefix)final StringtoPString()final StringtoReport(String prefix, String postfix)final StringtoReport(String prefix)final StringtoReport()StringtoString()Return a string representation of this frequency distribution. IntegerhashCode()Booleanequals(Object other)-
Methods inherited from class kotlin.collections.Collection
forEach -
Methods inherited from class kotlin.collections.MutableCollection
parallelStream, spliterator, stream, toArray -
Methods inherited from class ai.platon.pulsar.common.Frequency
removeIf -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
Frequency
Frequency(String name)
-
-
Method Detail
-
getTotalFrequency
final Integer getTotalFrequency()
-
getMostEntry
final Multiset.Entry<T> getMostEntry()
-
getLeastEntry
final Multiset.Entry<T> getLeastEntry()
-
getModePercentage
final Double getModePercentage()
-
containsAll
Boolean containsAll(Collection<T> elements)
-
addAll
Boolean addAll(Collection<T> elements)
-
removeAll
Boolean removeAll(Collection<T> elements)
-
retainAll
Boolean retainAll(Collection<T> elements)
-
elementSet
final Set<T> elementSet()
-
ordinalMap
final Map<T, Integer> ordinalMap()
-
percentageOf
final Double percentageOf(T v)
Returns the percentage of values that are equal to v (as a proportion between 0 and 1).
Returns
Double.NaNif no values have been added.- Parameters:
v- the value to lookup
-
cumulativePercentageOf
final Double cumulativePercentageOf(T v)
Returns the cumulative percentage of values less than or equal to v (as a proportion between 0 and 1).
Returns
Double.NaNif no values have been added. Returns 0 if at least one value has been added, but v is not comparable to the values set.- Parameters:
v- the value to lookup
-
cumulativeFrequencyOf
final Integer cumulativeFrequencyOf(T v)
Returns the cumulative frequency of values less than or equal to v.
Cumulative frequency analysis is the analysis of the frequency of occurrence of values of a phenomenon less than a reference value. The phenomenon may be time- or space-dependent. Cumulative frequency is also called frequency of non-exceedance.
- Parameters:
v- the value to lookup.
-
toPString
@JvmOverloads() final String toPString(String prefix, String postfix)
-
toPString
@JvmOverloads() final String toPString(String prefix)
-
toPString
@JvmOverloads() final String toPString()
-
toReport
@JvmOverloads() final String toReport(String prefix, String postfix)
-
toReport
@JvmOverloads() final String toReport(String prefix)
-
toReport
@JvmOverloads() final String toReport()
-
-
-
-