Class EventStatsMap<E>

  • Type Parameters:
    E - The class representing all possible event categories
    Direct Known Subclasses:
    EnumEventStatsMap, UnboundedEventStatsMap

    public abstract class EventStatsMap<E>
    extends Object
    A mapping between event categories and their respective counts. Not thread safe.
    Author:
    Eyal Schneider
    • Constructor Detail

      • EventStatsMap

        protected EventStatsMap​(Map<E,​Long> map)
        Constructor (protected)
        Parameters:
        map - The map implementation to use internally
    • Method Detail

      • getCount

        public Long getCount​(E category)
        Parameters:
        category - A statistics category
        Returns:
        the count in the given category
      • getCategoryStats

        public Map<E,​Long> getCategoryStats()
        Returns:
        the category statistics (read only)
      • setCategoryCounts

        public void setCategoryCounts​(E category,
                                      long count)
        Sets the count for a specific category.
        Parameters:
        category - A stats category
        completed - The number of events in the given category
      • toJson

        public net.minidev.json.JSONObject toJson()
        Returns:
        The contents of this object, as json
      • add

        public void add​(EventStatsMap<E> other)
        Adds the counts from the other collector. Not atomic.
        Parameters:
        other - The other collector to get the counters from