## org.jfree.data.category
Class DefaultCategoryDataset

    java.lang.Object
      org.jfree.data.general.AbstractDataset
          org.jfree.data.category.DefaultCategoryDataset

All Implemented Interfaces:
  java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, CategoryDataset, Dataset, KeyedValues2D, Values2D

Direct Known Subclasses:
  DefaultKeyedValues2DDataset, JDBCCategoryDataset

    public class DefaultCategoryDataset

extends AbstractDataset
implements CategoryDataset, java.io.Serializable

A default implementation of the `CategoryDataset` interface.

See Also:
  Serialized Form

Constructor Summary
`DefaultCategoryDataset()` Creates a new (empty) dataset.

Method Summary
`void` `addValue(double value, java.lang.Comparable rowKey, java.lang.Comparable columnKey)` Adds a value to the table.
`void` `addValue(java.lang.Number value, java.lang.Comparable rowKey, java.lang.Comparable columnKey)` Adds a value to the table.
`void` `clear()` Clears all data from the dataset and sends a `DatasetChangeEvent` to all registered listeners.
`boolean` `equals(java.lang.Object o)` Tests if this object is equal to another.
`int` `getColumnCount()` Returns the number of columns in the table.
`int` `getColumnIndex(java.lang.Comparable key)` Returns the column index for a given key.
`java.lang.Comparable` `getColumnKey(int column)` Returns a column key.
`java.util.List` `getColumnKeys()` Returns the column keys.
`int` `getRowCount()` Returns the number of rows in the table.
`int` `getRowIndex(java.lang.Comparable key)` Returns the row index for a given key.
`java.lang.Comparable` `getRowKey(int row)` Returns a row key.
`java.util.List` `getRowKeys()` Returns the row keys.
`java.lang.Number` `getValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)` Returns the value for a pair of keys.
`java.lang.Number` `getValue(int row, int column)` Returns a value from the table.
`int` `hashCode()` Returns a hash code for the dataset.
`void` `incrementValue(double value, java.lang.Comparable rowKey, java.lang.Comparable columnKey)` Adds the specified value to an existing value in the dataset (if the existing value is `null`, it is treated as if it were 0.0).
`void` `removeColumn(java.lang.Comparable columnKey)` Removes a column from the dataset.
`void` `removeColumn(int columnIndex)` Removes a column from the dataset.
`void` `removeRow(java.lang.Comparable rowKey)` Removes a row from the dataset.
`void` `removeRow(int rowIndex)` Removes a row from the dataset.
`void` `removeValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)` Removes a value from the dataset.
`void` `setValue(double value, java.lang.Comparable rowKey, java.lang.Comparable columnKey)` Adds or updates a value in the table.
`void` `setValue(java.lang.Number value, java.lang.Comparable rowKey, java.lang.Comparable columnKey)` Adds or updates a value in the table.

Methods inherited from class org.jfree.data.general.AbstractDataset
`addChangeListener, clone, fireDatasetChanged, getGroup, notifyListeners, removeChangeListener, setGroup, validateObject`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.jfree.data.general.Dataset
`addChangeListener, getGroup, removeChangeListener, setGroup`

Constructor Detail

### DefaultCategoryDataset

    public DefaultCategoryDataset()

  Creates a new (empty) dataset.

Method Detail

### getRowCount

    public int getRowCount()

  Returns the number of rows in the table.

  Specified by:
    `getRowCount` in interface `Values2D`
  Returns:
    The row count.

### getColumnCount

    public int getColumnCount()

  Returns the number of columns in the table.

  Specified by:
    `getColumnCount` in interface `Values2D`
  Returns:
    The column count.

### getValue

    public java.lang.Number getValue(int row,
                                     int column)

  Returns a value from the table.

  Specified by:
    `getValue` in interface `Values2D`
  Parameters:
    `row` - the row index (zero-based).
    `column` - the column index (zero-based).
  Returns:
    The value (possibly `null`).

### getRowKey

    public java.lang.Comparable getRowKey(int row)

  Returns a row key.

  Specified by:
    `getRowKey` in interface `KeyedValues2D`
  Parameters:
    `row` - the row index (zero-based).
  Returns:
    The row key.

