Package esmska.update
Class Statistics
- java.lang.Object
-
- esmska.update.Statistics
-
public class Statistics extends java.lang.ObjectClass handling everything needed about collecting and posting program usage statistics.
-
-
Constructor Summary
Constructors Constructor Description Statistics()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static net.sf.json.JSONObjectcollectUsageInfo()Collect program usage info and return it as a JSON object.static voidrefreshUUID()If the UUID hasn't already been changed this month, changes it.static voidsendUsageInfo()Send program usage info to Esmska server if appropriate (check withshouldSend())static booleanshouldSend()Decide whether to send statistics to Esmska server or not.
-
-
-
Method Detail
-
refreshUUID
public static void refreshUUID()
If the UUID hasn't already been changed this month, changes it. Otherwise does nothing.
-
collectUsageInfo
public static net.sf.json.JSONObject collectUsageInfo()
Collect program usage info and return it as a JSON object.
-
sendUsageInfo
public static void sendUsageInfo()
Send program usage info to Esmska server if appropriate (check withshouldSend())
-
shouldSend
public static boolean shouldSend()
Decide whether to send statistics to Esmska server or not. We don't want to send stats too often so that the server is not overloaded. The current decision algorithm:- If this is the first time Esmska was ever started, don't send anything.
- If this is the first time Esmska was started in current month, always send.
- If today is 20th or earlier day in the current month, send stats at maximum once per 5 days (check last submission date and decide).
- If today is 21th or later day in the current month, send stats at maximum once per 3 days (check last submission date and decide).
- Returns:
- whether it is appropriate to send stats now or not
-
-