Package tigase.stats
Class MaxDailyCounterQueue<E extends Number & Comparable<E>>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.ArrayDeque<E>
-
- tigase.stats.MaxDailyCounterQueue<E>
-
- Type Parameters:
E-
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<E>,Collection<E>,Deque<E>,Queue<E>
public class MaxDailyCounterQueue<E extends Number & Comparable<E>> extends ArrayDeque<E>
A queue implementation which stores highest added value on a given day and has limited size.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MaxDailyCounterQueue(int maxQueueLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(E added)Optional<E>getMaxValue()Optional<E>getMaxValueInRange(int range)booleanisLimitSurpassed(int range, E limit)Check if any item within range surpass the limitbooleanisLimitSurpassed(E limit)Check if any item in the collection surpass the limitbooleanisLimitSurpassedAllItems(int range, E limit)Check if all and every item within range surpass the limitbooleanisLimitSurpassedAllItems(E limit)Check if all and every item in the collection surpass the limitprotected booleanisNextItem()ArrayDeque<E>subQueue(int range)StringtoString()-
Methods inherited from class java.util.ArrayDeque
addAll, addFirst, addLast, clear, clone, contains, descendingIterator, element, forEach, getFirst, getLast, isEmpty, iterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, removeAll, removeFirst, removeFirstOccurrence, removeIf, removeLast, removeLastOccurrence, retainAll, size, spliterator, toArray, toArray
-
Methods inherited from class java.util.AbstractCollection
containsAll
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
containsAll, equals, hashCode, parallelStream, stream, toArray
-
-
-
-
Method Detail
-
add
public boolean add(E added)
- Specified by:
addin interfaceCollection<E extends Number & Comparable<E>>- Specified by:
addin interfaceDeque<E extends Number & Comparable<E>>- Specified by:
addin interfaceQueue<E extends Number & Comparable<E>>- Overrides:
addin classArrayDeque<E extends Number & Comparable<E>>
-
isLimitSurpassed
public boolean isLimitSurpassed(E limit)
Check if any item in the collection surpass the limit- Parameters:
limit- against which items should be check- Returns:
- indicating whether any item in the collection surpass the limit
-
isLimitSurpassed
public boolean isLimitSurpassed(int range, E limit)Check if any item within range surpass the limit- Parameters:
range- number of items to checklimit- against which items should be check- Returns:
- indicating whether any item within range surpass the limit
-
isLimitSurpassedAllItems
public boolean isLimitSurpassedAllItems(E limit)
Check if all and every item in the collection surpass the limit- Parameters:
limit- against which items should be check- Returns:
- indicating whether all items in the collection surpass the limit
-
isLimitSurpassedAllItems
public boolean isLimitSurpassedAllItems(int range, E limit)Check if all and every item within range surpass the limit- Parameters:
range- number of items to checklimit- against which items should be check- Returns:
- indicating whether all items within range surpass the limit
-
subQueue
public ArrayDeque<E> subQueue(int range)
-
isNextItem
protected boolean isNextItem()
-
toString
public String toString()
- Overrides:
toStringin classAbstractCollection<E extends Number & Comparable<E>>
-
-