### getRowIndex

    public int getRowIndex(java.lang.Comparable key)

  Returns the row index for a given key.

  Specified by:
    `getRowIndex` in interface `KeyedValues2D`
  Parameters:
    `key` - the row key.
  Returns:
    The row index.

### getRowKeys

    public java.util.List getRowKeys()

  Returns the row keys.

  Specified by:
    `getRowKeys` in interface `KeyedValues2D`
  Returns:
    The keys.

### getColumnKey

    public java.lang.Comparable getColumnKey(int column)

  Returns a column key.

  Specified by:
    `getColumnKey` in interface `KeyedValues2D`
  Parameters:
    `column` - the column index (zero-based).
  Returns:
    The column key.

### getColumnIndex

    public int getColumnIndex(java.lang.Comparable key)

  Returns the column index for a given key.

  Specified by:
    `getColumnIndex` in interface `KeyedValues2D`
  Parameters:
    `key` - the column key.
  Returns:
    The column index.

### getColumnKeys

    public java.util.List getColumnKeys()

  Returns the column keys.

  Specified by:
    `getColumnKeys` in interface `KeyedValues2D`
  Returns:
    The keys.

### getValue

    public java.lang.Number getValue(java.lang.Comparable rowKey,
                                     java.lang.Comparable columnKey)

  Returns the value for a pair of keys.

  This method should return `null` if either of the keys is not found.

  Specified by:
    `getValue` in interface `KeyedValues2D`
  Parameters:
    `rowKey` - the row key.
    `columnKey` - the column key.
  Returns:
    The value.

### addValue

    public void addValue(java.lang.Number value,
                         java.lang.Comparable rowKey,
                         java.lang.Comparable columnKey)

  Adds a value to the table. Performs the same function as setValue(...).

  Parameters:
    `value` - the value.
    `rowKey` - the row key.
    `columnKey` - the column key.

### addValue

    public void addValue(double value,
                         java.lang.Comparable rowKey,
                         java.lang.Comparable columnKey)

  Adds a value to the table.

  Parameters:
    `value` - the value.
    `rowKey` - the row key.
    `columnKey` - the column key.

### setValue

    public void setValue(java.lang.Number value,
                         java.lang.Comparable rowKey,
                         java.lang.Comparable columnKey)

  Adds or updates a value in the table.

  Parameters:
    `value` - the value (`null` permitted).
    `rowKey` - the row key (`null` not permitted).
    `columnKey` - the column key (`null` not permitted).

### setValue

    public void setValue(double value,
                         java.lang.Comparable rowKey,
                         java.lang.Comparable columnKey)

  Adds or updates a value in the table.

  Parameters:
    `value` - the value.
    `rowKey` - the row key (`null` not permitted).
    `columnKey` - the column key (`null` not permitted).

### incrementValue

    public void incrementValue(double value,
                               java.lang.Comparable rowKey,
                               java.lang.Comparable columnKey)

  Adds the specified value to an existing value in the dataset (if the existing value is `null`, it is treated as if it were 0.0).

  Parameters:
    `value` - the value.
    `rowKey` - the row key.
    `columnKey` - the column key.

### removeValue

    public void removeValue(java.lang.Comparable rowKey,
                            java.lang.Comparable columnKey)

  Removes a value from the dataset.

  Parameters:
    `rowKey` - the row key.
    `columnKey` - the column key.

### removeRow

    public void removeRow(int rowIndex)

  Removes a row from the dataset.

  Parameters:
    `rowIndex` - the row index.

### removeRow

    public void removeRow(java.lang.Comparable rowKey)

  Removes a row from the dataset.

  Parameters:
    `rowKey` - the row key.

### removeColumn

    public void removeColumn(int columnIndex)

  Removes a column from the dataset.

  Parameters:
    `columnIndex` - the column index.

### removeColumn

    public void removeColumn(java.lang.Comparable columnKey)

  Removes a column from the dataset.

  Parameters:
    `columnKey` - the column key.

### clear

    public void clear()

  Clears all data from the dataset and sends a `DatasetChangeEvent` to all registered listeners.

### equals

    public boolean equals(java.lang.Object o)

  Tests if this object is equal to another.

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `o` - the other object.
  Returns:
    A boolean.

### hashCode

    public int hashCode()

  Returns a hash code for the dataset.

  Overrides:
    `hashCode` in class `java.lang.Object`
  Returns:
    A hash code.