Package tigase.stats
Class MaxDailyCounterQueue<E extends java.lang.Number & java.lang.Comparable<E>>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<E>
-
- tigase.stats.MaxDailyCounterQueue<E>
-
- All Implemented Interfaces:
java.lang.Iterable<E>,java.util.Collection<E>,java.util.Queue<E>
public class MaxDailyCounterQueue<E extends java.lang.Number & java.lang.Comparable<E>> extends java.util.AbstractQueue<E>A queue implementation which stores highest added value on a given day and has limited size.
-
-
Constructor Summary
Constructors Constructor Description MaxDailyCounterQueue(int maxQueueLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<E>getMaxValue()java.util.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()java.util.Iterator<E>iterator()booleanoffer(E added)Epeek()Epoll()intsize()java.util.ArrayDeque<E>subQueue(int range)java.lang.StringtoString()-
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Method Detail
-
getMaxValue
public java.util.Optional<E> getMaxValue()
-
getMaxValueInRange
public java.util.Optional<E> getMaxValueInRange(int range)
-
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
-
iterator
public java.util.Iterator<E> iterator()
- Specified by:
iteratorin interfacejava.util.Collection<E extends java.lang.Number & java.lang.Comparable<E>>- Specified by:
iteratorin interfacejava.lang.Iterable<E extends java.lang.Number & java.lang.Comparable<E>>- Specified by:
iteratorin classjava.util.AbstractCollection<E extends java.lang.Number & java.lang.Comparable<E>>
-
offer
public boolean offer(E added)
-
peek
public E peek()
-
poll
public E poll()
-
size
public int size()
-
subQueue
public java.util.ArrayDeque<E> subQueue(int range)
-
toString
public java.lang.String toString()
-
isNextItem
protected boolean isNextItem()
-
-