Java Code Examples for org.jfree.data.xy.IntervalXYDataset#getEndXValue()

The following examples show how to use org.jfree.data.xy.IntervalXYDataset#getEndXValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClusteredXYBarRenderer.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Iterates over the items in an {@link IntervalXYDataset} to find
 * the range of x-values including the interval OFFSET so that it centers
 * the interval around the start value.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The range (possibly <code>null</code>).
 */
protected Range findDomainBoundsWithOffset(IntervalXYDataset dataset) {
    ParamChecks.nullNotPermitted(dataset, "dataset");
    double minimum = Double.POSITIVE_INFINITY;
    double maximum = Double.NEGATIVE_INFINITY;
    int seriesCount = dataset.getSeriesCount();
    double lvalue;
    double uvalue;
    for (int series = 0; series < seriesCount; series++) {
        int itemCount = dataset.getItemCount(series);
        for (int item = 0; item < itemCount; item++) {
            lvalue = dataset.getStartXValue(series, item);
            uvalue = dataset.getEndXValue(series, item);
            double offset = (uvalue - lvalue) / 2.0;
            lvalue = lvalue - offset;
            uvalue = uvalue - offset;
            minimum = Math.min(minimum, lvalue);
            maximum = Math.max(maximum, uvalue);
        }
    }

    if (minimum > maximum) {
        return null;
    }
    else {
        return new Range(minimum, maximum);
    }
}
 
Example 2
Source File: ClusteredXYBarRenderer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Iterates over the items in an {@link IntervalXYDataset} to find
 * the range of x-values including the interval OFFSET so that it centers
 * the interval around the start value. 
 *  
 * @param dataset  the dataset (<code>null</code> not permitted).
 *   
 * @return The range (possibly <code>null</code>).
 */
protected Range findDomainBoundsWithOffset(IntervalXYDataset dataset) {
    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");   
    }
    double minimum = Double.POSITIVE_INFINITY;
    double maximum = Double.NEGATIVE_INFINITY;
    int seriesCount = dataset.getSeriesCount();
    double lvalue;
    double uvalue;
    for (int series = 0; series < seriesCount; series++) {
        int itemCount = dataset.getItemCount(series);
        for (int item = 0; item < itemCount; item++) {
            lvalue = dataset.getStartXValue(series, item);
            uvalue = dataset.getEndXValue(series, item);
            double offset = (uvalue - lvalue) / 2.0;
            lvalue = lvalue - offset;
            uvalue = uvalue - offset;
            minimum = Math.min(minimum, lvalue);
            maximum = Math.max(maximum, uvalue);
        }
    }

    if (minimum > maximum) {
        return null;
    }
    else {
        return new Range(minimum, maximum);
    }
}
 
Example 3
Source File: ClusteredXYBarRenderer.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Iterates over the items in an {@link IntervalXYDataset} to find
 * the range of x-values including the interval OFFSET so that it centers
 * the interval around the start value.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The range (possibly <code>null</code>).
 */
protected Range findDomainBoundsWithOffset(IntervalXYDataset dataset) {
    ParamChecks.nullNotPermitted(dataset, "dataset");
    double minimum = Double.POSITIVE_INFINITY;
    double maximum = Double.NEGATIVE_INFINITY;
    int seriesCount = dataset.getSeriesCount();
    double lvalue;
    double uvalue;
    for (int series = 0; series < seriesCount; series++) {
        int itemCount = dataset.getItemCount(series);
        for (int item = 0; item < itemCount; item++) {
            lvalue = dataset.getStartXValue(series, item);
            uvalue = dataset.getEndXValue(series, item);
            double offset = (uvalue - lvalue) / 2.0;
            lvalue = lvalue - offset;
            uvalue = uvalue - offset;
            minimum = Math.min(minimum, lvalue);
            maximum = Math.max(maximum, uvalue);
        }
    }

    if (minimum > maximum) {
        return null;
    }
    else {
        return new Range(minimum, maximum);
    }
}
 
Example 4
Source File: ClusteredXYBarRenderer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Iterates over the items in an {@link IntervalXYDataset} to find
 * the range of x-values including the interval OFFSET so that it centers
 * the interval around the start value.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The range (possibly <code>null</code>).
 */
protected Range findDomainBoundsWithOffset(IntervalXYDataset dataset) {
    ParamChecks.nullNotPermitted(dataset, "dataset");
    double minimum = Double.POSITIVE_INFINITY;
    double maximum = Double.NEGATIVE_INFINITY;
    int seriesCount = dataset.getSeriesCount();
    double lvalue;
    double uvalue;
    for (int series = 0; series < seriesCount; series++) {
        int itemCount = dataset.getItemCount(series);
        for (int item = 0; item < itemCount; item++) {
            lvalue = dataset.getStartXValue(series, item);
            uvalue = dataset.getEndXValue(series, item);
            double offset = (uvalue - lvalue) / 2.0;
            lvalue = lvalue - offset;
            uvalue = uvalue - offset;
            minimum = Math.min(minimum, lvalue);
            maximum = Math.max(maximum, uvalue);
        }
    }

    if (minimum > maximum) {
        return null;
    }
    else {
        return new Range(minimum, maximum);
    }
}
 
Example 5
Source File: ClusteredXYBarRenderer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Iterates over the items in an {@link IntervalXYDataset} to find
 * the range of x-values including the interval OFFSET so that it centers
 * the interval around the start value.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The range (possibly <code>null</code>).
 */
protected Range findDomainBoundsWithOffset(IntervalXYDataset dataset) {
    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }
    double minimum = Double.POSITIVE_INFINITY;
    double maximum = Double.NEGATIVE_INFINITY;
    int seriesCount = dataset.getSeriesCount();
    double lvalue;
    double uvalue;
    for (int series = 0; series < seriesCount; series++) {
        int itemCount = dataset.getItemCount(series);
        for (int item = 0; item < itemCount; item++) {
            lvalue = dataset.getStartXValue(series, item);
            uvalue = dataset.getEndXValue(series, item);
            double offset = (uvalue - lvalue) / 2.0;
            lvalue = lvalue - offset;
            uvalue = uvalue - offset;
            minimum = Math.min(minimum, lvalue);
            maximum = Math.max(maximum, uvalue);
        }
    }

    if (minimum > maximum) {
        return null;
    }
    else {
        return new Range(minimum, maximum);
    }
}
 
Example 6
Source File: ClusteredXYBarRenderer.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Iterates over the items in an {@link IntervalXYDataset} to find
 * the range of x-values including the interval OFFSET so that it centers
 * the interval around the start value.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The range (possibly <code>null</code>).
 */
protected Range findDomainBoundsWithOffset(IntervalXYDataset dataset) {
    ParamChecks.nullNotPermitted(dataset, "dataset");
    double minimum = Double.POSITIVE_INFINITY;
    double maximum = Double.NEGATIVE_INFINITY;
    int seriesCount = dataset.getSeriesCount();
    double lvalue;
    double uvalue;
    for (int series = 0; series < seriesCount; series++) {
        int itemCount = dataset.getItemCount(series);
        for (int item = 0; item < itemCount; item++) {
            lvalue = dataset.getStartXValue(series, item);
            uvalue = dataset.getEndXValue(series, item);
            double offset = (uvalue - lvalue) / 2.0;
            lvalue = lvalue - offset;
            uvalue = uvalue - offset;
            minimum = Math.min(minimum, lvalue);
            maximum = Math.max(maximum, uvalue);
        }
    }

    if (minimum > maximum) {
        return null;
    }
    else {
        return new Range(minimum, maximum);
    }
}
 
Example 7
Source File: JGenProg2017_0047_s.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns the maximum domain value for the specified dataset.  This is 
 * easy if the dataset implements the {@link DomainInfo} interface (a good 
 * idea if there is an efficient way to determine the maximum value).  
 * Otherwise, it involves iterating over the entire data-set.  Returns 
 * <code>null</code> if all the data values in the dataset are 
 * <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The maximum value (possibly <code>null</code>).
 */
