root/src/java/com/omniti/reconnoiter/esper/WeightedValueBean.java

Revision c75a2104258a9079bb6ef2dbe68c66e7102bbf16, 0.9 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 8 years ago)

step 2. .noit:derive and .noit:counter, refs #210

  • Property mode set to 100644
Line 
1 package com.omniti.reconnoiter.esper;
2
3 import java.io.Serializable;
4 import java.math.BigDecimal;
5
6 /**
7  * Bean for performing statistical calculations. The bean keeps sums of X and Y datapoints and sums on squares
8  * that can be reused by subclasses. The bean calculates standard deviation (sample and population), variance,
9  * average and sum.
10   */
11 public class WeightedValueBean implements Cloneable, Serializable
12 {
13     private double weight;
14     private double value;
15     private static final long serialVersionUID = 7995123761256377184L;
16
17     public WeightedValueBean(BigDecimal w, BigDecimal v) {
18         weight = (w == null) ? Double.NaN : w.doubleValue();
19         value = (v == null) ? Double.NaN: v.doubleValue();
20     }
21
22     public double getWeight() { return weight; }
23     public double getValue() { return value; }
24     public void setWeight(double w) { weight = w; }
25     public void setValue(double v) { value = v; }
26 }
Note: See TracBrowser for help on using the browser.