Class FrequencyMap<T extends Comparable<T>>
Object
com.owenfeehan.pathpatternfinder.describer.frequencymap.FrequencyMap<T>
- Type Parameters:
T
- element-type whose frequency is counted (Object.hashCode()
andshould be well-defined
.
public class FrequencyMap<T extends Comparable<T>> extends Object
Constructs a frequency map for a list of values.
This counts the number of occurrences of each element (who may be repeated many times).
- Author:
- Owen Feehan
-
Constructor Summary
Constructors Constructor Description FrequencyMap(List<T> list)
Create for a list of elements. -
Method Summary
Modifier and Type Method Description protected com.owenfeehan.pathpatternfinder.describer.frequencymap.OrderedByCount<T>
byCount()
A view of the frequency-map ordered by countsint
getCount(T key)
Count for a given keyT
highestKey()
The key with highest-valueSet<T>
keys()
All keys in the map.T
lowestKey()
The key with lowest-valueint
numberUniqueValues()
The number of unique-values that are being counted (i.e.
-
Constructor Details
-
FrequencyMap
Create for a list of elements.- Parameters:
list
- the list.
-
-
Method Details
-
getCount
Count for a given key- Parameters:
key
- the key to find a count for- Returns:
- the count for the key
-
numberUniqueValues
public int numberUniqueValues()The number of unique-values that are being counted (i.e. number of keys).- Returns:
- the number of unique-values
-
byCount
A view of the frequency-map ordered by counts- Returns:
- the view
-
lowestKey
The key with lowest-value- Returns:
- the key
-
highestKey
The key with highest-value- Returns:
- the key
-
keys
All keys in the map.- Returns:
- the keys
-