public static Number findMaximumDomainValue(XYDataset dataset) {
    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }
    Number result = null;
    // if the dataset implements DomainInfo, life is easy
    if (dataset instanceof DomainInfo) {
        DomainInfo info = (DomainInfo) dataset;
        return new Double(info.getDomainUpperBound(true));
    }

    // hasn't implemented DomainInfo, so iterate...
    else {
        double maximum = Double.NEGATIVE_INFINITY;
        int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            int itemCount = dataset.getItemCount(series);
            for (int item = 0; item < itemCount; item++) {

                double value;
                if (dataset instanceof IntervalXYDataset) {
                    IntervalXYDataset intervalXYData 
                        = (IntervalXYDataset) dataset;
                    value = intervalXYData.getEndXValue(series, item);
                }
                else {
                    value = dataset.getXValue(series, item);
                }
                if (!Double.isNaN(value)) {
                    maximum = Math.max(maximum, value);
                }
            }
        }
        if (maximum == Double.NEGATIVE_INFINITY) {
            result = null;
        }
        else {
            result = new Double(maximum);
        }

    }
    
    return result;
}
 
Example 8
Source File: DatasetUtilities.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the maximum domain value for the specified dataset.  This is
 * easy if the dataset implements the {@link DomainInfo} interface (a good
 * idea if there is an efficient way to determine the maximum value).
 * Otherwise, it involves iterating over the entire data-set.  Returns
 * <code>null</code> if all the data values in the dataset are
 * <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The maximum value (possibly <code>null</code>).
 */
public static Number findMaximumDomainValue(XYDataset dataset) {
    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }
    Number result = null;
    // if the dataset implements DomainInfo, life is easy
    if (dataset instanceof DomainInfo) {
        DomainInfo info = (DomainInfo) dataset;
        return new Double(info.getDomainUpperBound(true));
    }

    // hasn't implemented DomainInfo, so iterate...
    else {
        double maximum = Double.NEGATIVE_INFINITY;
        int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            int itemCount = dataset.getItemCount(series);
            for (int item = 0; item < itemCount; item++) {

                double value;
                if (dataset instanceof IntervalXYDataset) {
                    IntervalXYDataset intervalXYData
                        = (IntervalXYDataset) dataset;
                    value = intervalXYData.getEndXValue(series, item);
                }
                else {
                    value = dataset.getXValue(series, item);
                }
                if (!Double.isNaN(value)) {
                    maximum = Math.max(maximum, value);
                }
            }
        }
        if (maximum == Double.NEGATIVE_INFINITY) {
            result = null;
        }
        else {
            result = new Double(maximum);
        }

    }

    return result;
}
 
Example 9
Source File: DatasetUtilities.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the maximum domain value for the specified dataset.  This is
 * easy if the dataset implements the {@link DomainInfo} interface (a good
 * idea if there is an efficient way to determine the maximum value).
 * Otherwise, it involves iterating over the entire data-set.  Returns
 * <code>null</code> if all the data values in the dataset are
 * <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The maximum value (possibly <code>null</code>).
 */
public static Number findMaximumDomainValue(XYDataset dataset) {
    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }
    Number result = null;
    // if the dataset implements DomainInfo, life is easy
    if (dataset instanceof DomainInfo) {
        DomainInfo info = (DomainInfo) dataset;
        return new Double(info.getDomainUpperBound(true));
    }

    // hasn't implemented DomainInfo, so iterate...
    else {
        double maximum = Double.NEGATIVE_INFINITY;
        int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            int itemCount = dataset.getItemCount(series);
            for (int item = 0; item < itemCount; item++) {

                double value;
                if (dataset instanceof IntervalXYDataset) {
                    IntervalXYDataset intervalXYData
                        = (IntervalXYDataset) dataset;
                    value = intervalXYData.getEndXValue(series, item);
                }
                else {
                    value = dataset.getXValue(series, item);
                }
                if (!Double.isNaN(value)) {
                    maximum = Math.max(maximum, value);
                }
            }
        }
        if (maximum == Double.NEGATIVE_INFINITY) {
            result = null;
        }
        else {
            result = new Double(maximum);
        }

    }

    return result;
}
 
Example 10
Source File: DatasetUtilities.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the maximum domain value for the specified dataset.  This is
 * easy if the dataset implements the {@link DomainInfo} interface (a good
 * idea if there is an efficient way to determine the maximum value).
 * Otherwise, it involves iterating over the entire data-set.  Returns
 * <code>null</code> if all the data values in the dataset are
 * <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The maximum value (possibly <code>null</code>).
 */
