jenes.statistics
Class StatisticsLogger
java.lang.Object
jenes.statistics.StatisticsLogger
public class StatisticsLogger
- extends java.lang.Object
This class provides an utility wrapper for logging the statistics.
In order to log statistics, the class has to extend LoggableStatistics
in order to automatically retrieve figures. Figures are provided by methods returning
double
value figures and annotated as @Loggable.
For example:
class MyStatistics extends LoggableStatistics {
...
@Loggable("SomeFigure")
double getSomeValue() { ... }
...
@Loggable("SomeCount")
double getSomeCount() { ... }
...
}
Statistics are passed to the logger as specified at instantiation time.
- Author:
- Luigi Troiano
- See Also:
StatisticsLogger.LoggableStatistics
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StatisticsLogger
public StatisticsLogger(AbstractLogger logger,
java.lang.String... figures)
- Creastes a StatisticsLogger. If figures is empty, no filter is applied
and all statistics are able to be saved.
- Parameters:
logger
- - the logger used to save the statisticsfigures
- - the figures that we are interested to save
record
public void record(StatisticsLogger.LoggableStatistics statistics)
- Store a new statistic record in the logger.
- Parameters:
statistics
- - the statistics being logged.
getLogger
public AbstractLogger getLogger()
- Returns the logger used for storing the statistics.
- Returns:
- the logger
save
public void save()
- Saves the undelying logger.
close
public void close()
- Closes the undelying logger.
finalize
protected void finalize()
- Overrides:
finalize
in class java.lang.Object