org.jfree.data.general

## Class AbstractDataset

- java.lang.Object
- - org.jfree.data.general.AbstractDataset

- All Implemented Interfaces:
    java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, Dataset
  Direct Known Subclasses:
    AbstractSeriesDataset

      public abstract class AbstractDataset
      extends java.lang.Object
      implements Dataset, java.lang.Cloneable, java.io.Serializable, java.io.ObjectInputValidation

  An abstract implementation of the `Dataset` interface, containing a mechanism for registering change listeners.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractDataset()` Constructs a dataset.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addChangeListener(DatasetChangeListener listener)` Registers an object to receive notification of changes to the dataset.
    `java.lang.Object` | `clone()` Returns a clone of the dataset.
    `protected void` | `fireDatasetChanged()` Notifies all registered listeners that the dataset has changed, provided that the `notify` flag has not been set to `false`.
    `DatasetGroup` | `getGroup()` Returns the dataset group for the dataset.
    `boolean` | `getNotify()` Returns the value of the notify flag.
    `boolean` | `hasListener(java.util.EventListener listener)` Returns `true` if the specified object is registered with the dataset as a listener.
    `protected void` | `notifyListeners(DatasetChangeEvent event)` Notifies all registered listeners that the dataset has changed.
    `void` | `removeChangeListener(DatasetChangeListener listener)` Deregisters an object so that it no longer receives notification of changes to the dataset.
    `void` | `setGroup(DatasetGroup group)` Sets the dataset group for the dataset.
    `void` | `setNotify(boolean notify)` Sets the notify flag, which controls whether or not the `fireDatasetChanged()` method notifies listeners.
    `void` | `validateObject()` Validates the object.

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractDataset

          protected AbstractDataset()

      Constructs a dataset. By default, the dataset is assigned to its own group.

  - ### Method Detail

    - #### getGroup

          public DatasetGroup getGroup()

      Returns the dataset group for the dataset.
      Specified by:
        `getGroup` in interface `Dataset`
      Returns:
        The group (never `null`).
      See Also:
        `setGroup(DatasetGroup)`

    - #### setGroup

          public void setGroup(DatasetGroup group)

      Sets the dataset group for the dataset.
      Specified by:
        `setGroup` in interface `Dataset`
      Parameters:
        `group` - the group (`null` not permitted).
      See Also:
        `getGroup()`

    - #### getNotify

          public boolean getNotify()

      Returns the value of the notify flag. The default value is `true`. If this is `false`, calls to the `fireDatasetChanged()` method will NOT trigger a dataset change event.
      Returns:
        A boolean.
      Since:
        1.0.17

    - #### setNotify

          public void setNotify(boolean notify)

      Sets the notify flag, which controls whether or not the `fireDatasetChanged()` method notifies listeners. Setting this flag to `true` will trigger a `DatasetChangeEvent` because there may be queued up changes.
      Parameters:
        `notify` - the new flag value.
      Since:
        1.0.17

    - #### addChangeListener

          public void addChangeListener(DatasetChangeListener listener)

      Registers an object to receive notification of changes to the dataset.
      Specified by:
        `addChangeListener` in interface `Dataset`
      Parameters:
        `listener` - the object to register.
      See Also:
        `removeChangeListener(DatasetChangeListener)`

    - #### removeChangeListener

          public void removeChangeListener(DatasetChangeListener listener)

      Deregisters an object so that it no longer receives notification of changes to the dataset.
      Specified by:
        `removeChangeListener` in interface `Dataset`
      Parameters:
        `listener` - the object to deregister.
      See Also:
        `addChangeListener(DatasetChangeListener)`

    - #### hasListener

          public boolean hasListener(java.util.EventListener listener)

      Returns `true` if the specified object is registered with the dataset as a listener. Most applications won't need to call this method, it exists mainly for use by unit testing code.
      Parameters:
        `listener` - the listener.
      Returns:
        A boolean.
      See Also:
        `addChangeListener(DatasetChangeListener)`, `removeChangeListener(DatasetChangeListener)`

    - #### fireDatasetChanged

          protected void fireDatasetChanged()

      Notifies all registered listeners that the dataset has changed, provided that the `notify` flag has not been set to `false`.
      See Also:
        `addChangeListener(DatasetChangeListener)`

    - #### notifyListeners

          protected void notifyListeners(DatasetChangeEvent event)

      Notifies all registered listeners that the dataset has changed.
      Parameters:
        `event` - contains information about the event that triggered the notification.
      See Also:
        `addChangeListener(DatasetChangeListener)`, `removeChangeListener(DatasetChangeListener)`

    - #### clone

          public java.lang.Object clone()
                                 throws java.lang.CloneNotSupportedException

      Returns a clone of the dataset. The cloned dataset will NOT include the `DatasetChangeListener` references that have been registered with this dataset.
      Overrides:
        `clone` in class `java.lang.Object`
      Returns:
        A clone.
      Throws:
        `java.lang.CloneNotSupportedException` - if the dataset does not support cloning.

    - #### validateObject

          public void validateObject()
                              throws java.io.InvalidObjectException

      Validates the object. We use this opportunity to call listeners who have registered during the deserialization process, as listeners are not serialized. This method is called by the serialization system after the entire graph is read. This object has registered itself to the system with a priority of 10. Other callbacks may register with a higher priority number to be called before this object, or with a lower priority number to be called after the listeners were notified. All listeners are supposed to have register by now, either in their readObject or validateObject methods. Notify them that this dataset has changed.
      Specified by:
        `validateObject` in interface `java.io.ObjectInputValidation`
      Throws:
        `java.io.InvalidObjectException` - If the object cannot validate itself.