Class SortedRefCountedSet<K>

java.lang.Object
com.espertech.esper.common.internal.collection.SortedRefCountedSet<K>

public class SortedRefCountedSet<K> extends Object
Sorted, reference-counting set based on a TreeMap implementation that stores keys and a reference counter for each unique key value. Each time the same key is added, the reference counter increases. Each time a key is removed, the reference counter decreases.
  • Field Details

  • Constructor Details

    • SortedRefCountedSet

      public SortedRefCountedSet()
      Constructor.
  • Method Details

    • clear

      public void clear()
      Clear out the collection.
    • add

      public void add(K key)
      Add a key to the set. Add with a reference count of one if the key didn't exist in the set. Increase the reference count by one if the key already exists.
      Parameters:
      key - to add
    • add

      public void add(K key, int numReferences)
      Add a key to the set with the given number of references.
      Parameters:
      key - to add
      numReferences - initial number of references
    • remove

      public void remove(K key)
      Remove a key from the set. Removes the key if the reference count is one. Decreases the reference count by one if the reference count is more then one.
      Parameters:
      key - to add
      Throws:
      IllegalStateException - is a key is removed that wasn't added to the map
    • maxValue

      public K maxValue()
      Returns the largest key value, or null if the collection is empty.
      Returns:
      largest key value, null if none
    • minValue

      public K minValue()
      Returns the smallest key value, or null if the collection is empty.
      Returns:
      smallest key value, null if none
    • getCountPoints

      public long getCountPoints()
      Returns the number of data points.
      Returns:
      point count
    • getRefSet

      public TreeMap<K,Integer> getRefSet()
    • setCountPoints

      public void setCountPoints(long countPoints)