com.ijchart.xychart.dataset
Class SlidingDataset

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

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

Title: IJChart

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

A dataset implementation that presents a subset of the underlying dataset.

Copyright: Copyright (c) 2013

Company:

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

Constructor Summary
SlidingDataset(IMatrixDataset dataset, DatasetSlidingType slidingType, int startIndex, int maxCount)
           A constructor.
 
Method Summary
 boolean equals(java.lang.Object obj)
           Override equals method.
 java.lang.Object getColKey(int index)
           Get ColKey by index.The first ColKey of the dataset is at index 0,the next at index 1, and so on, as for array indexing.
 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.
 int getMaxCount()
           Returns the max data row or column count.
 int getRowCount()
           The row count of this dataset.
 java.lang.Object getRowKey(int index)
           Get RowKey by index.The first RowKey of the dataset is at index 0,the next at index 1, and so on, as for array indexing.
 DatasetSlidingType getSlidingType()
           Returns the sliding type of dataset.
 int getStartIndex()
           Returns the start index.
 IMatrixDataset getUnderlyingDataset()
           Returns the underlying dataset.
 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 setMaxCount(int maxCount)
           Sets the max data row or column count and sends a DatasetChangeEvent to all registered listeners.
 void setSlidingType(DatasetSlidingType slidingType)
           Sets the sliding type of dataset and sends a DatasetChangeEvent to all registered listeners.
 void setStartIndex(int startIndex)
           Sets the start index and sends a DatasetChangeEvent to all registered listeners.
 void sortRowData(int rowIndex, SortType sortType)
           Sort the datas of a dataset row,the data must implements Comparable interface.
 java.lang.String toString()
           Returns a string representation of the object.
 
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, wait, wait, wait
 
Methods inherited from interface com.ijchart.xychart.dataset.IDataset
addChangeListener, forceDataSetChanged, removeAllChangeListener, removeChangeListener
 

Constructor Detail

SlidingDataset

public SlidingDataset(IMatrixDataset dataset,
                      DatasetSlidingType slidingType,
                      int startIndex,
                      int maxCount)
A constructor.

Parameters:
dataset - IMatrixDataset The underlying dataset (null not permitted).
slidingType - DatasetSlidingType The sliding type of dataset (null not permitted).
startIndex - int The start index.
maxCount - int The max data row or column count.
Method Detail

getUnderlyingDataset

public IMatrixDataset getUnderlyingDataset()
Returns the underlying dataset.

Returns:
IMatrixDataset The underlying dataset (never null).

getSlidingType

public DatasetSlidingType getSlidingType()
Returns the sliding type of dataset.

Returns:
DatasetSlidingType The sliding type (never null).

setSlidingType

public void setSlidingType(DatasetSlidingType slidingType)
Sets the sliding type of dataset and sends a DatasetChangeEvent to all registered listeners.

Parameters:
slidingType - DatasetSlidingType The sliding type.

getStartIndex

public int getStartIndex()
Returns the start index.

Returns:
int The start index.

setStartIndex

public void setStartIndex(int startIndex)
Sets the start index and sends a DatasetChangeEvent to all registered listeners.

Parameters:
startIndex - int The start index.

getMaxCount

public int getMaxCount()
Returns the max data row or column count.

Returns:
int The max data row or column count.

setMaxCount

public void setMaxCount(int maxCount)
Sets the max data row or column count and sends a DatasetChangeEvent to all registered listeners.

Parameters:
maxCount - int The max data row or column count.

getRowCount

public int getRowCount()
The row count of this dataset.

Specified by:
getRowCount in interface IMatrixDataset
Returns:
int The row count.

getRowKey

public java.lang.Object getRowKey(int index)
Get RowKey by index.The first RowKey of the dataset is at index 0,the next at index 1, and so on, as for array indexing.

Specified by:
getRowKey in interface IMatrixDataset
Parameters:
index - int The row index,first is 0,next is 1.
Returns:
Object The dataset RowKey for this index,if not found return null.

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.

getColKey

public java.lang.Object getColKey(int index)
Get ColKey by index.The first ColKey of the dataset is at index 0,the next at index 1, and so on, as for array indexing.

Specified by:
getColKey in interface IMatrixDataset
Parameters:
index - int The index,first is 0,next is 1.
Returns:
Object The dataset ColKey for this index,if not found return null.

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).

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.

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.

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.

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.

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