/**
   * Creates a new instance by copying a subset of the data in this collection.
   *
   * @param start the index of the first item to copy.
   * @param end the index of the last item to copy.
   * @return A copy of a subset of the items.
   * @throws CloneNotSupportedException if there is a cloning problem.
   */
  public TimePeriodValues createCopy(int start, int end) throws CloneNotSupportedException {

    TimePeriodValues copy = (TimePeriodValues) super.clone();

    copy.data = new ArrayList();
    if (this.data.size() > 0) {
      for (int index = start; index <= end; index++) {
        TimePeriodValue item = (TimePeriodValue) this.data.get(index);
        TimePeriodValue clone = (TimePeriodValue) item.clone();
        try {
          copy.add(clone);
        } catch (SeriesException e) {
          System.err.println("Failed to add cloned item.");
        }
      }
    }
    return copy;
  }