de.erichseifert.gral.data.filters
Class Filter2D
- java.lang.Object
-
- de.erichseifert.gral.data.AbstractDataSource
-
- de.erichseifert.gral.data.filters.Filter2D
-
- All Implemented Interfaces:
- DataListener, DataSource, java.io.Serializable, java.lang.Iterable<java.lang.Comparable<?>>
- Direct Known Subclasses:
- Convolution, Median, Resize
public abstract class Filter2D extends AbstractDataSource implements DataListener
Abstract class that provides basic functions for filtering arbitrary columns of a DataSource, in other words a set of one-dimensional data.
Functionality includes:
- Different modes for filtering (see
Filter2D.Mode) - Support for listening for changes of the original data
- Filtering of multiple columns
Values of filtered columns are buffered. Access to unfiltered columns is delegated to the original data source. Derived classes must make sure the caches are updated when deserialization is done. This can be done by calling
dataUpdated(this)in a custom deserialization method.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classFilter2D.ModeType to define the behavior when engaging the borders of a column, i.e.
-
Constructor Summary
Constructors Constructor and Description Filter2D(DataSource original, Filter2D.Mode mode, int... cols)Initializes a new instance with the specified data source, border handling and columns to be filtered.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddataAdded(DataSource source, DataChangeEvent... events)Method that is invoked when data has been added.voiddataRemoved(DataSource source, DataChangeEvent... events)Method that is invoked when data has been removed.voiddataUpdated(DataSource source, DataChangeEvent... events)Method that is invoked when data has been updated.java.lang.Comparable<?>get(int col, int row)Returns the row with the specified index.intgetColumnCount()Returns the number of columns of the data source.Filter2D.ModegetMode()Returns the Mode of this Filter2D.intgetRowCount()Returns the number of rows of the data source.voidsetMode(Filter2D.Mode mode)Sets the Mode the specified value.-
Methods inherited from class de.erichseifert.gral.data.AbstractDataSource
addDataListener, getColumn, getColumnStatistics, getColumnTypes, getName, getRecord, getRow, getRowStatistics, getStatistics, isColumnNumeric, iterator, removeDataListener
-
-
-
-
Constructor Detail
-
Filter2D
public Filter2D(DataSource original, Filter2D.Mode mode, int... cols)
Initializes a new instance with the specified data source, border handling and columns to be filtered. The columns must be numeric, otherwise anIllegalArgumentExceptionis thrown.- Parameters:
original- Data source to be filtered.mode- Border handling mode to be used.cols- Indexes of numeric columns to be filtered.
-
-
Method Detail
-
get
public java.lang.Comparable<?> get(int col, int row)Returns the row with the specified index.- Specified by:
getin interfaceDataSource- Parameters:
col- index of the column to returnrow- index of the row to return- Returns:
- the specified value of the data cell
-
getColumnCount
public int getColumnCount()
Description copied from class:AbstractDataSourceReturns the number of columns of the data source.- Specified by:
getColumnCountin interfaceDataSource- Overrides:
getColumnCountin classAbstractDataSource- Returns:
- number of columns in the data source.
-
getRowCount
public int getRowCount()
Returns the number of rows of the data source.- Specified by:
getRowCountin interfaceDataSource- Returns:
- number of rows in the data source.
-
dataAdded
public void dataAdded(DataSource source, DataChangeEvent... events)
Method that is invoked when data has been added. This method is invoked by objects that provide support forDataListeners and should not be called manually.- Specified by:
dataAddedin interfaceDataListener- Parameters:
source- Data source that has been changed.events- Optional event object describing the data values that have been added.
-
dataUpdated
public void dataUpdated(DataSource source, DataChangeEvent... events)
Method that is invoked when data has been updated. This method is invoked by objects that provide support forDataListeners and should not be called manually.- Specified by:
dataUpdatedin interfaceDataListener- Parameters:
source- Data source that has been changedevents- Optional event object describing the data values that have been updated.
-
dataRemoved
public void dataRemoved(DataSource source, DataChangeEvent... events)
Method that is invoked when data has been removed. This method is invoked by objects that provide support forDataListeners and should not be called manually.- Specified by:
dataRemovedin interfaceDataListener- Parameters:
source- Data source that has been changedevents- Optional event object describing the data values that have been removed.
-
getMode
public Filter2D.Mode getMode()
Returns the Mode of this Filter2D.- Returns:
- Mode of filtering.
-
setMode
public void setMode(Filter2D.Mode mode)
Sets the Mode the specified value.- Parameters:
mode- Mode of filtering.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG