anl.aida.data
Class AbstractDataFrame

java.lang.Object
  extended by anl.aida.data.AbstractDataFrame
All Implemented Interfaces:
DataFrame
Direct Known Subclasses:
DataFrameBuilder.BuilderDataFrame

public abstract class AbstractDataFrame
extends java.lang.Object
implements DataFrame

Abstract implementation of DataFrame.

Version:
$Revision$ $Date$

Field Summary
protected  ucar.ma2.Array array
           
protected  Axes<DataFrameAxis> axes
           
protected  java.util.List<Dataset> datasets
           
protected  double max
           
protected  double min
           
protected  Variable variable
           
 
Constructor Summary
AbstractDataFrame()
           
 
Method Summary
private  int[] createExtents(Slice slice)
           
private  int[] createOrigins(Slice slice)
           
private  void fillExtents(int[] extents, Range range, DataFrameAxis axis)
           
private  void fillOrigin(int[] origins, Range range, DataFrameAxis axis)
           
 ucar.ma2.Array getArray()
          Gets the Array that contains the data.
 java.lang.Class<?> getArrayType()
          Gets the element type contained by the data array.
 Axes<DataFrameAxis> getAxes()
          Gets metadata describing this data frame's axes.
 java.util.List<Dataset> getDataset()
          Gets the dataset that produced this DataFrame.
 double getDouble(DataFrameIndex index)
          Gets the item at the specified indices as a double.
 float getFloat(DataFrameIndex index)
          Gets the item at the specified indices as a float.
 DataFrameIndex getIndex()
          Gets a DataFrameIndex used to retrieve data from this DataFrame.
 int getInt(DataFrameIndex index)
          Gets the item at the specified indices as an int.
 long getLong(DataFrameIndex index)
          Gets the item at the specified indices as a long.
 int[] getShape()
          Gets the shape - the array dimensionality - of this DataFrame.
 long getSize()
          Gets the total number of items in the data array.
 Variable getVariable()
          Gets the variable associated with this DataFrame.
 DataFrame slice(Slice slice)
          Creates a new DataFrame that is a slice or subsection of this one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

array

protected ucar.ma2.Array array

axes

protected Axes<DataFrameAxis> axes

datasets

protected java.util.List<Dataset> datasets

variable

protected Variable variable

min

protected double min

max

protected double max
Constructor Detail

AbstractDataFrame

public AbstractDataFrame()
Method Detail

getArray

public ucar.ma2.Array getArray()
Gets the Array that contains the data.

Specified by:
getArray in interface DataFrame
Returns:
the Array that contains the result data.

getAxes

public Axes<DataFrameAxis> getAxes()
Gets metadata describing this data frame's axes.

Specified by:
getAxes in interface DataFrame
Returns:
metadata describing this data frame's axes.

getDataset

public java.util.List<Dataset> getDataset()
Gets the dataset that produced this DataFrame.

Specified by:
getDataset in interface DataFrame
Returns:
the dataset that produced this DataFrame.

getIndex

public DataFrameIndex getIndex()
Gets a DataFrameIndex used to retrieve data from this DataFrame.

Specified by:
getIndex in interface DataFrame
Returns:
a DataFrameIndex used to retrieve data from this DataFrame.

getVariable

public Variable getVariable()
Gets the variable associated with this DataFrame.

Specified by:
getVariable in interface DataFrame
Returns:
the variable associated with this DataFrame.

getArrayType

public java.lang.Class<?> getArrayType()
Gets the element type contained by the data array.

Specified by:
getArrayType in interface DataFrame
Returns:
the element type contained by the data array.

getDouble

public double getDouble(DataFrameIndex index)
Gets the item at the specified indices as a double. The appropriate order of the indices can be gotten via the Axes information

Specified by:
getDouble in interface DataFrame
Parameters:
index - the index of the data to retrieve.
Returns:
the item at the specified indices as a double.

getFloat

public float getFloat(DataFrameIndex index)
Gets the item at the specified indices as a float. The appropriate order of the indices can be gotten via the Axes information

Specified by:
getFloat in interface DataFrame
Parameters:
index - the index of the data to retrieve.
Returns:
the item at the specified indices as a float.

getInt

public int getInt(DataFrameIndex index)
Gets the item at the specified indices as an int. The appropriate order of the indices can be gotten via the Axes information

Specified by:
getInt in interface DataFrame
Parameters:
index - the index of the data to retrieve.
Returns:
the item at the specified indices as an int.

getLong

public long getLong(DataFrameIndex index)
Gets the item at the specified indices as a long. The appropriate order of the indices can be gotten via the Axes information

Specified by:
getLong in interface DataFrame
Parameters:
index - the index of the data to retrieve.
Returns:
the item at the specified indices as a long.

getSize

public long getSize()
Gets the total number of items in the data array.

Specified by:
getSize in interface DataFrame
Returns:
the total number of items in the data array.

getShape

public int[] getShape()
Gets the shape - the array dimensionality - of this DataFrame.

Specified by:
getShape in interface DataFrame
Returns:
the shape - the array dimensionality - of this DataFrame.

slice

public DataFrame slice(Slice slice)
                throws ucar.ma2.InvalidRangeException
Creates a new DataFrame that is a slice or subsection of this one. The two DataFrames will share data, so any change to one will be reflected in the other. The slice ranges should be in terms of the array indices of the data frame which are NOT necessarily the axes origins and extents.

Specified by:
slice in interface DataFrame
Parameters:
slice - describes the slice of data contained by the new DataFrame.
Returns:
a new DataFrame that is a slice or subsection of this one
Throws:
ucar.ma2.InvalidRangeException - if the slice is not within the range of this DataFrame's dimensions.

createExtents

private int[] createExtents(Slice slice)

fillExtents

private void fillExtents(int[] extents,
                         Range range,
                         DataFrameAxis axis)

fillOrigin

private void fillOrigin(int[] origins,
                        Range range,
                        DataFrameAxis axis)

createOrigins

private int[] createOrigins(Slice slice)