Class CounterMap<F,​S>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Map<F,​Counter<S>> maps  
    • Constructor Summary

      Constructors 
      Constructor Description
      CounterMap()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Pair<F,​S> argMax()
      This method returns pair of elements with a max value
      void clear()
      This method purges all counters
      void clear​(F element)
      This method purges counter for a given first element
      double getCount​(F first, S second)
      This method returns counts for a given first/second pair
      Counter<S> getCounter​(F first)
      This method returns counter for a given first element
      Iterator<Pair<F,​S>> getIterator()
      This method returns Iterator of all first/second pairs stored in this counter
      void incrementAll​(CounterMap<F,​S> other)
      This method will increment values of this counter, by counts of other counter
      void incrementCount​(F first, S second, double inc)
      This method will increment counts for a given first/second pair
      boolean isEmpty()
      This method checks if this CounterMap has any values stored
      boolean isEmpty​(F element)
      This method checks if this CounterMap has any values stored for a given first element
      Set<F> keySet()
      This method returns Set of all first elements
      double setCount​(F first, S second, double value)
      This method allows you to set counter value for a given first/second pair
      int size()
      This method returns number of First elements in this CounterMap
      int totalSize()
      This method returns total number of elements in this CounterMap
    • Constructor Detail

      • CounterMap

        public CounterMap()
    • Method Detail

      • isEmpty

        public boolean isEmpty()
        This method checks if this CounterMap has any values stored
        Returns:
      • isEmpty

        public boolean isEmpty​(F element)
        This method checks if this CounterMap has any values stored for a given first element
        Parameters:
        element -
        Returns:
      • incrementAll

        public void incrementAll​(CounterMap<F,​S> other)
        This method will increment values of this counter, by counts of other counter
        Parameters:
        other -
      • incrementCount

        public void incrementCount​(F first,
                                   S second,
                                   double inc)
        This method will increment counts for a given first/second pair
        Parameters:
        first -
        second -
        inc -
      • getCount

        public double getCount​(F first,
                               S second)
        This method returns counts for a given first/second pair
        Parameters:
        first -
        second -
        Returns:
      • setCount

        public double setCount​(F first,
                               S second,
                               double value)
        This method allows you to set counter value for a given first/second pair
        Parameters:
        first -
        second -
        value -
        Returns:
      • argMax

        public Pair<F,​S> argMax()
        This method returns pair of elements with a max value
        Returns:
      • clear

        public void clear()
        This method purges all counters
      • clear

        public void clear​(F element)
        This method purges counter for a given first element
        Parameters:
        element -
      • keySet

        public Set<F> keySet()
        This method returns Set of all first elements
        Returns:
      • getCounter

        public Counter<S> getCounter​(F first)
        This method returns counter for a given first element
        Parameters:
        first -
        Returns:
      • getIterator

        public Iterator<Pair<F,​S>> getIterator()
        This method returns Iterator of all first/second pairs stored in this counter
        Returns:
      • size

        public int size()
        This method returns number of First elements in this CounterMap
        Returns:
      • totalSize

        public int totalSize()
        This method returns total number of elements in this CounterMap
        Returns: