com.ijchart.xychart.dataset
Class DefaultMatrixDataset

java.lang.Object
  extended by com.ijchart.xychart.dataset.AbstractDataset
      extended by com.ijchart.xychart.dataset.DefaultMatrixDataset
All Implemented Interfaces:
IDataset, IMatrixDataset, IDatasetChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener
Direct Known Subclasses:
SingleRowDataset

public class DefaultMatrixDataset
extends AbstractDataset
implements IMatrixDataset, java.io.Serializable, java.lang.Cloneable

Title: IJChart

Description: a chart library for the Java(tm) platform.

The default implement of interface IMatrixDataset.

Copyright: Copyright (c) 2013

Company:

Version:
1.0
Author:
zhang feng min,shanghai china. Contract me by email.
See Also:
Serialized Form

Constructor Summary
DefaultMatrixDataset()
           No argument constructor.
 
Method Summary
 void addColKey(java.lang.Object colKey)
           Add a ColKey.
 void addData(int rowIndex, IChartData chartData)
           Add a IChartData to dataset.
 void addDatas(int rowIndex, java.util.Collection chartDatas)
           Add IChartData datas to dataset.
 void addDatas(int rowIndex, IChartData[] chartDatas)
           Add IChartData datas to dataset.
 void addRowData()
           Add one row to data list.
 void addRowData(int count)
           Add multiple rows to data list.
 void addRowKey(java.lang.Object rowKey)
           Add a RowKey.
 java.lang.Object deleteColKey(int index)
           Delete ColKey by index.
 boolean deleteColKey(java.lang.Object colKey)
           Delete this ColKey.
 void deleteRow(int rowIndex)
           Delete the datas of a dataset row.
 java.lang.Object deleteRowKey(int index)
           Delete RowKey by index.
 boolean deleteRowKey(java.lang.Object rowKey)
           Delete this RowKey.
 boolean equals(java.lang.Object obj)
           Override equals method.
 java.lang.Object getColKey(int index)
           Get ColKey by index.
 int getColumnCount()
           The column count of this dataset.
 int getColumnCount(int rowIdx)
           The column count of this dataset.
 IChartData getData(int rowIndex, int colIndex)
           Get the data of matrix by rowIndex and colIndex,an Exception will be throw when index out of bound.
protected  java.util.List getDatasetColKeys()
           Returns the colKeys of this dataset,if a column line data is not colKey, is null.
 java.util.List getDatasetRowKeys()
           Returns the rowKeys of this dataset,if a row line data is not rowKey, is null.
 int getRowCount()
           Returns the row count of this dataset.
 java.util.List getRowDatas(int rowIndex)
           Returns all datas of the specified row index.
 java.lang.Object getRowKey(int index)
           Get RolKey by index.
 int hashCode()
           Get hascode.
 boolean isEmpty()
           Returns whether or not the dataset is empty.
 boolean isThisDataType(java.lang.Class c)
           Test whether or not all data is Class c in this dataset.
 void setColKey(int index, java.lang.Object colKey)
           Sets the ColKey value by index.
 void setData(int rowIndex, int colIndex, IChartData chartData)
           Change the dataset value by row index and column index.
 void setRowKey(int index, java.lang.Object rowKey)
           Sets the RowKey value by row index.
 void sortRowData(int rowIndex, SortType sortType)
           Sort the datas of a dataset row,the data must implements Comparable interface.
 
Methods inherited from class com.ijchart.xychart.dataset.AbstractDataset
addChangeListener, clone, datasetChanged, fireDatasetChanged, forceDataSetChanged, hasListener, notifyListeners, removeAllChangeListener, removeChangeListener
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ijchart.xychart.dataset.IDataset
addChangeListener, forceDataSetChanged, removeAllChangeListener, removeChangeListener
 

Constructor Detail

DefaultMatrixDataset

public DefaultMatrixDataset()
No argument constructor.

Method Detail

addRowKey

public void addRowKey(java.lang.Object rowKey)
Add a RowKey.

Parameters:
rowKey - Object RowKey (null permitted).

setRowKey

public void setRowKey(int index,
                      java.lang.Object rowKey)
Sets the RowKey value by row index.

Parameters:
index - int The row index.
rowKey - Object New RowKey value (null permitted).

deleteRowKey

public java.lang.Object deleteRowKey(int index)
Delete RowKey by index.

Parameters:
index - int The row index.
Returns:
Object The deleted ColKey object.

deleteRowKey

public boolean deleteRowKey(java.lang.Object rowKey)
Delete this RowKey.

Parameters:
rowKey - Object The RowKey (null permitted).
Returns:
boolean Returns true if this list contained the specified element.

getRowKey

public java.lang.Object getRowKey(int index)
Get RolKey by index.

Specified by:
getRowKey in interface IMatrixDataset
Parameters:
index - int The row index.
Returns:
Object The RolKey for the index(maybe null).

addColKey

public void addColKey(java.lang.Object colKey)
Add a ColKey.

Parameters:
colKey - Object ColKey (null permitted).

setColKey

public void setColKey(int index,
                      java.lang.Object colKey)
Sets the ColKey value by index.

Parameters:
index - int The index.
colKey - Object New ColKey value (null permitted).

deleteColKey

public java.lang.Object deleteColKey(int index)
Delete ColKey by index.

Parameters:
index - int The index.
Returns:
Object The deleted ColKey object.

deleteColKey

public boolean deleteColKey(java.lang.Object colKey)
Delete this ColKey.

Parameters:
colKey - Object The ColKey (null permitted).
Returns:
boolean Returns true if this list contained the specified element.

getColKey

public java.lang.Object getColKey(int index)
Get ColKey by index.

Specified by:
getColKey in interface IMatrixDataset
Parameters:
index - int The index.
Returns:
Object The ColKey for the index(maybe null).

addRowData

public void addRowData()
Add one row to data list.


addRowData

public void addRowData(int count)
Add multiple rows to data list.

Parameters:
count - int .

deleteRow

public void deleteRow(int rowIndex)
Delete the datas of a dataset row.

Parameters:
rowIndex - int The row index.

addData

public void addData(int rowIndex,
                    IChartData chartData)
Add a IChartData to dataset.

Parameters:
rowIndex - int The row index.
chartData - IChartData The IChartData object (null permitted).

addDatas

public void addDatas(int rowIndex,
                     java.util.Collection chartDatas)
Add IChartData datas to dataset.

Parameters:
rowIndex - int The row index.
chartDatas - Collection The IChartData object (null permitted).

addDatas

public void addDatas(int rowIndex,
                     IChartData[] chartDatas)
Add IChartData datas to dataset.

Parameters:
rowIndex - int The row index.
chartDatas - IChartData The IChartData object (null permitted).

setData

public void setData(int rowIndex,
                    int colIndex,
                    IChartData chartData)
Change the dataset value by row index and column index.

Parameters:
rowIndex - int The row index.
colIndex - int The column index.
chartData - IChartData The IChartData object (null permitted).

getRowCount

public int getRowCount()
Returns the row count of this dataset.

Specified by:
getRowCount in interface IMatrixDataset
Returns:
int The row count of this dataset,no data return 0.

getColumnCount

public int getColumnCount()
The column count of this dataset.

Specified by:
getColumnCount in interface IMatrixDataset
Returns:
int The column count.

getColumnCount

public int getColumnCount(int rowIdx)
The column count of this dataset.

Specified by:
getColumnCount in interface IMatrixDataset
Parameters:
rowIdx - int The row index.
Returns:
int The column count.

getData

public IChartData getData(int rowIndex,
                          int colIndex)
Get the data of matrix by rowIndex and colIndex,an Exception will be throw when index out of bound.

Specified by:
getData in interface IMatrixDataset
Parameters:
rowIndex - int The row index.The first is at index 0,the next is at 1, and so on.
colIndex - int The column index.The first is at index 0,the next is at 1, and so on.
Returns:
IChartData The data of matrix (maybe null).

getRowDatas

public java.util.List getRowDatas(int rowIndex)
Returns all datas of the specified row index.

Parameters:
rowIndex - int The row index.The first is at index 0,the next is at 1, and so on.
Returns:
List The datas and unmodifiable.

getDatasetRowKeys

public java.util.List getDatasetRowKeys()
Returns the rowKeys of this dataset,if a row line data is not rowKey, is null.

Returns:
List A list (never null).

isThisDataType

public boolean isThisDataType(java.lang.Class c)
Test whether or not all data is Class c in this dataset.

Specified by:
isThisDataType in interface IDataset
Parameters:
c - Class A class (null not permitted).
Returns:
boolean Returns true if all data equals Class c in this dataset,false otherwise.

isEmpty

public boolean isEmpty()
Returns whether or not the dataset is empty.

Specified by:
isEmpty in interface IMatrixDataset
Returns:
boolean Returns true if the axis dataset is empty,otherwise false.

sortRowData

public void sortRowData(int rowIndex,
                        SortType sortType)
Sort the datas of a dataset row,the data must implements Comparable interface.

Specified by:
sortRowData in interface IMatrixDataset
Parameters:
rowIndex - int The row index.The first is at index 0,the next is at 1, and so on.
sortType - SortType The sort type,ascending or descending.

getDatasetColKeys

protected java.util.List getDatasetColKeys()
Returns the colKeys of this dataset,if a column line data is not colKey, is null.

Returns:
List A list (never null).

hashCode

public int hashCode()
Get hascode.

Overrides:
hashCode in class AbstractDataset
Returns:
int

equals

public boolean equals(java.lang.Object obj)
Override equals method.

Overrides:
equals in class AbstractDataset
Parameters:
obj - Object
Returns:
boolean