fern.tools.gnuplot
Class TransposedArrayMatrixAxes

java.lang.Object
  extended by fern.tools.gnuplot.Axes
      extended by fern.tools.gnuplot.ArrayMatrixAxes
          extended by fern.tools.gnuplot.TransposedArrayMatrixAxes
All Implemented Interfaces:
Iterable<String>

public class TransposedArrayMatrixAxes
extends ArrayMatrixAxes

Implementation of Axes to use with transposed array matrixes of any number type (the type of the arrays is inferred by using the reflection api). An array matrix is just a two dimensional rectangular array (new double[20][3]). The first index of the transposed matrix gives the column, the second the row (3 rows and 20 columns).

If your array matrix is not transposed (your first index denotes the row, the second one the column), just use ArrayMatrixAxes.

Author:
Florian Erhard
See Also:
Axes

Field Summary
 
Fields inherited from class fern.tools.gnuplot.Axes
Additional, ThreeD, TwoD
 
Constructor Summary
TransposedArrayMatrixAxes(Object matrix)
          Create a new Axes object containing the given array matrix without labels / styles.
TransposedArrayMatrixAxes(Object matrix, String[] labels, String[] styles)
          Create a new Axes object containing the given array matrix with the given labels /styles (either can be null).
 
Method Summary
 Number getNumber(int row, int col)
          Gets the entry of this axes at the specified position.
 int getNumColumns()
          Gets the number of columns.
 int getNumRows()
          Gets the number of rows.
 Iterator<String> iterator()
          Yields the tab separated columns row by row.
 
Methods inherited from class fern.tools.gnuplot.Axes
addAxes, applyDefaultStyle, getDimensionType, getLabel, getStyle, getX, setLabel, setStyle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransposedArrayMatrixAxes

public TransposedArrayMatrixAxes(Object matrix)
Create a new Axes object containing the given array matrix without labels / styles. If the passed object is not a valid array matrix, an IllegalArgumentException will be thrown.

Parameters:
matrix - array matrix

TransposedArrayMatrixAxes

public TransposedArrayMatrixAxes(Object matrix,
                                 String[] labels,
                                 String[] styles)
Create a new Axes object containing the given array matrix with the given labels /styles (either can be null). If the passed object is not a valid array matrix, an IllegalArgumentException will be thrown.

Parameters:
matrix - the array matrix
labels - the labels
styles - the styles
Method Detail

getNumber

public Number getNumber(int row,
                        int col)
Description copied from class: Axes
Gets the entry of this axes at the specified position.

Overrides:
getNumber in class Axes
Parameters:
row - the row of the entry
col - the col of the entry
Returns:
the entry

getNumRows

public int getNumRows()
Description copied from class: Axes
Gets the number of rows.

Overrides:
getNumRows in class ArrayMatrixAxes
Returns:
number of rows.

getNumColumns

public int getNumColumns()
Description copied from class: Axes
Gets the number of columns. The number of the attached Axes object is also included.

Overrides:
getNumColumns in class ArrayMatrixAxes
Returns:
number of columns.

iterator

public Iterator<String> iterator()
Yields the tab separated columns row by row.

Specified by:
iterator in interface Iterable<String>
Overrides:
iterator in class ArrayMatrixAxes