public final class StandardPieDataset3D extends AbstractDataset3D implements PieDataset3D, java.io.Serializable
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.
KeyedValues<Number>, so the following useful utility
methods can be used:
DataUtils.total(com.orsoncharts.data.Values)
JSONUtils.writeKeyedValues(com.orsoncharts.data.KeyedValues)
| Constructor and Description |
|---|
StandardPieDataset3D()
Creates a new (empty) dataset.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(java.lang.Comparable<?> key,
double value)
Adds a value to the dataset (if there is already a value with the given
key, the value is overwritten) and sends a
Dataset3DChangeEvent
to all registered listeners. |
void |
add(java.lang.Comparable<?> key,
java.lang.Number value)
Adds a value to the dataset (if there is already a value with the given
key, the value is overwritten) and sends a
Dataset3DChangeEvent
to all registered listeners. |
boolean |
equals(java.lang.Object obj)
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 |
getIndex(java.lang.Comparable<?> key)
Returns the index for the specified key, or
-1 if the key
is not present in the list. |
int |
getItemCount()
Returns the number of items in the dataset.
|
java.lang.Comparable<?> |
getKey(int item)
Returns the key for the specified item in the list.
|
java.util.List<java.lang.Comparable<?>> |
getKeys()
Returns a list of all the keys in the dataset.
|
java.lang.Number |
getValue(java.lang.Comparable<?> key)
Returns the value associated with the specified key, or
null. |
java.lang.Number |
getValue(int item)
Returns the value for the specified item.
|
java.lang.String |
toString()
Returns a string representation of this instance, primarily for
debugging purposes.
|
addChangeListener, fireChangeEvent, fireDatasetChanged, hasListener, isNotify, notifyListeners, removeChangeListener, setNotifyclone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddChangeListener, hasListener, removeChangeListenerpublic StandardPieDataset3D()
public int getItemCount()
getItemCount in interface Values<java.lang.Number>public java.lang.Comparable<?> getKey(int item)
getKey in interface KeyedValues<java.lang.Number>item - the item index.public int getIndex(java.lang.Comparable<?> key)
-1 if the key
is not present in the list.getIndex in interface KeyedValues<java.lang.Number>key - the key (null not permitted).-1.public java.lang.Number getValue(int item)
public java.lang.Number getValue(java.lang.Comparable<?> key)
null.getValue in interface KeyedValues<java.lang.Number>key - the key (null not permitted).null).public void add(java.lang.Comparable<?> key, double value)
Dataset3DChangeEvent
to all registered listeners.key - the key (null not permitted).value - the value.public void add(java.lang.Comparable<?> key, java.lang.Number value)
Dataset3DChangeEvent
to all registered listeners.key - the key (null not permitted).value - the value (null permitted).public java.util.List<java.lang.Comparable<?>> getKeys()
getKeys in interface KeyedValues<java.lang.Number>null).public double getDoubleValue(int item)
getValue(int) method returns null, this method
returns Double.NaN.getDoubleValue in interface Values<java.lang.Number>item - the item index.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the object (null not permitted).public java.lang.String toString()
JSONUtils.writeKeyedValues(com.orsoncharts.data.KeyedValues).toString in class java.lang.Object