Package tigase.stats

Class MaxDailyCounterQueue<E extends Number & Comparable<E>>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<E>
tigase.stats.MaxDailyCounterQueue<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, Queue<E>

public class MaxDailyCounterQueue<E extends Number & Comparable<E>> extends AbstractQueue<E>
A queue implementation which stores highest added value on a given day and has limited size.
  • Constructor Details

    • MaxDailyCounterQueue

      public MaxDailyCounterQueue(int maxQueueLength)
  • Method Details

    • getMaxValue

      public Optional<E> getMaxValue()
    • getMaxValueInRange

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

      public ArrayDeque<E> subQueue(int range)
    • toString

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

      protected boolean isNextItem()