Example usage for org.jfree.chart.util ParamChecks nullNotPermitted

List of usage examples for org.jfree.chart.util ParamChecks nullNotPermitted

Introduction

In this page you can find the example usage for org.jfree.chart.util ParamChecks nullNotPermitted.

Prototype

public static void nullNotPermitted(Object param, String name) 

Source Link

Document

Throws an IllegalArgumentException if the supplied param is null.

Usage

From source file:org.jfree.data.statistics.HistogramDataset.java

/**
 * Sets the histogram type and sends a {@link DatasetChangeEvent} to all
 * registered listeners./*from   w ww  .  j a  v  a 2  s.c o  m*/
 *
 * @param type  the type (<code>null</code> not permitted).
 */
public void setType(HistogramType type) {
    ParamChecks.nullNotPermitted(type, "type");
    this.type = type;
    fireDatasetChanged();
}

From source file:org.jfree.data.time.Minute.java

/**
 * Constructs a new Minute.//from   w ww  .ja  v a 2 s  .c o m
 *
 * @param minute  the minute (0 to 59).
 * @param hour  the hour (<code>null</code> not permitted).
 */
public Minute(int minute, Hour hour) {
    ParamChecks.nullNotPermitted(hour, "hour");
    this.minute = (byte) minute;
    this.hour = (byte) hour.getHour();
    this.day = hour.getDay();
    peg(Calendar.getInstance());
}

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

/**
 * Returns the row index for a given key, or <code>-1</code> if the key
 * is not recognised./*from www  . ja va 2s  .  c  o  m*/
 *
 * @param key  the key (<code>null</code> not permitted).
 *
 * @return The row index.
 *
 * @see #getRowKey(int)
 */
public int getRowIndex(Comparable key) {
    ParamChecks.nullNotPermitted(key, "key");
    return this.rowKeys.indexOf(key);
}

From source file:org.jfree.data.time.TimePeriodValuesCollection.java

/**
 * Sets the position of the x axis within each time period.
 *
 * @param position  the position (<code>null</code> not permitted).
 *
 * @see #getXPosition()//from  ww  w . j ava  2  s. c  om
 */
public void setXPosition(TimePeriodAnchor position) {
    ParamChecks.nullNotPermitted(position, "position");
    this.xPosition = position;
}

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

/**
 * Returns the group that a key is mapped to.
 *
 * @param key  the key (<code>null</code> not permitted).
 *
 * @return The group (never <code>null</code>, returns the default group if
 *         there is no mapping for the specified key).
 *//*from  w w  w. j a  v a 2  s  .  c om*/
public Comparable getGroup(Comparable key) {
    ParamChecks.nullNotPermitted(key, "key");
    Comparable result = this.defaultGroup;
    Comparable group = (Comparable) this.keyToGroupMap.get(key);
    if (group != null) {
        result = group;
    }
    return result;
}

From source file:org.jfree.data.xy.DefaultWindDataset.java

/**
 * Constructs a dataset based on the specified data array.  The array
 * can contain multiple series, each series can contain multiple items,
 * and each item is as follows:/*from   w  w  w  .j ava  2 s. c  om*/
 * <ul>
 * <li><code>data[series][item][0]</code> - the date (either a
 *   <code>Date</code> or a <code>Number</code> that is the milliseconds
 *   since 1-Jan-1970);</li>
 * <li><code>data[series][item][1]</code> - the wind direction (1 - 12,
 *   like the numbers on a clock face);</li>
 * <li><code>data[series][item][2]</code> - the wind force (1 - 12 on the
 *   Beaufort scale)</li>
 * </ul>
 *
 * @param seriesKeys  the names of the series (<code>null</code> not
 *     permitted).
 * @param data  the wind dataset (<code>null</code> not permitted).
 *
 * @throws IllegalArgumentException if <code>seriesKeys</code> is
 *     <code>null</code>.
 * @throws IllegalArgumentException if the number of series keys does not
 *     match the number of series in the array.
 * @throws NullPointerException if <code>data</code> is <code>null</code>.
 */
