/** * Return distribution of mean for results. * * @return distribution of mean */ public DataDistribution distribution() { DataDistribution distro = new DataDistribution(binDistro.binNumber, binDistro.binMin, binDistro.binSize); for (int i = 0; i < results.size(); i++) distro.writeBin(i, ((Result) results.get(i)).mean); return distro; }
/** * Constructor. * * @param binDistro binnning distribution * @param option indicate options * @see #OPT_MEANONLY * @see #OPT_MEANNVAR * @see #OPT_FULLLOG */ public ResultBins(DataDistribution binDistro, int option) { this.binDistro = binDistro; for (int i = 0; i < binDistro.binNumber; i++) switch (option) { case OPT_MEANONLY: results.add(new Result()); break; case OPT_MEANNVAR: results.add(new ResultVar()); break; case OPT_FULLLOG: results.add(new ResultFullLog()); break; default: throw new RuntimeException(this + " received unknown option " + option + "!"); } }
/** * Input values. * * @param binValue value to decide bin with * @param value value to bin */ public void input(double binValue, double value) { if (debug) System.out.println("Adding " + value + " to bin with value " + binValue); int binIndex = binDistro.binIndex(binValue); ((Result) results.get(binIndex)).input(value); }