Package com.macrofocus.molap.dataframe
Class IndexedDataFrame<R,V>
- java.lang.Object
-
- com.macrofocus.molap.dataframe.AbstractDataFrame<R,java.lang.Object,V>
-
- com.macrofocus.molap.dataframe.IndexedDataFrame<R,V>
-
- Type Parameters:
R
- the type of row keysV
- the type of column keys
- All Implemented Interfaces:
DataFrame<R,java.lang.Object,V>
public class IndexedDataFrame<R,V> extends AbstractDataFrame<R,java.lang.Object,V>
An indexed data frame.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
IndexedDataFrame.ColumnSeries
class
IndexedDataFrame.ColumnSeries2<K>
-
Constructor Summary
Constructors Constructor Description IndexedDataFrame(UniqueIndex<R> rowIndex, UniqueIndex columnIndex, Series<R,V>[] series)
IndexedDataFrame(Series<R,V>... series)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Iterable<java.lang.Object>
columns()
Returns the column keys.Series<R,V>
getColumn(java.lang.Object column)
Returns a series of all the values of a given column.int
getColumnAddress(java.lang.Object column)
Returns the absolute index for the specified column key.java.lang.Class
getColumnClass(java.lang.Object column)
Returns the most specific superclass for all cell values in a columnint
getColumnCount()
Returns the number of columns contained by this data frame.UniqueIndex<java.lang.Object>
getColumnIndex()
Gets the index used to access the columns.java.lang.Object
getColumnKey(int index)
Returns the column key at the specified absolute index.Series<java.lang.Object,?>
getRow(java.lang.Object row)
Returns a series of all the values of a given row.int
getRowAddress(R row)
Returns the absolute index for the specified row key.java.lang.Class
getRowClass(R row)
Returns the most specific superclass for all cell values in a row.int
getRowCount()
Returns the number of rows contained by the this data frame.UniqueIndex<R>
getRowIndex()
Gets the index used to access the rows.R
getRowKey(int index)
Returns the row key at the specified absolute index.V
getValueAt(R row, java.lang.Object column)
Returns the value for the cell at the intersection of thecolumn
key androw
key.DataFrame
join(Series series, java.lang.Object[] columns)
DataFrame<MultiKey,java.lang.Object,V>
reindexRows(java.lang.Object... rows)
Returns a new data frame reindexed using the values coming from the specified rows.java.lang.Iterable<R>
rows()
Returns the row keys.-
Methods inherited from class com.macrofocus.molap.dataframe.AbstractDataFrame
addDataFrameListener, addWeakDataFrameListener, aggregate, aggregate, append, appendAndReindex, benchmark, filter, getCentroid, getColumnName, getConstant, getCount, getCountDistinct, getCountDistinctWithNull, getCube, getDataFrameAggregation, getDistributiveStatistics, getFirst, getFirstQuartile, getMax, getMean, getMedian, getMin, getRandom, getStatistics, getStdDev, getSum, getThirdQuartile, getUnivariateStatistics, getVariance, getVarianceByPopulation, getWeightedMean, getWeightedSum, notifyDataFrameChanged, orderRows, print, print, printSchema, reindexColumns, reindexRows, reindexRows, reindexRows, reindexRows, remapColumns, removeColumns, removeDataFrameListener, removeDataFrameListeners, removeDuplicates
-
-
-
-
Constructor Detail
-
IndexedDataFrame
public IndexedDataFrame(UniqueIndex<R> rowIndex, UniqueIndex columnIndex, Series<R,V>[] series)
-
-
Method Detail
-
getColumnIndex
public UniqueIndex<java.lang.Object> getColumnIndex()
Description copied from interface:DataFrame
Gets the index used to access the columns.- Returns:
- the column index
-
getRowIndex
public UniqueIndex<R> getRowIndex()
Description copied from interface:DataFrame
Gets the index used to access the rows.- Returns:
- the row index
-
getRowClass
public java.lang.Class getRowClass(R row)
Description copied from interface:DataFrame
Returns the most specific superclass for all cell values in a row.- Parameters:
row
- the key of the row- Returns:
- the common ancestor class of the object values in the row.
-
getColumnClass
public java.lang.Class getColumnClass(java.lang.Object column)
Description copied from interface:DataFrame
Returns the most specific superclass for all cell values in a column- Parameters:
column
- the key of the column- Returns:
- the common ancestor class of the object values in the column.
-
getRow
public Series<java.lang.Object,?> getRow(java.lang.Object row)
Description copied from interface:DataFrame
Returns a series of all the values of a given row.- Parameters:
row
- the row key- Returns:
- a Series object
-
getColumn
public Series<R,V> getColumn(java.lang.Object column)
Description copied from interface:DataFrame
Returns a series of all the values of a given column.
-
getValueAt
public V getValueAt(R row, java.lang.Object column)
Description copied from interface:DataFrame
Returns the value for the cell at the intersection of thecolumn
key androw
key.- Parameters:
row
- the row key whose value is to be queriedcolumn
- the column key whose value is to be queried- Returns:
- the value Object at the specified cell
-
rows
public java.lang.Iterable<R> rows()
Description copied from interface:DataFrame
Returns the row keys.
-
columns
public java.lang.Iterable<java.lang.Object> columns()
Description copied from interface:DataFrame
Returns the column keys.
-
getRowKey
public R getRowKey(int index)
Description copied from interface:DataFrame
Returns the row key at the specified absolute index. This is the inverse ofDataFrame.getRowAddress(Object)
.
-
getColumnKey
public java.lang.Object getColumnKey(int index)
Description copied from interface:DataFrame
Returns the column key at the specified absolute index. This is the inverse ofDataFrame.getColumnAddress(Object)
.- Specified by:
getColumnKey
in interfaceDataFrame<R,java.lang.Object,V>
- Overrides:
getColumnKey
in classAbstractDataFrame<R,java.lang.Object,V>
- Parameters:
index
- the index- Returns:
- the column key
-
getRowAddress
public int getRowAddress(R row)
Description copied from interface:DataFrame
Returns the absolute index for the specified row key. This is the inverse ofDataFrame.getRowKey(int)
.- Specified by:
getRowAddress
in interfaceDataFrame<R,java.lang.Object,V>
- Overrides:
getRowAddress
in classAbstractDataFrame<R,java.lang.Object,V>
- Parameters:
row
- the row key- Returns:
- the absolute index of the specified key.
-
getColumnAddress
public int getColumnAddress(java.lang.Object column)
Description copied from interface:DataFrame
Returns the absolute index for the specified column key. This is the inverse ofDataFrame.getColumnKey(int)
.- Specified by:
getColumnAddress
in interfaceDataFrame<R,java.lang.Object,V>
- Overrides:
getColumnAddress
in classAbstractDataFrame<R,java.lang.Object,V>
- Parameters:
column
- the column key- Returns:
- the absolute index of the specified key.
-
getRowCount
public int getRowCount()
Description copied from interface:DataFrame
Returns the number of rows contained by the this data frame.- Specified by:
getRowCount
in interfaceDataFrame<R,java.lang.Object,V>
- Overrides:
getRowCount
in classAbstractDataFrame<R,java.lang.Object,V>
- Returns:
- the number of rows.
-
getColumnCount
public int getColumnCount()
Description copied from interface:DataFrame
Returns the number of columns contained by this data frame.- Specified by:
getColumnCount
in interfaceDataFrame<R,java.lang.Object,V>
- Overrides:
getColumnCount
in classAbstractDataFrame<R,java.lang.Object,V>
- Returns:
- the number of columns.
-
reindexRows
public DataFrame<MultiKey,java.lang.Object,V> reindexRows(java.lang.Object... rows)
Description copied from interface:DataFrame
Returns a new data frame reindexed using the values coming from the specified rows.- Specified by:
reindexRows
in interfaceDataFrame<R,java.lang.Object,V>
- Overrides:
reindexRows
in classAbstractDataFrame<R,java.lang.Object,V>
- Parameters:
rows
- the columns to use for the label values- Returns:
- the reindexed data frame.
-
-