Class ActivityIndex

java.lang.Object
com.djrapitops.plan.delivery.domain.mutators.ActivityIndex

public class ActivityIndex extends Object
Represents Activity index of a player at a certain date.

Old formula for activity index was not linear and difficult to turn into a query due to conditional multipliers. Thus a new formula was written.

T - Time played after someone is considered active on a particular week t1, t2, t3 - Time played that week

Activity index takes into account last 3 weeks.

Activity for a single week is calculated using A(t) = (1 / (pi/2 * (t/T) + 1)). A(t) is based on function f(x) = 1 / (x + 1), which has property f(0) = 1, decreasing from there, but not in a straight line. You can see the function plotted here https://www.wolframalpha.com/input/?i=1+%2F+(x%2B1)+from+-1+to+2

To fine tune the curve pi/2 is used since it felt like a good curve.

Activity index A is calculated by using the formula: A = 5 - 5 * [A(t1) + A(t2) + A(t3)] / 3

Plot for A and limits https://www.wolframalpha.com/input/?i=plot+y+%3D+5+-+5+*+(1+%2F+(pi%2F2+*+x%2B1))+and+y+%3D1+and+y+%3D+2+and+y+%3D+3+and+y+%3D+3.75+from+-0.5+to+3

New Limits for A would thus be < 1: Inactive > 1: Irregular > 2: Regular > 3: Active > 3.75: Very Active

  • Field Details

  • Constructor Details

    • ActivityIndex

      public ActivityIndex(DataContainer container, long date, long playtimeMsThreshold)
    • ActivityIndex

      public ActivityIndex(List<FinishedSession> sessions, long date, long playtimeMsThreshold)
    • ActivityIndex

      public ActivityIndex(double value, long date)
  • Method Details

    • getDefaultGroups

      public static String[] getDefaultGroups()
    • getGroups

      public static String[] getGroups(Locale locale)
    • getValue

      public double getValue()
    • getDate

      public long getDate()
    • getFormattedValue

      public String getFormattedValue(Formatter<Double> formatter)
    • distance

      public double distance(ActivityIndex other)
    • getGroup

      public static String getGroup(double value)
    • getGroup

      public String getGroup()
    • getGroup

      public String getGroup(Locale locale)