Logo Search packages:      
Sourcecode: libjfreechart-java version File versions  Download package

static double org::jfree::data::statistics::BoxAndWhiskerCalculator::calculateQ3 ( List  values  )  [inline, static]

Calculates the third quartile for a list of numbers in ascending order. If the items in the list are not in ascending order, the result is unspecified. If the list contains items that are null, not an instance of Number, or equivalent to Double.NaN, the result is unspecified.

Parameters:
values the list of values (null not permitted).
Returns:
The third quartile.

Definition at line 216 of file BoxAndWhiskerCalculator.java.

Referenced by calculateBoxAndWhiskerStatistics().

                                                  {
        if (values == null) {
            throw new IllegalArgumentException("Null 'values' argument.");
        }
        double result = Double.NaN;
        int count = values.size();
        if (count > 0) {
            if (count % 2 == 1) {
                if (count > 1) {
                    result = Statistics.calculateMedian(values, count / 2, 
                            count - 1);
                }
                else {
                    result = Statistics.calculateMedian(values, 0, 0);
                }
            }
            else {
                result = Statistics.calculateMedian(values, count / 2, 
                        count - 1);
            }
        }
        return result;
    }


Generated by  Doxygen 1.6.0   Back to index