public static Number findMaximumDomainValue(XYDataset dataset) {
    ParamChecks.nullNotPermitted(dataset, "dataset");
    Number result;
    // if the dataset implements DomainInfo, life is easy
    if (dataset instanceof DomainInfo) {
        DomainInfo info = (DomainInfo) dataset;
        return new Double(info.getDomainUpperBound(true));
    }

    // hasn't implemented DomainInfo, so iterate...
    else {
        double maximum = Double.NEGATIVE_INFINITY;
        int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            int itemCount = dataset.getItemCount(series);
            for (int item = 0; item < itemCount; item++) {

                double value;
                if (dataset instanceof IntervalXYDataset) {
                    IntervalXYDataset intervalXYData
                        = (IntervalXYDataset) dataset;
                    value = intervalXYData.getEndXValue(series, item);
                }
                else {
                    value = dataset.getXValue(series, item);
                }
                if (!Double.isNaN(value)) {
                    maximum = Math.max(maximum, value);
                }
            }
        }
        if (maximum == Double.NEGATIVE_INFINITY) {
            result = null;
        }
        else {
            result = new Double(maximum);
        }

    }

    return result;
}
 
Example 11
Source File: DatasetUtilities.java    From opensim-gui with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the maximum domain value for the specified dataset.  This is 
 * easy if the dataset implements the {@link DomainInfo} interface (a good 
 * idea if there is an efficient way to determine the maximum value).  
 * Otherwise, it involves iterating over the entire data-set.  Returns 
 * <code>null</code> if all the data values in the dataset are 
 * <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The maximum value (possibly <code>null</code>).
 */
public static Number findMaximumDomainValue(XYDataset dataset) {
    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }
    Number result = null;
    // if the dataset implements DomainInfo, life is easy
    if (dataset instanceof DomainInfo) {
        DomainInfo info = (DomainInfo) dataset;
        return new Double(info.getDomainUpperBound(true));
    }

    // hasn't implemented DomainInfo, so iterate...
    else {
        double maximum = Double.NEGATIVE_INFINITY;
        int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            int itemCount = dataset.getItemCount(series);
            for (int item = 0; item < itemCount; item++) {

                double value;
                if (dataset instanceof IntervalXYDataset) {
                    IntervalXYDataset intervalXYData 
                        = (IntervalXYDataset) dataset;
                    value = intervalXYData.getEndXValue(series, item);
                }
                else {
                    value = dataset.getXValue(series, item);
                }
                if (!Double.isNaN(value)) {
                    maximum = Math.max(maximum, value);
                }
            }
        }
        if (maximum == Double.NEGATIVE_INFINITY) {
            result = null;
        }
        else {
            result = new Double(maximum);
        }

    }
    
    return result;
}
 
Example 12
Source File: DatasetUtilities.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns the maximum domain value for the specified dataset.  This is
 * easy if the dataset implements the {@link DomainInfo} interface (a good
 * idea if there is an efficient way to determine the maximum value).
 * Otherwise, it involves iterating over the entire data-set.  Returns
 * <code>null</code> if all the data values in the dataset are
 * <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The maximum value (possibly <code>null</code>).
 */
public static Number findMaximumDomainValue(XYDataset dataset) {
    ParamChecks.nullNotPermitted(dataset, "dataset");
    Number result;
    // if the dataset implements DomainInfo, life is easy
    if (dataset instanceof DomainInfo) {
        DomainInfo info = (DomainInfo) dataset;
        return new Double(info.getDomainUpperBound(true));
    }

    // hasn't implemented DomainInfo, so iterate...
    else {
        double maximum = Double.NEGATIVE_INFINITY;
        int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            int itemCount = dataset.getItemCount(series);
            for (int item = 0; item < itemCount; item++) {

                double value;
                if (dataset instanceof IntervalXYDataset) {
                    IntervalXYDataset intervalXYData
                        = (IntervalXYDataset) dataset;
                    value = intervalXYData.getEndXValue(series, item);
                }
                else {
                    value = dataset.getXValue(series, item);
                }
                if (!Double.isNaN(value)) {
                    maximum = Math.max(maximum, value);
                }
            }
        }
        if (maximum == Double.NEGATIVE_INFINITY) {
            result = null;
        }
        else {
            result = new Double(maximum);
        }

    }

    return result;
}
 
Example 13
Source File: Chart_2_DatasetUtilities_s.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns the maximum domain value for the specified dataset.  This is
 * easy if the dataset implements the {@link DomainInfo} interface (a good
 * idea if there is an efficient way to determine the maximum value).
 * Otherwise, it involves iterating over the entire data-set.  Returns
 * <code>null</code> if all the data values in the dataset are
 * <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The maximum value (possibly <code>null</code>).
 */
public static Number findMaximumDomainValue(XYDataset dataset) {
    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }
    Number result = null;
    // if the dataset implements DomainInfo, life is easy
    if (dataset instanceof DomainInfo) {
        DomainInfo info = (DomainInfo) dataset;
        return new Double(info.getDomainUpperBound(true));
    }

    // hasn't implemented DomainInfo, so iterate...
    else {
        double maximum = Double.NEGATIVE_INFINITY;
        int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            int itemCount = dataset.getItemCount(series);
            for (int item = 0; item < itemCount; item++) {

                double value;
                if (dataset instanceof IntervalXYDataset) {
                    IntervalXYDataset intervalXYData
                        = (IntervalXYDataset) dataset;
                    value = intervalXYData.getEndXValue(series, item);
                }
                else {
                    value = dataset.getXValue(series, item);
                }
                if (!Double.isNaN(value)) {
                    maximum = Math.max(maximum, value);
                }
            }
        }
        if (maximum == Double.NEGATIVE_INFINITY) {
            result = null;
        }
        else {
            result = new Double(maximum);
        }

    }

    return result;
}
 
Example 14
Source File: JGenProg2017_0047_t.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns the maximum domain value for the specified dataset.  This is 
 * easy if the dataset implements the {@link DomainInfo} interface (a good 
 * idea if there is an efficient way to determine the maximum value).  
 * Otherwise, it involves iterating over the entire data-set.  Returns 
 * <code>null</code> if all the data values in the dataset are 
 * <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The maximum value (possibly <code>null</code>).
 */
public static Number findMaximumDomainValue(XYDataset dataset) {
    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }
    Number result = null;
    // if the dataset implements DomainInfo, life is easy
    if (dataset instanceof DomainInfo) {
        DomainInfo info = (DomainInfo) dataset;
        return new Double(info.getDomainUpperBound(true));
    }

    // hasn't implemented DomainInfo, so iterate...
    else {
        double maximum = Double.NEGATIVE_INFINITY;
        int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            int itemCount = dataset.getItemCount(series);
            for (int item = 0; item < itemCount; item++) {

                double value;
                if (dataset instanceof IntervalXYDataset) {
                    IntervalXYDataset intervalXYData 
                        = (IntervalXYDataset) dataset;
                    value = intervalXYData.getEndXValue(series, item);
                }
                else {
                    value = dataset.getXValue(series, item);
                }
                if (!Double.isNaN(value)) {
                    maximum = Math.max(maximum, value);
                }
            }
        }
        if (maximum == Double.NEGATIVE_INFINITY) {
            result = null;
        }
        else {
            result = new Double(maximum);
        }

    }
    
    return result;
}
 
Example 15
Source File: DatasetUtilities.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns the maximum domain value for the specified dataset.  This is
 * easy if the dataset implements the {@link DomainInfo} interface (a good
 * idea if there is an efficient way to determine the maximum value).
 * Otherwise, it involves iterating over the entire data-set.  Returns
 * <code>null</code> if all the data values in the dataset are
 * <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The maximum value (possibly <code>null</code>).
 */
public static Number findMaximumDomainValue(XYDataset dataset) {
    ParamChecks.nullNotPermitted(dataset, "dataset");
    Number result;
    // if the dataset implements DomainInfo, life is easy
    if (dataset instanceof DomainInfo) {
        DomainInfo info = (DomainInfo) dataset;
        return new Double(info.getDomainUpperBound(true));
    }

    // hasn't implemented DomainInfo, so iterate...
    else {
        double maximum = Double.NEGATIVE_INFINITY;
        int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            int itemCount = dataset.getItemCount(series);
            for (int item = 0; item < itemCount; item++) {

                double value;
                if (dataset instanceof IntervalXYDataset) {
                    IntervalXYDataset intervalXYData
                        = (IntervalXYDataset) dataset;
                    value = intervalXYData.getEndXValue(series, item);
                }
                else {
                    value = dataset.getXValue(series, item);
                }
                if (!Double.isNaN(value)) {
                    maximum = Math.max(maximum, value);
                }
            }
        }
        if (maximum == Double.NEGATIVE_INFINITY) {
            result = null;
        }
        else {
            result = new Double(maximum);
        }

    }

    return result;
}
 
Example 16
Source File: Cardumen_00194_t.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns the maximum domain value for the specified dataset.  This is 
 * easy if the dataset implements the {@link DomainInfo} interface (a good 
 * idea if there is an efficient way to determine the maximum value).  
 * Otherwise, it involves iterating over the entire data-set.  Returns 
 * <code>null</code> if all the data values in the dataset are 
 * <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The maximum value (possibly <code>null</code>).
 */
public static Number findMaximumDomainValue(XYDataset dataset) {
    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }
    Number result = null;
    // if the dataset implements DomainInfo, life is easy
    if (dataset instanceof DomainInfo) {
        DomainInfo info = (DomainInfo) dataset;
        return new Double(info.getDomainUpperBound(true));
    }

    // hasn't implemented DomainInfo, so iterate...
    else {
        double maximum = Double.NEGATIVE_INFINITY;
        int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            int itemCount = dataset.getItemCount(series);
            for (int item = 0; item < itemCount; item++) {

                double value;
                if (dataset instanceof IntervalXYDataset) {
                    IntervalXYDataset intervalXYData 
                        = (IntervalXYDataset) dataset;
                    value = intervalXYData.getEndXValue(series, item);
                }
                else {
                    value = dataset.getXValue(series, item);
                }
                if (!Double.isNaN(value)) {
                    maximum = Math.max(maximum, value);
                }
            }
        }
        if (maximum == Double.NEGATIVE_INFINITY) {
            result = null;
        }
        else {
            result = new Double(maximum);
        }

    }
    
    return result;
}
 
Example 17
Source File: Cardumen_0079_t.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns the maximum domain value for the specified dataset.  This is 
 * easy if the dataset implements the {@link DomainInfo} interface (a good 
 * idea if there is an efficient way to determine the maximum value).  
 * Otherwise, it involves iterating over the entire data-set.  Returns 
 * <code>null</code> if all the data values in the dataset are 
 * <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The maximum value (possibly <code>null</code>).
 */
public static Number findMaximumDomainValue(XYDataset dataset) {
    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }
    Number result = null;
    // if the dataset implements DomainInfo, life is easy
    if (dataset instanceof DomainInfo) {
        DomainInfo info = (DomainInfo) dataset;
        return new Double(info.getDomainUpperBound(true));
    }

    // hasn't implemented DomainInfo, so iterate...
    else {
        double maximum = Double.NEGATIVE_INFINITY;
        int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            int itemCount = dataset.getItemCount(series);
            for (int item = 0; item < itemCount; item++) {

                double value;
                if (dataset instanceof IntervalXYDataset) {
                    IntervalXYDataset intervalXYData 
                        = (IntervalXYDataset) dataset;
                    value = intervalXYData.getEndXValue(series, item);
                }
                else {
                    value = dataset.getXValue(series, item);
                }
                if (!Double.isNaN(value)) {
                    maximum = Math.max(maximum, value);
                }
            }
        }
        if (maximum == Double.NEGATIVE_INFINITY) {
            result = null;
        }
        else {
            result = new Double(maximum);
        }

    }
    
    return result;
}
 
Example 18
Source File: Cardumen_0079_s.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns the maximum domain value for the specified dataset.  This is 
 * easy if the dataset implements the {@link DomainInfo} interface (a good 
 * idea if there is an efficient way to determine the maximum value).  
 * Otherwise, it involves iterating over the entire data-set.  Returns 
 * <code>null</code> if all the data values in the dataset are 
 * <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The maximum value (possibly <code>null</code>).
 */
