Module org.jfree.chart3d
Package org.jfree.chart3d.data
Class StandardPieDataset3D<K extends Comparable<K>>
java.lang.Object
org.jfree.chart3d.data.AbstractDataset3D
org.jfree.chart3d.data.StandardPieDataset3D<K>
- Type Parameters:
K
- the key type.
- All Implemented Interfaces:
Serializable
,Dataset3D
,KeyedValues<K,
,Number> PieDataset3D<K>
,Values<Number>
public final class StandardPieDataset3D<K extends Comparable<K>>
extends AbstractDataset3D
implements PieDataset3D<K>, Serializable
A dataset that can be used with a
This class provides an implementation of
NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
PiePlot3D
. This class represents
an ordered list of (key, value) items. The keys can be any instance of
Comparable
(String
is commonly used) and the values
can be any Number
instance (bearing in mind that the downstream
code will use the toDouble()
method to read values) or
null
.
This class provides an implementation of
KeyedValues<Number>
, so the following useful utility
methods can be used:
DataUtils.total(org.jfree.chart3d.data.Values)
JSONUtils.writeKeyedValues(org.jfree.chart3d.data.KeyedValues)
NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a value to the dataset (if there is already a value with the given key, the value is overwritten) and sends aDataset3DChangeEvent
to all registered listeners.void
Adds a value to the dataset (if there is already a value with the given key, the value is overwritten) and sends aDataset3DChangeEvent
to all registered listeners.boolean
Tests this dataset for equality with an arbitrary object.double
getDoubleValue
(int item) Returns the value for the specified item as a double primitive.int
Returns the index for the specified key, or-1
if the key is not present in the list.int
Returns the number of items in the dataset.getKey
(int item) Returns the key for the specified item in the list.getKeys()
Returns a list of all the keys in the dataset.getValue
(int item) Returns the value for the specified item.Returns the value associated with the specified key, ornull
.toString()
Returns a string representation of this instance, primarily for debugging purposes.Methods inherited from class org.jfree.chart3d.data.AbstractDataset3D
addChangeListener, fireChangeEvent, fireDatasetChanged, hasListener, isNotify, notifyListeners, removeChangeListener, setNotify
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jfree.chart3d.data.Dataset3D
addChangeListener, hasListener, removeChangeListener
-
Constructor Details
-
StandardPieDataset3D
public StandardPieDataset3D()Creates a new (empty) dataset.
-
-
Method Details
-
getItemCount
Returns the number of items in the dataset.- Specified by:
getItemCount
in interfaceValues<K extends Comparable<K>>
- Returns:
- The number of items in the dataset.
-
getKey
Returns the key for the specified item in the list.- Specified by:
getKey
in interfaceKeyedValues<K extends Comparable<K>,
Number> - Parameters:
item
- the item index.- Returns:
- The key.
-
getIndex
Returns the index for the specified key, or-1
if the key is not present in the list.- Specified by:
getIndex
in interfaceKeyedValues<K extends Comparable<K>,
Number> - Parameters:
key
- the key (null
not permitted).- Returns:
- The item index, or
-1
.
-
getValue
Returns the value for the specified item.- Specified by:
getValue
in interfaceValues<K extends Comparable<K>>
- Parameters:
item
- the item index.- Returns:
- The value for the specified item (possibly
null
).
-
getValue
Returns the value associated with the specified key, ornull
.- Specified by:
getValue
in interfaceKeyedValues<K extends Comparable<K>,
Number> - Parameters:
key
- the key (null
not permitted).- Returns:
- The value (possibly
null
).
-
add
Adds a value to the dataset (if there is already a value with the given key, the value is overwritten) and sends aDataset3DChangeEvent
to all registered listeners.- Parameters:
key
- the key (null
not permitted).value
- the value.
-
add
Adds a value to the dataset (if there is already a value with the given key, the value is overwritten) and sends aDataset3DChangeEvent
to all registered listeners.- Parameters:
key
- the key (null
not permitted).value
- the value (null
permitted).
-
getKeys
Returns a list of all the keys in the dataset. Note that the list will be a copy, so modifying it will not impact this dataset.- Specified by:
getKeys
in interfaceKeyedValues<K extends Comparable<K>,
Number> - Returns:
- A list of keys (possibly empty, but never
null
).
-
getDoubleValue
Returns the value for the specified item as a double primitive. Where thegetValue(int)
method returnsnull
, this method returnsDouble.NaN
.- Specified by:
getDoubleValue
in interfaceValues<K extends Comparable<K>>
- Parameters:
item
- the item index.- Returns:
- The value for the specified item.
-
equals
Tests this dataset for equality with an arbitrary object. -
toString
Returns a string representation of this instance, primarily for debugging purposes.
Implementation note: the current implementation (which is subject to change) writes the dataset in JSON format usingJSONUtils.writeKeyedValues(org.jfree.chart3d.data.KeyedValues)
.
-