public DefaultWindDataset(List seriesKeys, Object[][][] data) {
    ParamChecks.nullNotPermitted(seriesKeys, "seriesKeys");
    if (seriesKeys.size() != data.length) {
        throw new IllegalArgumentException(
                "The number of series keys does " + "not match the number of series in the data array.");
    }
    this.seriesKeys = seriesKeys;
    int seriesCount = data.length;
    this.allSeriesData = new java.util.ArrayList(seriesCount);

    for (int seriesIndex = 0; seriesIndex < seriesCount; seriesIndex++) {
        List oneSeriesData = new java.util.ArrayList();
        int maxItemCount = data[seriesIndex].length;
        for (int itemIndex = 0; itemIndex < maxItemCount; itemIndex++) {
            Object xObject = data[seriesIndex][itemIndex][0];
            if (xObject != null) {
                Number xNumber;
                if (xObject instanceof Number) {
                    xNumber = (Number) xObject;
                } else {
                    if (xObject instanceof Date) {
                        Date xDate = (Date) xObject;
                        xNumber = new Long(xDate.getTime());
                    } else {
                        xNumber = new Integer(0);
                    }
                }
                Number windDir = (Number) data[seriesIndex][itemIndex][1];
                Number windForce = (Number) data[seriesIndex][itemIndex][2];
                oneSeriesData.add(new WindDataItem(xNumber, windDir, windForce));
            }
        }
        Collections.sort(oneSeriesData);
        this.allSeriesData.add(seriesIndex, oneSeriesData);
    }

}

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

/**
 * Returns the total of the values in one row of the supplied data
 * table./*  w ww  .j a v  a  2 s. com*/
 *
 * @param data  the table of values (<code>null</code> not permitted).
 * @param row  the row index (zero-based).
 *
 * @return The total of the values in the specified row.
 */
public static double calculateRowTotal(Values2D data, int row) {
    ParamChecks.nullNotPermitted(data, "data");
    double total = 0.0;
    int columnCount = data.getColumnCount();
    for (int c = 0; c < columnCount; c++) {
        Number n = data.getValue(row, c);
        if (n != null) {
            total += n.doubleValue();
        }
    }
    return total;
}

From source file:org.jfree.data.xyz.XYZSeriesCollection.java

/**
 * Returns the series with the specified key, or <code>null</code> if 
 * there is no such series./*  ww w  . j  a va  2  s.  c  o m*/
 * 
 * @param key  the key (<code>null</code> not permitted).
 * 
 * @return The series. 
 * 
 * @since 1.2
 */
public XYZSeries getSeries(Comparable<?> key) {
    ParamChecks.nullNotPermitted(key, "key");
    for (XYZSeries s : this.series) {
        if (s.getKey().equals(key)) {
            return s;
        }
    }
    return null;
}

From source file:org.jfree.data.xy.IntervalXYDelegate.java

/**
 * Creates a new delegate for the specified dataset.
 *
 * @param dataset  the underlying dataset (<code>null</code> not permitted).
 * @param autoWidth  a flag that controls whether the interval width is
 *                   calculated automatically.
 *///from   w ww.j a  v  a2s .c om
public IntervalXYDelegate(XYDataset dataset, boolean autoWidth) {
    ParamChecks.nullNotPermitted(dataset, "dataset");
    this.dataset = dataset;
    this.autoWidth = autoWidth;
    this.intervalPositionFactor = 0.5;
    this.autoIntervalWidth = Double.POSITIVE_INFINITY;
    this.fixedIntervalWidth = 1.0;
}

From source file:de.hs.mannheim.modUro.controller.diagram.fx.ChartViewer.java

/**
 * Sets the chart to be displayed by this node.
 *
 * @param chart the chart ({@code null} not permitted).
 *//*from ww  w  . j  a va 2s.  c  o m*/
public void setChart(JFreeChart chart) {
    ParamChecks.nullNotPermitted(chart, "chart");
    this.chart = chart;
    ChartViewerSkin skin = (ChartViewerSkin) getSkin();
    skin.setChart(chart);
}