List of usage examples for org.jfree.chart.util ParamChecks nullNotPermitted
public static void nullNotPermitted(Object param, String name)
IllegalArgumentException
if the supplied param
is null
. From source file:org.jfree.data.time.MovingAverage.java
/** * Creates a new {@link TimeSeriesCollection} containing a moving average * series for each series in the source collection. * * @param source the source collection. * @param suffix the suffix added to each source series name to create the * corresponding moving average series name. * @param periodCount the number of periods in the moving average * calculation./*from w ww . ja v a 2s .com*/ * @param skip the number of initial periods to skip. * * @return A collection of moving average time series. */ public static TimeSeriesCollection createMovingAverage(TimeSeriesCollection source, String suffix, int periodCount, int skip) { ParamChecks.nullNotPermitted(source, "source"); if (periodCount < 1) { throw new IllegalArgumentException("periodCount must be greater " + "than or equal to 1."); } TimeSeriesCollection result = new TimeSeriesCollection(); for (int i = 0; i < source.getSeriesCount(); i++) { TimeSeries sourceSeries = source.getSeries(i); TimeSeries maSeries = createMovingAverage(sourceSeries, sourceSeries.getKey() + suffix, periodCount, skip); result.addSeries(maSeries); } return result; }
From source file:org.jfree.data.general.DatasetGroup.java
/** * Creates a new group with the specified id. * * @param id the identification for the group. *///ww w .j a v a 2s .c om public DatasetGroup(String id) { ParamChecks.nullNotPermitted(id, "id"); this.id = id; }
From source file:org.jfree.data.ComparableObjectItem.java
/** * Constructs a new data item.//from www. ja v a 2s. c o m * * @param x the x-value (<code>null</code> NOT permitted). * @param y the y-value (<code>null</code> permitted). */ public ComparableObjectItem(Comparable x, Object y) { ParamChecks.nullNotPermitted(x, "x"); this.x = x; this.obj = y; }
From source file:org.jfree.data.function.PolynomialFunction2D.java
/** * Constructs a new polynomial function <code>y = a0 + a1 * x + a2 * x^2 + * ... + an * x^n</code>//from w ww . j a v a 2s.com * * @param coefficients an array with the coefficients [a0, a1, ..., an] * (<code>null</code> not permitted). */ public PolynomialFunction2D(double[] coefficients) { ParamChecks.nullNotPermitted(coefficients, "coefficients"); this.coefficients = (double[]) coefficients.clone(); }
From source file:org.jfree.data.time.TimePeriodValue.java
/** * Constructs a new data item./*w w w . j a va 2s . c o m*/ * * @param period the time period (<code>null</code> not permitted). * @param value the value associated with the time period. * * @throws IllegalArgumentException if <code>period</code> is * <code>null</code>. */ public TimePeriodValue(TimePeriod period, Number value) { ParamChecks.nullNotPermitted(period, "period"); this.period = period; this.value = value; }
From source file:org.jfree.data.KeyedValueComparator.java
/** * Creates a new comparator./*w w w .jav a 2 s .com*/ * * @param type the type (<code>BY_KEY</code> or <code>BY_VALUE</code>, * <code>null</code> not permitted). * @param order the order (<code>null</code> not permitted). */ public KeyedValueComparator(KeyedValueComparatorType type, SortOrder order) { ParamChecks.nullNotPermitted(type, "type"); ParamChecks.nullNotPermitted(order, "order"); this.type = type; this.order = order; }
From source file:org.jfree.data.xyz.XYZSeries.java
/** * Creates a new series with the specified key. * /*from w w w . ja va 2 s . c om*/ * @param key the key (<code>null</code> not permitted). */ public XYZSeries(Comparable<?> key) { ParamChecks.nullNotPermitted(key, "key"); this.key = key; this.items = new ArrayList<XYZDataItem>(); }
From source file:org.jfree.data.statistics.Statistics.java
/** * Returns the mean of an array of numbers. * * @param values the values ({@code null} not permitted). * @param includeNullAndNaN a flag that controls whether or not * {@code null} and {@code Double.NaN} values are included * in the calculation (if either is present in the array, the result is * {@link Double#NaN})./*from w ww . j a va 2 s .c o m*/ * * @return The mean. * * @since 1.0.3 */ public static double calculateMean(Number[] values, boolean includeNullAndNaN) { ParamChecks.nullNotPermitted(values, "values"); double sum = 0.0; double current; int counter = 0; for (int i = 0; i < values.length; i++) { // treat nulls the same as NaNs if (values[i] != null) { current = values[i].doubleValue(); } else { current = Double.NaN; } // calculate the sum and count if (includeNullAndNaN || !Double.isNaN(current)) { sum = sum + current; counter++; } } double result = (sum / counter); return result; }
From source file:org.jfree.data.DataUtilities.java
/** * Returns a clone of the specified array. * * @param source the source array (<code>null</code> not permitted). * * @return A clone of the array./*from www. j a v a 2 s .c om*/ * * @since 1.0.13 */ public static double[][] clone(double[][] source) { ParamChecks.nullNotPermitted(source, "source"); double[][] clone = new double[source.length][]; for (int i = 0; i < source.length; i++) { if (source[i] != null) { double[] row = new double[source[i].length]; System.arraycopy(source[i], 0, row, 0, source[i].length); clone[i] = row; } } return clone; }
From source file:org.jfree.data.xy.XYDataItem.java
/** * Constructs a new data item.//from w w w . j a v a 2 s. c o m * * @param x the x-value (<code>null</code> NOT permitted). * @param y the y-value (<code>null</code> permitted). */ public XYDataItem(Number x, Number y) { ParamChecks.nullNotPermitted(x, "x"); this.x = x; this.y = y; }