gt:         WindDataItem windItem = (WindDataItem) oneSeriesData.get(item);
context: /* ===========================================================
   * JFreeChart : a free chart library for the Java(tm) platform
   * ===========================================================
   *
   * (C) Copyright 2000-2016, by Object Refinery Limited and Contributors.
   *
   * Project Info:  http://www.jfree.org/jfreechart/index.html
   *
   * This library is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as published by
   * the Free Software Foundation; either version 2.1 of the License, or
   * (at your option) any later version.
   *
   * This library is distributed in the hope that it will be useful, but
   * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
   * License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this library; if not, write to the Free Software
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
   * USA.
   *
   * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. 
   * Other names may be trademarks of their respective owners.]
   *
   * -----------------------
   * DefaultWindDataset.java
   * -----------------------
   * (C) Copyright 2001-2016, by Achilleus Mantzios and Contributors.
   *
   * Original Author:  Achilleus Mantzios;
   * Contributor(s):   David Gilbert (for Object Refinery Limited);
   *
   * Changes
   * -------
   * 06-Feb-2002 : Version 1, based on code contributed by Achilleus
   *               Mantzios (DG);
   * 05-May-2004 : Now extends AbstractXYDataset (DG);
   * 15-Jul-2004 : Switched getX() with getXValue() and getY() with
   *               getYValue() (DG);
   * 02-Feb-2007 : Removed author tags all over JFreeChart sources (DG);
   * 22-Apr-2008 : Implemented PublicCloneable (DG);
   * 03-Jul-2013 : Use ParamChecks (DG);
   *
   */
  
  package org.jfree.data.xy;
  
  import java.io.Serializable;
  import java.util.Arrays;
  import java.util.Collections;
  import java.util.Date;
  import java.util.List;
  import org.jfree.chart.util.ParamChecks;
  
  import org.jfree.util.PublicCloneable;
  
  /**
   * A default implementation of the {@link WindDataset} interface.
   */
  public class DefaultWindDataset extends AbstractXYDataset
          implements WindDataset, PublicCloneable {
  
      /** The keys for the series. */
      private List seriesKeys;
  
      /** Storage for the series data. */
      private List allSeriesData;
  
      /**
       * Constructs a new, empty, dataset.  Since there are currently no methods
       * to add data to an existing dataset, you should probably use a different
       * constructor.
       */
      public DefaultWindDataset() {
          this.seriesKeys = new java.util.ArrayList();
          this.allSeriesData = new java.util.ArrayList();
      }
  
      /**
       * Constructs a dataset based on the specified data array.
       *
       * @param data  the data ({@code null} not permitted).
       *
       * @throws NullPointerException if {@code data} is {@code null}.
       */
      public DefaultWindDataset(Object[][][] data) {
          this(seriesNameListFromDataArray(data), data);
      }
  
      /**
       * Constructs a dataset based on the specified data array.
       *
       * @param seriesNames  the names of the series ({@code null} not
       *     permitted).
       * @param data  the wind data.
       *
       * @throws NullPointerException if {@code seriesNames} is {@code null}.
       */
      public DefaultWindDataset(String[] seriesNames, Object[][][] data) {
          this(Arrays.asList(seriesNames), data);
      }
  
      /**
       * 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:
       * <ul>
       * <li>{@code data[series][item][0]} - the date (either a
       *   {@code Date} or a {@code Number} that is the milliseconds
       *   since 1-Jan-1970);</li>
       * <li>{@code data[series][item][1]} - the wind direction (1 - 12,
       *   like the numbers on a clock face);</li>
       * <li>{@code data[series][item][2]} - the wind force (1 - 12 on the
       *   Beaufort scale)</li>
       * </ul>
       *
       * @param seriesKeys  the names of the series ({@code null} not
       *     permitted).
       * @param data  the wind dataset ({@code null} not permitted).
       *
       * @throws IllegalArgumentException if {@code seriesKeys} is
       *     {@code null}.
       * @throws IllegalArgumentException if the number of series keys does not
       *     match the number of series in the array.
       * @throws NullPointerException if {@code data} is {@code null}.
       */
      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);
          }
  
      }
  
      /**
       * Returns the number of series in the dataset.
       *
       * @return The series count.
       */
      @Override
      public int getSeriesCount() {
          return this.allSeriesData.size();
      }
  
      /**
       * Returns the number of items in a series.
       *
       * @param series  the series (zero-based index).
       *
       * @return The item count.
       */
      @Override
      public int getItemCount(int series) {
          if (series < 0 || series >= getSeriesCount()) {
              throw new IllegalArgumentException("Invalid series index: "
                      + series);
          }
          List oneSeriesData = (List) this.allSeriesData.get(series);
          return oneSeriesData.size();
      }
  
      /**
       * Returns the key for a series.
       *
       * @param series  the series (zero-based index).
       *
       * @return The series key.
       */
      @Override
      public Comparable getSeriesKey(int series) {
          if (series < 0 || series >= getSeriesCount()) {
              throw new IllegalArgumentException("Invalid series index: "
                      + series);
          }
          return (Comparable) this.seriesKeys.get(series);
      }
  
      /**
       * Returns the x-value for one item within a series.  This should represent
       * a point in time, encoded as milliseconds in the same way as
       * java.util.Date.
       *
       * @param series  the series (zero-based index).
       * @param item  the item (zero-based index).
       *
       * @return The x-value for the item within the series.
       */
      @Override
      public Number getX(int series, int item) {
          List oneSeriesData = (List) this.allSeriesData.get(series);
  