Package tigase.stats

Class MaxDailyCounterQueue<E extends java.lang.Number & java.lang.Comparable<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)  
      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.Iterator<E> iterator()  
      boolean offer​(E added)  
      E peek()  
      E poll()  
      int size()  
      java.util.ArrayDeque<E> subQueue​(int range)  
      java.lang.String toString()  
      • Methods inherited from class java.util.AbstractQueue

        add, addAll, clear, element, remove
      • 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
      • Methods inherited from interface java.util.Collection

        contains, containsAll, equals, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
    • Constructor Detail

      • MaxDailyCounterQueue

        public MaxDailyCounterQueue​(int maxQueueLength)
    • 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 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
      • iterator

        public java.util.Iterator<E> iterator()
        Specified by:
        iterator in interface java.util.Collection<E extends java.lang.Number & java.lang.Comparable<E>>
        Specified by:
        iterator in interface java.lang.Iterable<E extends java.lang.Number & java.lang.Comparable<E>>
        Specified by:
        iterator in class java.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()
        Specified by:
        size in interface java.util.Collection<E extends java.lang.Number & java.lang.Comparable<E>>
        Specified by:
        size in class java.util.AbstractCollection<E extends java.lang.Number & java.lang.Comparable<E>>
      • subQueue

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

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

        protected boolean isNextItem()