Package net.sourceforge.stat4j

Examples of net.sourceforge.stat4j.Statistic


    return a;
  }

  public Statistic createStatistic(String name) {
    String prefix = "statistic." + name + ".";
    Statistic s = new Statistic();
    Properties p = Util.createProperties(prefix);
    s.init(name, p);
    return s;
  }
View Full Code Here


        int dot = key.indexOf('.', prefix.length());
        String name = key.substring(prefix.length(), dot);

        if (!stats.containsKey(name)) {

          Statistic s = createStatistic(name);
          stats.put(name, s);
        }
      } //fi
    } // end while
    return (Statistic[]) stats.values().toArray(new Statistic[0]);
View Full Code Here

    HashMap filterMap = new HashMap();

    // Map statistics
    for (int i = 0; i < stats.length; ++i) {
      Statistic s = stats[i];

      statistics.put(s.getName(), s);

      Calculator c = factory.createCalculator(s.getCalculator(), s);
      calculators.put(s.getName(), c);

      // Map filters by regexpression
      // to ensure we only match on a given
      // expression once
      String matchExp = s.getFirst().getMatch();
      FilterStatisticMap f = (FilterStatisticMap) filterMap.get(matchExp);
      if (f == null) {
        f = new FilterStatisticMap(matchExp);
        filterMap.put(matchExp, f);
      }
      f.getFirsts().add(s);

      if (s.getSecond() != null) {

        matchExp = s.getSecond().getMatch();
        f = (FilterStatisticMap) filterMap.get(matchExp);
        if (f == null) {
          f = new FilterStatisticMap(matchExp);
          filterMap.put(matchExp, f);
        }
View Full Code Here

    FilterStatisticMap filter,
    String log) {

    ArrayList seconds = filter.getSeconds();
    for (int i = 0; i < seconds.size(); ++i) {
      Statistic statistic = (Statistic) seconds.get(i);

      // Get Calculator
      Calculator calculator =
        (Calculator) calculators.get(statistic.getName());

      // Generate Reading
      Reading reading =
        generateReading(statistic, statistic.getSecond(), log);
      if (reading == null)
        continue;

      if (calculator.isApplyImmediate()) {
        Metric metric = new Metric(statistic.getName(), null, reading);
        calculateStatistic(calculator, metric);

      } else {
        matchReading(statistic, calculator, reading);
      }
View Full Code Here

  private void processReadingsThatMatchFirstFilters(
    FilterStatisticMap filter,
    String log) {
    ArrayList firsts = filter.getFirsts();
    for (int i = 0; i < firsts.size(); ++i) {
      Statistic statistic = (Statistic) firsts.get(i);

      // Get Calculator
      Calculator calculator =
        (Calculator) calculators.get(statistic.getName());

      // Generate Reading
      Reading reading =
        generateReading(statistic, statistic.getFirst(), log);
      if (reading == null)
        continue;

      if (calculator.isApplyImmediate()) {
        Metric metric = new Metric(statistic.getName(), reading);
        calculateStatistic(calculator, metric);

      } else {
        cacheReading(statistic, reading);
      }
View Full Code Here

TOP

Related Classes of net.sourceforge.stat4j.Statistic

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.