All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.rrd4j.graph.PathIterator Maven / Gradle / Ivy

Go to download

A high performance data logging and graphing system for time series data.

There is a newer version: 3.9
Show newest version
package org.rrd4j.graph;

class PathIterator {
    private double[] y;
    private int pos = 0;

    PathIterator(double[] y) {
        this.y = y;
    }

    int[] getNextPath() {
        while (pos < y.length) {
            if (Double.isNaN(y[pos])) {
                pos++;
            }
            else {
                int endPos = pos + 1;
                while (endPos < y.length && !Double.isNaN(y[endPos])) {
                    endPos++;
                }
                int[] result = {pos, endPos};
                pos = endPos;
                if (result[1] - result[0] >= 2) {
                    return result;
                }
            }
        }
        return null;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy