Class CountingMultiValMap<K,L>

  • Type Parameters:
    K - Type of the keys.
    L - Type of the values.


    public class CountingMultiValMap<K,L>
    extends Object
    A data-structure to collect Tags. A tag consists of key + value. The structure counts the number of times a pair has been added to the MultiValMap. Thus to remove a tag, you have to remove it as often as it has been added to the MultiValMap.
    • Constructor Detail

      • CountingMultiValMap

        public CountingMultiValMap()
    • Method Detail

      • add

        public void add(K key1,
                        L key2)
        Add the tag (key1, key2) to the MultiValMap.
        Parameters:
        key1 - the first key
        key2 - the seconds key
      • getForKey

        public Set<L> getForKey(K key)
        Parameters:
        key - the key for which to determine all associated values.
        Returns:
        the set of all v associated with key key: { v | (key,v) is present in the MultiValMap }
      • get

        public Map<L,Integer> get(K key)
        Parameters:
        key - the key for which to determine the association map.
        Returns:
        the association map for the given key.
      • remove

        public void remove(K key1,
                           L key2)
        Remove the tag (key1, key2) from the MultiValMap. Decrements the count for this tag by one. If count reaches zero, the tag will be removed.
        Parameters:
        key1 - the first key.
        key2 - the seconds key.
      • values

        public Collection<L> values()
        Returns:
        a collection of all values that are in this map.