Package com.cobber.fta
Class TopBottomK<T extends Comparable<C>,C>
- Object
-
- TopBottomK<T,C>
-
- Type Parameters:
T
- The type of the object being tracked.C
- The Class of a comparator used to compare objects of this type.
public class TopBottomK<T extends Comparable<C>,C> extends Object
Class used to track the top and bottom K values.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SortedSet<T>
bottomK()
Return the bottom K values (ordered LOWEST to HIGHEST).SortedSet<String>
bottomKasString()
Return the bottom K values as Strings (ordered LOWEST to HIGHEST).void
observe(T item)
Observe the value provided.void
observeAll(Set<T> items)
Observe the items provided.SortedSet<T>
topK()
Return the top K values (ordered LOWEST to HIGHEST).SortedSet<String>
topKasString()
Return the top K values as Strings (ordered HIGHEST to LOWEST).
-
-
-
Method Detail
-
observeAll
public void observeAll(Set<T> items)
Observe the items provided.- Parameters:
items
- The set of items to be observed.
-
observe
public void observe(T item)
Observe the value provided.- Parameters:
item
- The item to be observed.
-
topK
public SortedSet<T> topK()
Return the top K values (ordered LOWEST to HIGHEST).- Returns:
- The top K values.
-
bottomK
public SortedSet<T> bottomK()
Return the bottom K values (ordered LOWEST to HIGHEST).- Returns:
- The bottom K values.
-
topKasString
public SortedSet<String> topKasString()
Return the top K values as Strings (ordered HIGHEST to LOWEST).- Returns:
- The top K values as Strings.
-
bottomKasString
public SortedSet<String> bottomKasString()
Return the bottom K values as Strings (ordered LOWEST to HIGHEST).- Returns:
- The bottom K values as Strings.
-
-