/** * Copies object's internal state to another Robin object. * * @param other New Robin object to copy state to * @Thrown in case of I/O error */ public void copyStateTo(RrdUpdater other) { if (other.GetType() != typeof(Robin)) { throw new ArgumentException( "Cannot copy Robin object to " + other.GetType().ToString()); } Robin robin = (Robin)other; int rowsDiff = rows - robin.rows; if (rowsDiff == 0) { // Identical dimensions. Do copy in BULK to speed things up robin.pointer.set(pointer.get()); robin.values.writeBytes(values.readBytes()); } else { // different sizes for (int i = 0; i < robin.rows; i++) { int j = i + rowsDiff; robin.store(j >= 0 ? getValue(j) : Double.NaN); } } }
private void finalizeStep(ArcState state, Robin robin) { // should store long arcSteps = steps.get(); double arcXff = xff.get(); long nanSteps = state.getNanSteps(); //double nanPct = (double) nanSteps / (double) arcSteps; double accumValue = state.getAccumValue(); if (nanSteps <= arcXff * arcSteps && !Double.IsNaN(accumValue)) { if (getConsolFun().CSType == ConsolFun.ConsolFunTypes.AVERAGE) { accumValue /= (arcSteps - nanSteps); } robin.store(accumValue); } else { robin.store(Double.NaN); } state.setAccumValue(Double.NaN); state.setNanSteps(0); }