Class ActivityIndex


  • public class ActivityIndex
    extends java.lang.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

    • Constructor Detail

      • ActivityIndex

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

        public ActivityIndex​(java.util.List<FinishedSession> sessions,
                             long date,
                             long playtimeMsThreshold)
      • ActivityIndex

        public ActivityIndex​(double value,
                             long date)
    • Method Detail

      • getDefaultGroups

        public static java.lang.String[] getDefaultGroups()
      • getGroups

        public static java.lang.String[] getGroups​(Locale locale)
      • getValue

        public double getValue()
      • getDate

        public long getDate()
      • getFormattedValue

        public java.lang.String getFormattedValue​(Formatter<java.lang.Double> formatter)
      • getGroup

        public static java.lang.String getGroup​(double value)
      • getGroup

        public java.lang.String getGroup()
      • getGroup

        public java.lang.String getGroup​(Locale locale)