/** * Adds the value to the dataset. If the dataset is at the maximum size * (i.e., the number of stored elements equals the currently configured * windowSize), the first (oldest) element in the dataset is discarded * to make room for the new value. * * @param v the value to be added */ public void addValue(double v) { if (windowSize != INFINITE_WINDOW) { if (getN() == windowSize) { eDA.addElementRolling(v); } else if (getN() < windowSize) { eDA.addElement(v); } } else { eDA.addElement(v); } }
public void increment(double value, double frequency){ for(int w=0;w<frequency;w++){ data.addElement(value); } }
/** * Incrementally counts the number of observations in each bin. The value is counted only in the bin to which * it belongs. * * @param value a value to be counted in a bin. */ public void increment(double value){ data.addElement(value); }
/** * Adds the value to the dataset. If the dataset is at the maximum size * (i.e., the number of stored elements equals the currently configured * windowSize), the first (oldest) element in the dataset is discarded * to make room for the new value. * * @param v the value to be added */ public void addValue(double v) { if (windowSize != INFINITE_WINDOW) { if (getN() == windowSize) { eDA.addElementRolling(v); } else if (getN() < windowSize) { eDA.addElement(v); } } else { eDA.addElement(v); } }
public void increment(double x, int y){ this.x.addElement(x); this.y.addElement((double)y); }
public void setData(double[] x){ if(data!=null)data.clear(); for(int i=0;i<x.length;i++){ data.addElement(x[i]); } }
doubles.addElement(Double.parseDouble(((SingleValueField) field).valueForSubject(subject, null))); }catch (IncomputableFieldException e){ log.warn("Incomputable field not included in statistics for subject {} ({})",
private Double aggregateSubjects(MathArrays.Function aggregator, List<Subject> aggregationSubjects) throws IncomputableFieldException { ResizableDoubleArray doubles = new ResizableDoubleArray(); for (Subject subject : aggregationSubjects) { String value = null; try { value = singleValueField.valueForSubject(subject, true); doubles.addElement(Double.parseDouble(value)); } catch (IncomputableFieldException e) { log.warn("Incomputable field not included in aggregation for subject {} ({})", subject.getName(), subject.getId()); } catch (NullPointerException | NumberFormatException e) { log.warn("Incomputable field not included in aggregation for subject {} ({}), value {} cannot be " + "converted to numeric type.", subject.getName(), subject.getId(), value); } } Double retVal = doubles.compute(aggregator); if (retVal.isNaN()) { throw new IncomputableFieldException(String.format("Aggregation function %s returned NaN (any " + "NaN values in the set? or trying to operate on an empty set?)", function)); } else if (retVal.isInfinite()) { throw new IncomputableFieldException(String.format("Aggregation function %s returned Infinity (possible division by zero?)", function)); } return retVal; }