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() and should 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 Details

    • FrequencyMap

      public FrequencyMap​(List<T> list)
      Create for a list of elements.
      Parameters:
      list - the list.
  • Method Details

    • getCount

      public int getCount​(T key)
      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

      protected com.owenfeehan.pathpatternfinder.describer.frequencymap.OrderedByCount<T> byCount()
      A view of the frequency-map ordered by counts
      Returns:
      the view
    • lowestKey

      public T lowestKey()
      The key with lowest-value
      Returns:
      the key
    • highestKey

      public T highestKey()
      The key with highest-value
      Returns:
      the key
    • keys

      public Set<T> keys()
      All keys in the map.
      Returns:
      the keys