de.erichseifert.gral.data.filters
Class Resize

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

public class Resize
extends Filter

Filter to change the size of equally spaced data sources. The values of the scaled result are created using averaging.


Nested Class Summary
 
Nested classes/interfaces inherited from class de.erichseifert.gral.data.filters.Filter
Filter.Mode
 
Constructor Summary
Resize(DataSource data, int cols, int rows)
          Initializes a new data source from an original data source and a specified number of rows and columns.
 
Method Summary
 Number get(int col, int row)
          Returns the row with the specified index.
 int getColumnCount()
          Returns the number of columns of the data source.
 int getRowCount()
          Returns the number of rows of the data source.
 
Methods inherited from class de.erichseifert.gral.data.filters.Filter
dataChanged, getMode, setMode
 
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

Resize

public Resize(DataSource data,
              int cols,
              int rows)
Initializes a new data source from an original data source and a specified number of rows and columns.

Parameters:
data - Original data source.
cols - Number of columns for new data source.
rows - Number of rows for new data source.
Method Detail

getColumnCount

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

Specified by:
getColumnCount in interface DataSource
Overrides:
getColumnCount in class Filter
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
Overrides:
getRowCount in class Filter
Returns:
number of rows in the data source.

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
Overrides:
get in class Filter
Parameters:
col - index of the column to return
row - index of the row to return
Returns:
the specified value of the data cell


Copyright © 2009-2010. All Rights Reserved.