Example usage for org.jfree.chart.util PublicCloneable clone

List of usage examples for org.jfree.chart.util PublicCloneable clone

Introduction

In this page you can find the example usage for org.jfree.chart.util PublicCloneable clone.

Prototype

public Object clone() throws CloneNotSupportedException;

Source Link

Document

Returns a clone of the object.

Usage

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

/**
 * Returns a clone of this object.  It is assumed that the key is an
 * immutable object, so it is not deep-cloned.  The object is deep-cloned
 * if it implements {@link PublicCloneable}, otherwise a shallow clone is
 * made.//  w w w.  j a  v a 2  s  . c  o  m
 *
 * @return A clone.
 *
 * @throws CloneNotSupportedException if there is a problem cloning.
 */
@Override
public Object clone() throws CloneNotSupportedException {
    KeyedObject clone = (KeyedObject) super.clone();
    if (this.object instanceof PublicCloneable) {
        PublicCloneable pc = (PublicCloneable) this.object;
        clone.object = pc.clone();
    }
    return clone;
}

From source file:org.jfree.data.category.SlidingCategoryDataset.java

/**
 * Returns an independent copy of the dataset.  Note that:
 * <ul>//from w  ww  .  ja  v a2s. c  o  m
 * <li>the underlying dataset is only cloned if it implements the
 * {@link PublicCloneable} interface;</li>
 * <li>the listeners registered with this dataset are not carried over to
 * the cloned dataset.</li>
 * </ul>
 *
 * @return An independent copy of the dataset.
 *
 * @throws CloneNotSupportedException if the dataset cannot be cloned for
 *         any reason.
 */
@Override
public Object clone() throws CloneNotSupportedException {
    SlidingCategoryDataset clone = (SlidingCategoryDataset) super.clone();
    if (this.underlying instanceof PublicCloneable) {
        PublicCloneable pc = (PublicCloneable) this.underlying;
        clone.underlying = (CategoryDataset) pc.clone();
    }
    return clone;
}

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

/**
 * Returns an independent copy of the dataset.  Note that:
 * <ul>//from  w w  w .  j  a  va 2 s.  co m
 * <li>the underlying dataset is only cloned if it implements the
 * {@link PublicCloneable} interface;</li>
 * <li>the listeners registered with this dataset are not carried over to
 * the cloned dataset.</li>
 * </ul>
 *
 * @return An independent copy of the dataset.
 *
 * @throws CloneNotSupportedException if the dataset cannot be cloned for
 *         any reason.
 */
@Override
public Object clone() throws CloneNotSupportedException {
    XYBarDataset clone = (XYBarDataset) super.clone();
    if (this.underlying instanceof PublicCloneable) {
        PublicCloneable pc = (PublicCloneable) this.underlying;
        clone.underlying = (XYDataset) pc.clone();
    }
    return clone;
}

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

/**
 * Returns an independent copy of the dataset.  Note that:
 * <ul>/*from ww  w.  j  a va2s . com*/
 * <li>the underlying dataset is only cloned if it implements the
 * {@link PublicCloneable} interface;</li>
 * <li>the listeners registered with this dataset are not carried over to
 * the cloned dataset.</li>
 * </ul>
 *
 * @return An independent copy of the dataset.
 *
 * @throws CloneNotSupportedException if the dataset cannot be cloned for
 *         any reason.
 */
@Override
public Object clone() throws CloneNotSupportedException {
    SlidingGanttCategoryDataset clone = (SlidingGanttCategoryDataset) super.clone();
    if (this.underlying instanceof PublicCloneable) {
        PublicCloneable pc = (PublicCloneable) this.underlying;
        clone.underlying = (GanttCategoryDataset) pc.clone();
    }
    return clone;
}