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.KeyToGroupMap.java

/**
 * Creates a new map with the specified default group.
 *
 * @param defaultGroup  the default group (<code>null</code> not permitted).
 *//*from   w ww  .j a va2  s  . c om*/
public KeyToGroupMap(Comparable defaultGroup) {
    ParamChecks.nullNotPermitted(defaultGroup, "defaultGroup");
    this.defaultGroup = defaultGroup;
    this.groups = new ArrayList();
    this.keyToGroupMap = new HashMap();
}

From source file:org.jfree.data.extension.impl.AbstractDatasetSelectionExtension.java

/**
 * Creates a new instance.//w  w  w .  j a  va2  s .c  o  m
 * 
 * @param dataset  the underlying dataset ({@code null} not permitted).
 */
public AbstractDatasetSelectionExtension(DATASET dataset) {
    ParamChecks.nullNotPermitted(dataset, "dataset");
    this.dataset = dataset;
    this.dataset.addChangeListener(this);
}

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

/**
 * Returns the index of the series with the specified key, or 
 * <code>-1</code> if there is no series with the specified key.
 * /* w w w  . j a  v a 2s. c  om*/
 * @param key  the key (<code>null</code> not permitted).
 * 
 * @return The series index or <code>-1</code>. 
 */
public int getSeriesIndex(Comparable<?> key) {
    ParamChecks.nullNotPermitted(key, "key");
    return getSeriesKeys().indexOf(key);
}

From source file:org.jfree.data.gantt.XYTaskDataset.java

/**
 * Creates a new dataset based on the supplied collection of tasks.
 *
 * @param tasks  the underlying dataset (<code>null</code> not permitted).
 *///from   w  w  w  .ja va  2 s.  co  m
public XYTaskDataset(TaskSeriesCollection tasks) {
    ParamChecks.nullNotPermitted(tasks, "tasks");
    this.underlying = tasks;
    this.seriesWidth = 0.8;
    this.underlying.addChangeListener(this);
}

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

/**
 * Creates a new instance.  The modifier keys are used to select a 
 * mouse handler to be the current "live" handler (when a handler is
 * used as an auxiliary handler, the modifier keys are not relevant).
 * //from   w  ww .  java2  s  . c  o m
 * @param id  the handler id (<code>null</code> not permitted).
 * @param altKey  require ALT key modifier?
 * @param ctrlKey  require ALT key modifier?
 * @param metaKey  require ALT key modifier?
 * @param shiftKey   require ALT key modifier?
 */
public AbstractMouseHandlerFX(String id, boolean altKey, boolean ctrlKey, boolean metaKey, boolean shiftKey) {
    ParamChecks.nullNotPermitted(id, "id");
    this.id = id;
    this.enabled = true;
    this.altKey = altKey;
    this.ctrlKey = ctrlKey;
    this.metaKey = metaKey;
    this.shiftKey = shiftKey;
}

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

/**
 * Creates a new histogram dataset.  Note that the
 * <code>adjustForBinSize</code> flag defaults to <code>true</code>.
 *
 * @param key  the series key (<code>null</code> not permitted).
 *//*from w ww .  j a v a2  s .  co m*/
public SimpleHistogramDataset(Comparable key) {
    ParamChecks.nullNotPermitted(key, "key");
    this.key = key;
    this.bins = new ArrayList();
    this.adjustForBinSize = true;
}

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

/**
 * Returns the total of the values in one column of the supplied data
 * table.//  ww w .  j  a  va2s .  c  om
 *
 * @param data  the table of values (<code>null</code> not permitted).
 * @param column  the column index (zero-based).
 *
 * @return The total of the values in the specified column.
 */
public static double calculateColumnTotal(Values2D data, int column) {
    ParamChecks.nullNotPermitted(data, "data");
    double total = 0.0;
    int rowCount = data.getRowCount();
    for (int r = 0; r < rowCount; r++) {
        Number n = data.getValue(r, column);
        if (n != null) {
            total += n.doubleValue();
        }
    }
    return total;
}

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

/**
 * Removes the specified series from the collection and sends a
 * {@link DatasetChangeEvent} to all registered listeners.
 *
 * @param series  the series (<code>null</code> not permitted).
 *
 * @return A boolean indicating whether the series has actually been
 *         removed./*from  www  . jav  a 2 s. c o m*/
 */
public boolean removeSeries(VectorSeries series) {
    ParamChecks.nullNotPermitted(series, "series");
    boolean removed = this.data.remove(series);
    if (removed) {
        series.removeChangeListener(this);
        fireDatasetChanged();
    }
    return removed;
}

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

/**
 * Creates a new {@link TimeSeries} containing moving average values for
 * the given series.  If the series is empty (contains zero items), the
 * result is an empty series./*from   w  w w. ja v  a  2  s .  c  om*/
 *
 * @param source  the source series.
 * @param name  the name of the new series.
 * @param periodCount  the number of periods used in the average
 *                     calculation.
 * @param skip  the number of initial periods to skip.
 *
 * @return The moving average series.
 */
public static TimeSeries createMovingAverage(TimeSeries source, String name, int periodCount, int skip) {

    ParamChecks.nullNotPermitted(source, "source");
    if (periodCount < 1) {
        throw new IllegalArgumentException("periodCount must be greater " + "than or equal to 1.");
    }

    TimeSeries result = new TimeSeries(name);

    if (source.getItemCount() > 0) {

        // if the initial averaging period is to be excluded, then
        // calculate the index of the
        // first data item to have an average calculated...
        long firstSerial = source.getTimePeriod(0).getSerialIndex() + skip;

        for (int i = source.getItemCount() - 1; i >= 0; i--) {

            // get the current data item...
            RegularTimePeriod period = source.getTimePeriod(i);
            long serial = period.getSerialIndex();

            if (serial >= firstSerial) {
                // work out the average for the earlier values...
                int n = 0;
                double sum = 0.0;
                long serialLimit = period.getSerialIndex() - periodCount;
                int offset = 0;
                boolean finished = false;

                while ((offset < periodCount) && (!finished)) {
                    if ((i - offset) >= 0) {
                        TimeSeriesDataItem item = source.getRawDataItem(i - offset);
                        RegularTimePeriod p = item.getPeriod();
                        Number v = item.getValue();
                        long currentIndex = p.getSerialIndex();
                        if (currentIndex > serialLimit) {
                            if (v != null) {
                                sum = sum + v.doubleValue();
                                n = n + 1;
                            }
                        } else {
                            finished = true;
                        }
                    }
                    offset = offset + 1;
                }
                if (n > 0) {
                    result.add(period, sum / n);
                } else {
                    result.add(period, null);
                }
            }

        }
    }

    return result;

}

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

/**
 * Constructs a new data item that associates a value with a time period.
 *
 * @param period  the time period (<code>null</code> not permitted).
 * @param value  the value (<code>null</code> permitted).
 *///from   w w w  .  j  av  a 2s  . c  om
public TimeSeriesDataItem(RegularTimePeriod period, Number value) {
    ParamChecks.nullNotPermitted(period, "period");
    this.period = period;
    this.value = value;
}