Class SortedRefCountedSet<K>
java.lang.Object
com.espertech.esper.common.internal.collection.SortedRefCountedSet<K>
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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a key to the set.void
Add a key to the set with the given number of references.void
clear()
Clear out the collection.long
Returns the number of data points.maxValue()
Returns the largest key value, or null if the collection is empty.minValue()
Returns the smallest key value, or null if the collection is empty.void
Remove a key from the set.void
setCountPoints
(long countPoints)
-
Field Details
-
EPTYPE
-
-
Constructor Details
-
SortedRefCountedSet
public SortedRefCountedSet()Constructor.
-
-
Method Details
-
clear
public void clear()Clear out the collection. -
add
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
Add a key to the set with the given number of references.- Parameters:
key
- to addnumReferences
- initial number of references
-
remove
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
Returns the largest key value, or null if the collection is empty.- Returns:
- largest key value, null if none
-
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
-
setCountPoints
public void setCountPoints(long countPoints)
-