Package org.grp1.util

Class Context

java.lang.Object
org.grp1.util.Context

public class Context extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static int
    Represents the count of tracking
    private static long
    Represents the end time of tracking
    private static final HashSet<Integer>
    Represents the set to count the number of distinct things
    private static long
    Represents the start time of tracking
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static void
    add(int addend)
    The function to add the count by some addend
    static void
    addSetInteger(int integer)
    The function to add the integer into the set
    static void
    The function to end the timer
    static int
    The function to get the count
    static long
    The function to get the elapsed time between the start and end time
    static int
    The function to get the set count
    static void
    The function to increment the count
    static void
    The function to reset all the context fields
    static void
    The function to start the timer

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • set

      private static final HashSet<Integer> set
      Represents the set to count the number of distinct things
    • startTime

      private static long startTime
      Represents the start time of tracking
    • endTime

      private static long endTime
      Represents the end time of tracking
    • count

      private static int count
      Represents the count of tracking
  • Constructor Details

    • Context

      public Context()
  • Method Details

    • addSetInteger

      public static void addSetInteger(int integer)
      The function to add the integer into the set
      Parameters:
      integer - The integer key to be added
    • getSetCount

      public static int getSetCount()
      The function to get the set count
      Returns:
      The length of the set
    • increment

      public static void increment()
      The function to increment the count
    • add

      private static void add(int addend)
      The function to add the count by some addend
      Parameters:
      addend - The value that you want to add
    • getCount

      public static int getCount()
      The function to get the count
      Returns:
      The count that we track
    • startTimer

      public static void startTimer()
      The function to start the timer
    • endTimer

      public static void endTimer()
      The function to end the timer
    • getElapsedTime

      public static long getElapsedTime(TimeUnit unit)
      The function to get the elapsed time between the start and end time
      Parameters:
      unit - The of the time
      Returns:
      The time converted into the corresponding unit
    • reset

      public static void reset()
      The function to reset all the context fields