public static Number findMaximumDomainValue(XYDataset dataset) {
    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }
    Number result = null;
    // if the dataset implements DomainInfo, life is easy
    if (dataset instanceof DomainInfo) {
        DomainInfo info = (DomainInfo) dataset;
        return new Double(info.getDomainUpperBound(true));
    }

    // hasn't implemented DomainInfo, so iterate...
    else {
        double maximum = Double.NEGATIVE_INFINITY;
        int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            int itemCount = dataset.getItemCount(series);
            for (int item = 0; item < itemCount; item++) {

                double value;
                if (dataset instanceof IntervalXYDataset) {
                    IntervalXYDataset intervalXYData 
                        = (IntervalXYDataset) dataset;
                    value = intervalXYData.getEndXValue(series, item);
                }
                else {
                    value = dataset.getXValue(series, item);
                }
                if (!Double.isNaN(value)) {
                    maximum = Math.max(maximum, value);
                }
            }
        }
        if (maximum == Double.NEGATIVE_INFINITY) {
            result = null;
        }
        else {
            result = new Double(maximum);
        }

    }
    
    return result;
}
 
Example 19
Source File: DatasetUtilities.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns the maximum domain value for the specified dataset.  This is
 * easy if the dataset implements the {@link DomainInfo} interface (a good
 * idea if there is an efficient way to determine the maximum value).
 * Otherwise, it involves iterating over the entire data-set.  Returns
 * <code>null</code> if all the data values in the dataset are
 * <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The maximum value (possibly <code>null</code>).
 */
public static Number findMaximumDomainValue(XYDataset dataset) {
    ParamChecks.nullNotPermitted(dataset, "dataset");
    Number result;
    // if the dataset implements DomainInfo, life is easy
    if (dataset instanceof DomainInfo) {
        DomainInfo info = (DomainInfo) dataset;
        return new Double(info.getDomainUpperBound(true));
    }

    // hasn't implemented DomainInfo, so iterate...
    else {
        double maximum = Double.NEGATIVE_INFINITY;
        int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            int itemCount = dataset.getItemCount(series);
            for (int item = 0; item < itemCount; item++) {

                double value;
                if (dataset instanceof IntervalXYDataset) {
                    IntervalXYDataset intervalXYData
                        = (IntervalXYDataset) dataset;
                    value = intervalXYData.getEndXValue(series, item);
                }
                else {
                    value = dataset.getXValue(series, item);
                }
                if (!Double.isNaN(value)) {
                    maximum = Math.max(maximum, value);
                }
            }
        }
        if (maximum == Double.NEGATIVE_INFINITY) {
            result = null;
        }
        else {
            result = new Double(maximum);
        }

    }

    return result;
}
 
Example 20
Source File: DatasetUtilities.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns the maximum domain value for the specified dataset.  This is
 * easy if the dataset implements the {@link DomainInfo} interface (a good
 * idea if there is an efficient way to determine the maximum value).
 * Otherwise, it involves iterating over the entire data-set.  Returns
 * <code>null</code> if all the data values in the dataset are
 * <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The maximum value (possibly <code>null</code>).
 */
public static Number findMaximumDomainValue(XYDataset dataset) {
    ParamChecks.nullNotPermitted(dataset, "dataset");
    Number result;
    // if the dataset implements DomainInfo, life is easy
    if (dataset instanceof DomainInfo) {
        DomainInfo info = (DomainInfo) dataset;
        return new Double(info.getDomainUpperBound(true));
    }

    // hasn't implemented DomainInfo, so iterate...
    else {
        double maximum = Double.NEGATIVE_INFINITY;
        int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            int itemCount = dataset.getItemCount(series);
            for (int item = 0; item < itemCount; item++) {

                double value;
                if (dataset instanceof IntervalXYDataset) {
                    IntervalXYDataset intervalXYData
                        = (IntervalXYDataset) dataset;
                    value = intervalXYData.getEndXValue(series, item);
                }
                else {
                    value = dataset.getXValue(series, item);
                }
                if (!Double.isNaN(value)) {
                    maximum = Math.max(maximum, value);
                }
            }
        }
        if (maximum == Double.NEGATIVE_INFINITY) {
            result = null;
        }
        else {
            result = new Double(maximum);
        }

    }

    return result;
}