Class Statistics

java.lang.Object
marauroa.server.game.Statistics
All Implemented Interfaces:
StatisticsMBean

public class Statistics extends Object implements StatisticsMBean
This class encapsulate everything related to the statistics recollection and storage.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    This class is very similar to a Map with the extra that adds some comodity methods like: add print
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static int
    time between statistics dumps
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add​(String type, int value)
    Adds an attribute to its existing
    long
    get​(String type)
    Return the value of an attribute since the server start.
    static Statistics
    Returns an unique instance of Statistics.
    void
    Print to $statistics_filename file the content of the statistics object.
    void
    set​(String type, int value)
    Sets an attribute

    Methods inherited from class java.lang.Object

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

    • DATABASE_STATISTICS_LAPSUS

      public static final int DATABASE_STATISTICS_LAPSUS
      time between statistics dumps
      See Also:
      Constant Field Values
  • Method Details

    • getStatistics

      public static Statistics getStatistics()
      Returns an unique instance of Statistics. This is a singleton.
      Returns:
      a statistics object
    • set

      public void set(String type, int value)
      Sets an attribute
      Parameters:
      type - attribute name
      value - its value
    • add

      public void add(String type, int value)
      Adds an attribute to its existing
      Parameters:
      type -
      value -
    • get

      public long get(String type)
      Return the value of an attribute since the server start. This method is used by the Bean interface.
      Specified by:
      get in interface StatisticsMBean
      Parameters:
      type - the attribute name
      Returns:
      value
    • print

      public void print()
      Print to $statistics_filename file the content of the statistics object.