de.erichseifert.gral.data.filters
Class Filter

java.lang.Object
  extended by de.erichseifert.gral.data.AbstractDataSource
      extended by de.erichseifert.gral.data.filters.Filter
All Implemented Interfaces:
DataListener, DataSource, Iterable<Number>
Direct Known Subclasses:
Convolution, Median, Resize

public abstract class Filter
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:

Only filtered columns are stored. Access to unfiltered columns is delegated to the original data source.


Nested Class Summary
static class Filter.Mode
          Behavior when engaging the borders of a column, so that the filter would need more data values than available.
 
Constructor Summary
Filter(DataSource original, Filter.Mode mode, int... cols)
          Creates a new Filter object with the specified DataSource, Mode and columns to filter.
 
Method Summary
 void dataChanged(DataSource data)
          Method that is invoked by objects that provide support for DataListeners.
 Number get(int col, int row)
          Returns the row with the specified index.
 int getColumnCount()
          Returns the number of columns of the data source.
 Filter.Mode getMode()
          Returns the Mode of this Filter.
 int getRowCount()
          Returns the number of rows of the data source.
 void setMode(Filter.Mode mode)
          Sets the Mode the specified value.
 
Methods inherited from class de.erichseifert.gral.data.AbstractDataSource
addDataListener, getColumn, getRow, getStatistics, iterator, removeDataListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Filter

public Filter(DataSource original,
              Filter.Mode mode,
              int... cols)
Creates a new Filter object with the specified DataSource, Mode and columns to filter.

Parameters:
original - DataSource to be filtered.
mode - Mode to be used.
cols - Column indexes to be filtered.
Method Detail

get

public Number get(int col,
                  int row)
Description copied from interface: DataSource
Returns the row with the specified index.

Specified by:
get in interface DataSource
Parameters:
col - index of the column to return
row - index of the row to return
Returns:
the specified value of the data cell

getColumnCount

public int getColumnCount()
Description copied from interface: DataSource
Returns the number of columns of the data source.

Specified by:
getColumnCount in interface DataSource
Returns:
number of columns in the data source.

getRowCount

public int getRowCount()
Description copied from interface: DataSource
Returns the number of rows of the data source.

Specified by:
getRowCount in interface DataSource
Returns:
number of rows in the data source.

dataChanged

public void dataChanged(DataSource data)
Description copied from interface: DataListener
Method that is invoked by objects that provide support for DataListeners.

Specified by:
dataChanged in interface DataListener
Parameters:
data - data that has changed

getMode

public Filter.Mode getMode()
Returns the Mode of this Filter.

Returns:
Mode of filtering.

setMode

public void setMode(Filter.Mode mode)
Sets the Mode the specified value.

Parameters:
mode - Mode of filtering.


Copyright © 2009-2010. All Rights Reserved.