Example usage for org.jfree.data Range isNaNRange

List of usage examples for org.jfree.data Range isNaNRange

Introduction

In this page you can find the example usage for org.jfree.data Range isNaNRange.

Prototype

public boolean isNaNRange() 

Source Link

Document

Returns true if both the lower and upper bounds are Double.NaN, and false otherwise.

Usage

From source file:org.jfree.data.Range.java

/**
 * Returns a new range that spans both <code>range1</code> and 
 * <code>range2</code>.  This method has a special handling to ignore
 * Double.NaN values./*w  ww.  ja  v a  2s  .  c  om*/
 *
 * @param range1  the first range (<code>null</code> permitted).
 * @param range2  the second range (<code>null</code> permitted).
 *
 * @return A new range (possibly <code>null</code>).
 *
 * @since 1.0.15
 */
public static Range combineIgnoringNaN(Range range1, Range range2) {
    if (range1 == null) {
        if (range2 != null && range2.isNaNRange()) {
            return null;
        }
        return range2;
    }
    if (range2 == null) {
        if (range1.isNaNRange()) {
            return null;
        }
        return range1;
    }
    double l = min(range1.getLowerBound(), range2.getLowerBound());
    double u = max(range1.getUpperBound(), range2.getUpperBound());
    if (Double.isNaN(l) && Double.isNaN(u)) {
        return null;
    }
    return new Range(l, u);
}