Class DefaultPieDataset

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clears all data from this dataset and sends a DatasetChangeEvent to all registered listeners (unless the dataset was already empty).
      java.lang.Object clone()
      Returns a clone of the dataset.
      boolean equals​(java.lang.Object obj)
      Tests if this object is equal to another.
      int getIndex​(java.lang.Comparable key)
      Returns the index for a key, or -1 if the key is not recognised.
      int getItemCount()
      Returns the number of items in the dataset.
      java.lang.Comparable getKey​(int item)
      Returns the key for the specified item, or null.
      java.util.List getKeys()
      Returns the categories in the dataset.
      java.lang.Number getValue​(int item)
      Returns a value.
      java.lang.Number getValue​(java.lang.Comparable key)
      Returns the data value associated with a key.
      int hashCode()
      Returns a hash code.
      void insertValue​(int position, java.lang.Comparable key, double value)
      Inserts a new value at the specified position in the dataset or, if there is an existing item with the specified key, updates the value for that item and moves it to the specified position.
      void insertValue​(int position, java.lang.Comparable key, java.lang.Number value)
      Inserts a new value at the specified position in the dataset or, if there is an existing item with the specified key, updates the value for that item and moves it to the specified position.
      void remove​(java.lang.Comparable key)
      Removes an item from the dataset and sends a DatasetChangeEvent to all registered listeners.
      void setValue​(java.lang.Comparable key, double value)
      Sets the data value for a key and sends a DatasetChangeEvent to all registered listeners.
      void setValue​(java.lang.Comparable key, java.lang.Number value)
      Sets the data value for a key and sends a DatasetChangeEvent to all registered listeners.
      void sortByKeys​(org.jfree.util.SortOrder order)
      Sorts the dataset's items by key and sends a DatasetChangeEvent to all registered listeners.
      void sortByValues​(org.jfree.util.SortOrder order)
      Sorts the dataset's items by value and sends a DatasetChangeEvent to all registered listeners.
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getItemCount

        public int getItemCount()
        Returns the number of items in the dataset.
        Specified by:
        getItemCount in interface Values
        Returns:
        The item count.
      • getKeys

        public java.util.List getKeys()
        Returns the categories in the dataset. The returned list is unmodifiable.
        Specified by:
        getKeys in interface KeyedValues
        Returns:
        The categories in the dataset.
      • getKey

        public java.lang.Comparable getKey​(int item)
        Returns the key for the specified item, or null.
        Specified by:
        getKey in interface KeyedValues
        Parameters:
        item - the item index (in the range 0 to getItemCount() - 1).
        Returns:
        The key, or null.
        Throws:
        java.lang.IndexOutOfBoundsException - if item is not in the specified range.
      • getIndex

        public int getIndex​(java.lang.Comparable key)
        Returns the index for a key, or -1 if the key is not recognised.
        Specified by:
        getIndex in interface KeyedValues
        Parameters:
        key - the key (null not permitted).
        Returns:
        The index, or -1 if the key is unrecognised.
        Throws:
        java.lang.IllegalArgumentException - if key is null.
      • getValue

        public java.lang.Number getValue​(int item)
        Returns a value.
        Specified by:
        getValue in interface Values
        Parameters:
        item - the value index.
        Returns:
        The value (possibly null).
      • getValue

        public java.lang.Number getValue​(java.lang.Comparable key)
        Returns the data value associated with a key.
        Specified by:
        getValue in interface KeyedValues
        Parameters:
        key - the key (null not permitted).
        Returns:
        The value (possibly null).
        Throws:
        UnknownKeyException - if the key is not recognised.
      • setValue

        public void setValue​(java.lang.Comparable key,
                             java.lang.Number value)
        Sets the data value for a key and sends a DatasetChangeEvent to all registered listeners.
        Parameters:
        key - the key (null not permitted).
        value - the value.
        Throws:
        java.lang.IllegalArgumentException - if key is null.
      • setValue

        public void setValue​(java.lang.Comparable key,
                             double value)
        Sets the data value for a key and sends a DatasetChangeEvent to all registered listeners.
        Parameters:
        key - the key (null not permitted).
        value - the value.
        Throws:
        java.lang.IllegalArgumentException - if key is null.
      • insertValue

        public void insertValue​(int position,
                                java.lang.Comparable key,
                                double value)
        Inserts a new value at the specified position in the dataset or, if there is an existing item with the specified key, updates the value for that item and moves it to the specified position. After the change is made, this methods sends a DatasetChangeEvent to all registered listeners.
        Parameters:
        position - the position (in the range 0 to getItemCount()).
        key - the key (null not permitted).
        value - the value (null permitted).
        Since:
        1.0.6
      • insertValue

        public void insertValue​(int position,
                                java.lang.Comparable key,
                                java.lang.Number value)
        Inserts a new value at the specified position in the dataset or, if there is an existing item with the specified key, updates the value for that item and moves it to the specified position. After the change is made, this methods sends a DatasetChangeEvent to all registered listeners.
        Parameters:
        position - the position (in the range 0 to getItemCount()).
        key - the key (null not permitted).
        value - the value (null permitted).
        Since:
        1.0.6
      • remove

        public void remove​(java.lang.Comparable key)
        Removes an item from the dataset and sends a DatasetChangeEvent to all registered listeners.
        Parameters:
        key - the key (null not permitted).
        Throws:
        java.lang.IllegalArgumentException - if key is null.
      • clear

        public void clear()
        Clears all data from this dataset and sends a DatasetChangeEvent to all registered listeners (unless the dataset was already empty).
        Since:
        1.0.2
      • sortByKeys

        public void sortByKeys​(org.jfree.util.SortOrder order)
        Sorts the dataset's items by key and sends a DatasetChangeEvent to all registered listeners.
        Parameters:
        order - the sort order (null not permitted).
        Since:
        1.0.3
      • sortByValues

        public void sortByValues​(org.jfree.util.SortOrder order)
        Sorts the dataset's items by value and sends a DatasetChangeEvent to all registered listeners.
        Parameters:
        order - the sort order (null not permitted).
        Since:
        1.0.3
      • equals

        public boolean equals​(java.lang.Object obj)
        Tests if this object is equal to another.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the other object.
        Returns:
        A boolean.
      • hashCode

        public int hashCode()
        Returns a hash code.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        A hash code.
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Returns a clone of the dataset.
        Specified by:
        clone in interface org.jfree.util.PublicCloneable
        Overrides:
        clone in class AbstractDataset
        Returns:
        A clone.
        Throws:
        java.lang.CloneNotSupportedException - This class will not throw this exception, but subclasses (if any) might.