Package 

Class LastN_HitCounter


  • 
    public class LastN_HitCounter
    
                        

    Fuji * Reve Systems * 2022 * Sometimes we wanna track the count of how many times a event has been happened in last n millis. This class is here to solve this exact problem. At first we have to create a object of this class passing the time values in millis which is the last duration for which we want the count

    • Constructor Summary

      Constructors 
      Constructor Description
      LastN_HitCounter(int millis) initializing the timestamps linkedlist
    • Method Summary

      Modifier and Type Method Description
      void hit() this method should be called everytime an event occurs which we wanna track
      int getLastN_Count() firstly we have to delete older values and then return the linkedlist size
      static void main(Array<String> args)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LastN_HitCounter

        LastN_HitCounter(int millis)
        initializing the timestamps linkedlist
        Parameters:
        millis - is the last time duration
    • Method Detail

      • hit

         void hit()

        this method should be called everytime an event occurs which we wanna track

      • getLastN_Count

         int getLastN_Count()

        firstly we have to delete older values and then return the linkedlist size