Example usage for org.jfree.data.xyz XYZSeries getKey

List of usage examples for org.jfree.data.xyz XYZSeries getKey

Introduction

In this page you can find the example usage for org.jfree.data.xyz XYZSeries getKey.

Prototype

public Comparable<?> getKey() 

Source Link

Document

Returns the series key.

Usage

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.//from  w w  w .  j av a  2 s . com
 * 
 * @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.xyz.XYZSeriesCollection.java

/**
 * Returns a new list containing all the series keys.  Modifying this list 
 * will have no impact on the <code>XYZSeriesCollection</code> instance.
 * /*w ww .  ja va  2s  .co m*/
 * @return A list containing the series keys (possibly empty, but never 
 *     <code>null</code>).
 */
public List<Comparable<?>> getSeriesKeys() {
    List<Comparable<?>> result = new ArrayList<Comparable<?>>();
    for (XYZSeries s : this.series) {
        result.add(s.getKey());
    }
    return result;
}

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

/**
 * Adds a series to the collection (note that the series key must be
 * unique within the collection)./*  w w w  . j  a v  a  2 s . c o m*/
 * 
 * @param series  the series (<code>null</code> not permitted). 
 */
public void add(XYZSeries series) {
    ParamChecks.nullNotPermitted(series, "series");
    if (getSeriesIndex(series.getKey()) >= 0) {
        throw new IllegalArgumentException(
                "Another series with the same key already exists within the collection.");
    }
    this.series.add(series);
}