public void reset() { Statistic[] stats = getStatistics(); int size = stats.length; for (int i = 0; i < size; i++) { Statistic stat = stats[i]; if (stat instanceof Resettable) { Resettable r = (Resettable) stat; r.reset(); } } }
public Statistic getStatistic(String name) { for (StatisticImpl stat : this.set) { if (stat.getName() != null && stat.getName().equals(name)) { return stat; } } return null; }
@SuppressWarnings("unchecked") protected StatsSimplifier(Class<T> type) { super(type); addExtractor("statistics", new AttributeExtractor<T>() { public Object extract(Stats value) throws SkipAttributeException { Map<String, Statistic> result = new HashMap<String, Statistic>(); for (String name : value.getStatisticNames()) { result.put(name, value.getStatistic(name)); } return result; } }); }
public Statistic[] getStatistics() { Statistic[] answer = new Statistic[this.set.size()]; set.toArray(answer); return answer; }
@SuppressWarnings("unchecked") public StatisticSimplifier() { this((Class<T>) Statistic.class); }
@Override public final Statistic getStatistic(String statisticName) { // TODO throw new UnsupportedOperationException(); }
@Override public final Statistic[] getStatistics() { // TODO throw new UnsupportedOperationException(); }