Package org.ojalgo.random
Class FrequencyMap<T>
java.lang.Object
org.ojalgo.random.FrequencyMap<T>
Count the occurrence of different keys
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConcurrentHashMap
<T, LongAdder> private final LongAdder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
elements()
elements
(FrequencyMap.FrequencyPredicate<T> predicate) private LongAdder
long
getFrequency
(T element) (package private) ConcurrentHashMap
<T, LongAdder> getMap()
long
getMode()
double
getRelativeFrequency
(T element) void
void
incrementAll
(Iterable<? extends T> elements) void
merge
(FrequencyMap<T> other) void
merge
(FrequencyMap<T> other, FrequencyMap.FrequencyPredicate<T> predicate) int
long
void
reset()
void
retainIf
(FrequencyMap.FrequencyPredicate<T> predicate) Remove entries that do not satisfy the predicate - remove elements that would not be returned byelements(FrequencyPredicate)
.sample()
-
Field Details
-
myMap
-
myPopulation
-
-
Constructor Details
-
FrequencyMap
public FrequencyMap() -
FrequencyMap
- Parameters:
initial
- An initial set of elements to add to the frequency map (with frequency zero)
-
-
Method Details
-
add
-
addAll
-
addAll
-
elements
- Returns:
- All known elements
-
elements
- Parameters:
predicate
- An element filter- Returns:
- A set of elements that pass the filter
-
getFrequency
-
getMaximumFrequenecy
public long getMaximumFrequenecy() -
getMode
-
getRelativeFrequency
-
increment
-
incrementAll
-
merge
-
merge
-
numberOfKnownKeys
public int numberOfKnownKeys() -
populationSize
public long populationSize() -
reset
public void reset() -
retainIf
Remove entries that do not satisfy the predicate - remove elements that would not be returned byelements(FrequencyPredicate)
. -
sample
-
get
-
getEntryWithHighestFrequenecy
-
getMap
ConcurrentHashMap<T,LongAdder> getMap()
-