All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.satori.composer.stats.StatsJsonAggregator Maven / Gradle / Ivy

There is a newer version: 0.1.7
Show newest version
package com.satori.composer.stats;

import com.satori.mods.core.stats.*;

import java.util.*;

import com.fasterxml.jackson.databind.*;

public class StatsJsonAggregator extends StatsAggregator {
  public final String prefix;
  public final HashMap ext;
  
  public StatsJsonAggregator(String prefix, HashMap ext) {
    this.prefix = prefix;
    this.ext = ext;
  }
  
  public StatsJsonMessage drainAsJsonMessage() {
    StatsJsonMessage res = new StatsJsonMessage(prefix, ext);
    sum.forEach((a, m) -> {
      res.records.add(StatsJsonMetric.sum(m));
    });
    avg.forEach((a, m) -> {
      res.records.add(StatsJsonMetric.avg(m));
    });
    norm.forEach((a, m) -> {
      res.records.add(StatsJsonMetric.norm(m));
    });
    series.forEach((a, m) -> {
      res.records.add(StatsJsonMetric.series(m));
    });
    suppress();
    return res;
  }
  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy