Package org.grp1.util
Class Context
java.lang.Object
org.grp1.util.Context
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static intRepresents the count of trackingprivate static longRepresents the end time of trackingRepresents the set to count the number of distinct thingsprivate static longRepresents the start time of tracking -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidadd(int addend) The function to add the count by some addendstatic voidaddSetInteger(int integer) The function to add the integer into the setstatic voidendTimer()The function to end the timerstatic intgetCount()The function to get the countstatic longgetElapsedTime(TimeUnit unit) The function to get the elapsed time between the start and end timestatic intThe function to get the set countstatic voidThe function to increment the countstatic voidreset()The function to reset all the context fieldsstatic voidThe function to start the timer
-
Field Details
-
set
Represents the set to count the number of distinct things -
startTime
private static long startTimeRepresents the start time of tracking -
endTime
private static long endTimeRepresents the end time of tracking -
count
private static int countRepresents 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
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
-