Package org.jfree.data.general
Class AbstractDataset
java.lang.Object
org.jfree.data.general.AbstractDataset
- All Implemented Interfaces:
ObjectInputValidation
,Serializable
,Cloneable
,Dataset
- Direct Known Subclasses:
AbstractSeriesDataset
,CategoryToPieDataset
,DefaultBoxAndWhiskerCategoryDataset
,DefaultCategoryDataset
,DefaultFlowDataset
,DefaultHeatMapDataset
,DefaultKeyedValueDataset
,DefaultMultiValueCategoryDataset
,DefaultPieDataset
,DefaultStatisticalCategoryDataset
,DefaultValueDataset
,SlidingCategoryDataset
,SlidingGanttCategoryDataset
,WaferMapDataset
public abstract class AbstractDataset
extends Object
implements Dataset, Cloneable, Serializable, ObjectInputValidation
An abstract implementation of the
Dataset
interface, containing a
mechanism for registering change listeners.- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addChangeListener
(DatasetChangeListener listener) Registers an object to receive notification of changes to the dataset.boolean
Ensures symmetry between super/subclass implementations of equals.clone()
Returns a clone of the dataset.boolean
protected void
Notifies all registered listeners that the dataset has changed, provided that thenotify
flag has not been set tofalse
.getGroup()
Returns the dataset group for the dataset.boolean
Returns the value of the notify flag.int
hashCode()
boolean
hasListener
(EventListener listener) Returnstrue
if the specified object is registered with the dataset as a listener.protected void
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 thefireDatasetChanged()
method notifies listeners.void
Validates the object.
-
Constructor Details
-
AbstractDataset
protected AbstractDataset()Constructs a dataset. By default, the dataset is assigned to its own group.
-
-
Method Details
-
hashCode
-
canEqual
Ensures symmetry between super/subclass implementations of equals. For more detail, see http://jqno.nl/equalsverifier/manual/inheritance.- Parameters:
other
- Object- Returns:
- true ONLY if the parameter is THIS class type
-
equals
-
getGroup
Returns the dataset group for the dataset. -
setGroup
Sets the dataset group for the dataset. -
getNotify
Returns the value of the notify flag. The default value istrue
. If this isfalse
, calls to thefireDatasetChanged()
method will NOT trigger a dataset change event.- Returns:
- A boolean.
-
setNotify
Sets the notify flag, which controls whether or not thefireDatasetChanged()
method notifies listeners. Setting this flag totrue
will trigger aDatasetChangeEvent
because there may be queued up changes.- Parameters:
notify
- the new flag value.
-
addChangeListener
Registers an object to receive notification of changes to the dataset.- Specified by:
addChangeListener
in interfaceDataset
- Parameters:
listener
- the object to register.- See Also:
-
removeChangeListener
Deregisters an object so that it no longer receives notification of changes to the dataset.- Specified by:
removeChangeListener
in interfaceDataset
- Parameters:
listener
- the object to deregister.- See Also:
-
hasListener
Returnstrue
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:
-
fireDatasetChanged
Notifies all registered listeners that the dataset has changed, provided that thenotify
flag has not been set tofalse
.- See Also:
-
notifyListeners
Notifies all registered listeners that the dataset has changed.- Parameters:
event
- contains information about the event that triggered the notification.- See Also:
-
clone
Returns a clone of the dataset. The cloned dataset will NOT include theDatasetChangeListener
references that have been registered with this dataset.- Overrides:
clone
in classObject
- Returns:
- A clone.
- Throws:
CloneNotSupportedException
- if the dataset does not support cloning.
-
validateObject
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 interfaceObjectInputValidation
- Throws:
InvalidObjectException
- If the object cannot validate itself.
-