Package net.sourceforge.stat4j

Examples of net.sourceforge.stat4j.Calculator


  public Calculator createCalculator(String name, Statistic statistic) {
    String prefix = "calculator." + name + ".";
    //System.out.println(prefix + "classname");
    String className = bundle.getString(prefix + "classname");
    Calculator c = (Calculator) Util.createObject(className);
    Properties p = Util.createProperties(prefix);
    c.init(name, p);
    c.setStatistic(statistic);
    return c;
  }
View Full Code Here


   */
  public void reset() {
    Iterator itr = calculators.keySet().iterator();
    while (itr.hasNext()) {
      Object key = itr.next();
      Calculator c = (Calculator) calculators.get(key);
      c.reset();
    }
  }
View Full Code Here

    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
View Full Code Here

    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

    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

  public void report(PrintStream out) {
    Calculator[] calcs =
      (Calculator[]) calculators.values().toArray(new Calculator[0]);
    for (int i = 0; i < calcs.length; ++i) {
      Calculator calculator = calcs[i];
      double result = calculator.getResult();
      long ts = calculator.getTimestamp();

      out.print(
        "Statistic("
          + calculator.getStatistic().getDescription()
          + ") value("
          + result
          + ") time ("
          + new Date(ts)
          + ")\n");
View Full Code Here

TOP

Related Classes of net.sourceforge.stat4j.Calculator

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.