Package tigase.stats

Class MaxDailyCounterQueue<E extends java.lang.Number & java.lang.Comparable<E>>

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.Deque<E>, java.util.Queue<E>

    public class MaxDailyCounterQueue<E extends java.lang.Number & java.lang.Comparable<E>>
    extends java.util.concurrent.ConcurrentLinkedDeque<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
      boolean add​(E added)  
      java.util.Optional<E> getMaxValue()  
      java.util.Optional<E> getMaxValueInRange​(int range)  
      boolean isLimitSurpassed​(int range, E limit)
      Check if any item within range surpass the limit
      boolean isLimitSurpassed​(E limit)
      Check if any item in the collection surpass the limit
      boolean isLimitSurpassedAllItems​(int range, E limit)
      Check if all and every item within range surpass the limit
      boolean isLimitSurpassedAllItems​(E limit)
      Check if all and every item in the collection surpass the limit
      protected boolean isNextItem()  
      java.util.ArrayDeque<E> subQueue​(int range)  
      java.lang.String toString()  
      • Methods inherited from class java.util.concurrent.ConcurrentLinkedDeque

        addAll, addFirst, addLast, clear, 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

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        containsAll, equals, hashCode, parallelStream, stream, toArray
    • Constructor Detail

      • MaxDailyCounterQueue

        public MaxDailyCounterQueue​(int maxQueueLength)
    • Method Detail

      • add

        public boolean add​(E added)
        Specified by:
        add in interface java.util.Collection<E extends java.lang.Number & java.lang.Comparable<E>>
        Specified by:
        add in interface java.util.Deque<E extends java.lang.Number & java.lang.Comparable<E>>
        Specified by:
        add in interface java.util.Queue<E extends java.lang.Number & java.lang.Comparable<E>>
        Overrides:
        add in class java.util.concurrent.ConcurrentLinkedDeque<E extends java.lang.Number & java.lang.Comparable<E>>
      • 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 check
        limit - 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 check
        limit - against which items should be check
        Returns:
        indicating whether all items within range surpass the limit
      • subQueue

        public java.util.ArrayDeque<E> subQueue​(int range)
      • isNextItem

        protected boolean isNextItem()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.util.concurrent.ConcurrentLinkedDeque<E extends java.lang.Number & java.lang.Comparable<E>>