Class PlayersOnlineResolver

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Long,​java.lang.Integer>, java.util.NavigableMap<java.lang.Long,​java.lang.Integer>, java.util.SortedMap<java.lang.Long,​java.lang.Integer>

    public class PlayersOnlineResolver
    extends java.util.TreeMap<java.lang.Long,​java.lang.Integer>
    Resolves dates into players online numbers with a help of a NavigableMap.

    Time Complexity of O(n / 2) with the use of TreeMap.

    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int findLonelyJoins​(java.util.List<java.lang.Long> joinDates)  
      java.util.Optional<java.lang.Integer> getOnlineOn​(long date)  
      boolean isServerOnline​(long date, long timeLimit)  
      • Methods inherited from class java.util.TreeMap

        ceilingEntry, ceilingKey, clear, clone, comparator, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, forEach, get, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, put, putAll, remove, replace, replace, replaceAll, size, subMap, subMap, tailMap, tailMap, values
      • Methods inherited from class java.util.AbstractMap

        equals, hashCode, isEmpty, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, equals, getOrDefault, hashCode, isEmpty, merge, putIfAbsent, remove
    • Constructor Detail

      • PlayersOnlineResolver

        public PlayersOnlineResolver​(TPSMutator mutator)
    • Method Detail

      • getOnlineOn

        public java.util.Optional<java.lang.Integer> getOnlineOn​(long date)
      • findLonelyJoins

        public int findLonelyJoins​(java.util.List<java.lang.Long> joinDates)
      • isServerOnline

        public boolean isServerOnline​(long date,
                                      long timeLimit)