void setAccumValue(double value) throws IOException { accumValue.set(value); }
void setAccumValue(double value) throws IOException { accumValue.set(value); }
/** * Sets X-files factor to a new value. * * @param xff New X-files factor value. Must be >= 0 and < 1. * @throws java.io.IOException Thrown in case of I/O error */ public void setXff(double xff) throws IOException { if (xff < 0D || xff >= 1D) { throw new IllegalArgumentException("Invalid xff supplied (" + xff + "), must be >= 0 and < 1"); } this.xff.set(xff); }
/** * Sets X-files factor to a new value. * * @param xff New X-files factor value. Must be >= 0 and < 1. * @throws IOException Thrown in case of I/O error */ public void setXff(double xff) throws IOException { if (xff < 0D || xff >= 1D) { throw new IllegalArgumentException("Invalid xff supplied (" + xff + "), must be >= 0 and < 1"); } this.xff.set(xff); }
/** * Copies object's internal state to another ArcState object. * * @param other New ArcState object to copy state to * @throws IOException Thrown in case of I/O error */ public void copyStateTo(RrdUpdater other) throws IOException { if (!(other instanceof ArcState)) { throw new IllegalArgumentException("Cannot copy ArcState object to " + other.getClass().getName()); } ArcState arcState = (ArcState) other; arcState.accumValue.set(accumValue.get()); arcState.nanSteps.set(nanSteps.get()); }
private void accumulate(long oldTime, long newTime, double updateValue) throws IOException { if (Double.isNaN(updateValue)) { nanSeconds.set(nanSeconds.get() + (newTime - oldTime)); } else { accumValue.set(accumValue.get() + updateValue * (newTime - oldTime)); accumLastValue = updateValue; } }
private void accumulate(long oldTime, long newTime, double updateValue) throws IOException { if (Double.isNaN(updateValue)) { nanSeconds.set(nanSeconds.get() + (newTime - oldTime)); } else { accumValue.set(accumValue.get() + updateValue * (newTime - oldTime)); } }
/** * {@inheritDoc} * * Copies object's internal state to another ArcState object. */ public void copyStateTo(ArcState arcState) throws IOException { arcState.accumValue.set(accumValue.get()); arcState.nanSteps.set(nanSteps.get()); }
Datasource(RrdDb parentDb, DataImporter reader, int dsIndex) throws IOException { this(parentDb, null); dsName.set(reader.getDsName(dsIndex)); dsType.set(reader.getDsType(dsIndex)); heartbeat.set(reader.getHeartbeat(dsIndex)); minValue.set(reader.getMinValue(dsIndex)); maxValue.set(reader.getMaxValue(dsIndex)); lastValue.set(reader.getLastValue(dsIndex)); accumValue.set(reader.getAccumValue(dsIndex)); nanSeconds.set(reader.getNanSeconds(dsIndex)); }
Datasource(RrdDb parentDb, DataImporter reader, int dsIndex) throws IOException { this(parentDb, null); dsName.set(reader.getDsName(dsIndex)); dsType.set(reader.getDsType(dsIndex)); heartbeat.set(reader.getHeartbeat(dsIndex)); minValue.set(reader.getMinValue(dsIndex)); maxValue.set(reader.getMaxValue(dsIndex)); lastValue.set(reader.getLastValue(dsIndex)); accumValue.set(reader.getAccumValue(dsIndex)); nanSeconds.set(reader.getNanSeconds(dsIndex)); }
/** * Copies object's internal state to another Datasource object. * * @param other New Datasource object to copy state to * @throws IOException Thrown in case of I/O error */ public void copyStateTo(RrdUpdater other) throws IOException { if (!(other instanceof Datasource)) { throw new IllegalArgumentException( "Cannot copy Datasource object to " + other.getClass().getName()); } Datasource datasource = (Datasource) other; if (!datasource.dsName.get().equals(dsName.get())) { throw new IllegalArgumentException("Incompatible datasource names"); } if (!datasource.dsType.get().equals(dsType.get())) { throw new IllegalArgumentException("Incompatible datasource types"); } datasource.lastValue.set(lastValue.get()); datasource.nanSeconds.set(nanSeconds.get()); datasource.accumValue.set(accumValue.get()); }
/** * {@inheritDoc} * * Copies object's internal state to another Datasource object. */ public void copyStateTo(Datasource datasource) throws IOException { if (!datasource.dsName.get().equals(dsName.get())) { throw new IllegalArgumentException("Incompatible datasource names"); } if (datasource.dsType.get() != dsType.get()) { throw new IllegalArgumentException("Incompatible datasource types"); } datasource.lastValue.set(lastValue.get()); datasource.nanSeconds.set(nanSeconds.get()); datasource.accumValue.set(accumValue.get()); }
/** * Sets minimum allowed value for this datasource. If <code>filterArchivedValues</code> * argument is set to true, all archived values less then <code>minValue</code> will * be fixed to NaN. * * @param minValue New minimal value. Specify <code>Double.NaN</code> if no minimal * value should be set * @param filterArchivedValues true, if archived datasource values should be fixed; * false, otherwise. * @throws java.io.IOException Thrown in case of I/O error * @throws java.lang.IllegalArgumentException Thrown if invalid minValue was supplied (not less then maxValue) */ public void setMinValue(double minValue, boolean filterArchivedValues) throws IOException { double maxValue = this.maxValue.get(); if (!Double.isNaN(minValue) && !Double.isNaN(maxValue) && minValue >= maxValue) { throw new IllegalArgumentException(INVALID_MIN_MAX_VALUES + minValue + "/" + maxValue); } this.minValue.set(minValue); if (!Double.isNaN(minValue) && filterArchivedValues) { int dsIndex = getDsIndex(); Archive[] archives = parentDb.getArchives(); for (Archive archive : archives) { archive.getRobin(dsIndex).filterValues(minValue, Double.NaN); } } }
/** * Sets maximum allowed value for this datasource. If <code>filterArchivedValues</code> * argment is set to true, all archived values greater then <code>maxValue</code> will * be fixed to NaN. * * @param maxValue New maximal value. Specify <code>Double.NaN</code> if no max * value should be set. * @param filterArchivedValues true, if archived datasource values should be fixed; * false, otherwise. * @throws IOException Thrown in case of I/O error * @throws IllegalArgumentException Thrown if invalid maxValue was supplied (not greater then minValue) */ public void setMaxValue(double maxValue, boolean filterArchivedValues) throws IOException { double minValue = this.minValue.get(); if (!Double.isNaN(minValue) && !Double.isNaN(maxValue) && minValue >= maxValue) { throw new IllegalArgumentException("Invalid min/max values: " + minValue + "/" + maxValue); } this.maxValue.set(maxValue); if (!Double.isNaN(maxValue) && filterArchivedValues) { int dsIndex = getDsIndex(); Archive[] archives = parentDb.getArchives(); for (Archive archive : archives) { archive.getRobin(dsIndex).filterValues(Double.NaN, maxValue); } } }
public void setDsType(DsType newDsType) throws IOException { // set datasource type this.dsType.set(newDsType.name()); // reset datasource status lastValue.set(Double.NaN); accumValue.set(0.0); // reset archive status int dsIndex = parentDb.getDsIndex(dsName.get()); Archive[] archives = parentDb.getArchives(); for (Archive archive : archives) { archive.getArcState(dsIndex).setAccumValue(Double.NaN); } }
/** * <p>Setter for the field <code>dsType</code>.</p> * * @param newDsType a {@link org.rrd4j.DsType} object. * @throws java.io.IOException if any. */ public void setDsType(DsType newDsType) throws IOException { // set datasource type dsType.set(newDsType); // reset datasource status lastValue.set(Double.NaN); accumValue.set(0.0); // reset archive status int dsIndex = parentDb.getDsIndex(dsName.get()); Archive[] archives = parentDb.getArchives(); for (Archive archive : archives) { archive.getArcState(dsIndex).setAccumValue(Double.NaN); } }
Datasource(RrdDb parentDb, DsDef dsDef) throws IOException { boolean shouldInitialize = dsDef != null; this.parentDb = parentDb; dsName = new RrdString(this); dsType = new RrdString(this); heartbeat = new RrdLong(this); minValue = new RrdDouble(this); maxValue = new RrdDouble(this); lastValue = new RrdDouble(this); accumValue = new RrdDouble(this); nanSeconds = new RrdLong(this); if (shouldInitialize) { dsName.set(dsDef.getDsName()); dsType.set(dsDef.getDsType().name()); heartbeat.set(dsDef.getHeartbeat()); minValue.set(dsDef.getMinValue()); maxValue.set(dsDef.getMaxValue()); lastValue.set(Double.NaN); accumValue.set(0.0); Header header = parentDb.getHeader(); nanSeconds.set(header.getLastUpdateTime() % header.getStep()); } }
Datasource(RrdDb parentDb, DsDef dsDef) throws IOException { boolean shouldInitialize = dsDef != null; this.parentDb = parentDb; dsName = new RrdString<>(this); dsType = new RrdEnum<>(this, DsType.class); heartbeat = new RrdLong<>(this); minValue = new RrdDouble<>(this); maxValue = new RrdDouble<>(this); lastValue = new RrdDouble<>(this); accumValue = new RrdDouble<>(this); nanSeconds = new RrdLong<>(this); accumLastValue = Double.NaN; if (shouldInitialize) { dsName.set(dsDef.getDsName()); dsType.set(dsDef.getDsType()); heartbeat.set(dsDef.getHeartbeat()); minValue.set(dsDef.getMinValue()); maxValue.set(dsDef.getMaxValue()); lastValue.set(Double.NaN); accumValue.set(0.0); Header header = parentDb.getHeader(); nanSeconds.set(header.getLastUpdateTime() % header.getStep()); } }
ArcState(Archive parentArc, boolean shouldInitialize) throws IOException { this.parentArc = parentArc; accumValue = new RrdDouble<>(this); nanSteps = new RrdLong<>(this); if (shouldInitialize) { Header header = parentArc.getParentDb().getHeader(); long step = header.getStep(); long lastUpdateTime = header.getLastUpdateTime(); long arcStep = parentArc.getArcStep(); long initNanSteps = (Util.normalize(lastUpdateTime, step) - Util.normalize(lastUpdateTime, arcStep)) / step; accumValue.set(Double.NaN); nanSteps.set(initNanSteps); } }
ArcState(Archive parentArc, boolean shouldInitialize) throws IOException { this.parentArc = parentArc; accumValue = new RrdDouble(this); nanSteps = new RrdLong(this); if (shouldInitialize) { Header header = parentArc.getParentDb().getHeader(); long step = header.getStep(); long lastUpdateTime = header.getLastUpdateTime(); long arcStep = parentArc.getArcStep(); long initNanSteps = (Util.normalize(lastUpdateTime, step) - Util.normalize(lastUpdateTime, arcStep)) / step; accumValue.set(Double.NaN); nanSteps.set(initNanSteps); } }