Package com.macrofocus.molap.dataframe
Class AbstractDataFrame<Row,Column,V>
- java.lang.Object
-
- com.macrofocus.molap.dataframe.AbstractDataFrame<Row,Column,V>
-
- All Implemented Interfaces:
DataFrame<Row,Column,V>
- Direct Known Subclasses:
AbstractMatrix
,AbstractMutableDataFrame
,AggregatedNodesDataFrame
,AppendAndReindexDataFrame
,AppendDataFrame
,ArcGISJsonDataFrame
,CachedDataFrame
,ColumnModelDataFrame
,CombinedDataFrame
,CovarianceDataFrame
,DefaultDataFrame
,DelegatedDataFrame
,EmptyDataFrame
,FilterDataFrame
,IndexedDataFrame
,JsonDataFrame
,LinksDataFrame
,MinMaxDataFrame
,NodesDataFrame
,QueryDataFrame
,ResultSetDataFrame
,ScaledDataFrame
,SelectionDataFrame
public abstract class AbstractDataFrame<Row,Column,V> extends java.lang.Object implements DataFrame<Row,Column,V>
This class provides a skeletal implementation of the DataFrame interface to minimize the effort required to implement this interface.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
AbstractDataFrame.ColumnSeries
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractDataFrame()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDataFrameListener(DataFrameListener<Row,Column> listener)
Add a listener to the list that's notified each time a change to the data frame occurs.void
addWeakDataFrameListener(DataFrameListener<Row,Column> listener)
Add a listener to the list that's notified each time a change to the data frame occurs.AggregateDataFrame<Column>
aggregate(boolean includeIndex, Aggregation... aggregations)
AggregateDataFrame<Column>
aggregate(Aggregation... aggregations)
Returns a new data frame suitable for data aggregation.DataFrame<Row,Column,V>
append(DataFrame<Row,Column,V> dataFrame)
Returns a new data frame with the rows of the specified data frame appended to the end of the this data frame.DataFrame<java.lang.Integer,Column,V>
appendAndReindex(DataFrame<Row,Column,V> dataFrame)
Returns a new data frame with the rows of the specified data frame appended to the end of the this data frame.void
benchmark()
Perform some repetitive operation to estimate the performance of the data frame.java.lang.Iterable<Column>
columns()
Returns the column keys.FilterDataFrame
filter(com.macrofocus.filter.MutableFilter<Row> filter)
Returns a new data frame those rows are filtered by the specified filter model.CentroidAggregation
getCentroid(Column column)
Returns the aggregation method for finding the centroid of geometries.Series<Row,V>
getColumn(Column column)
Returns a series of all the values of a given column.int
getColumnAddress(Column column)
Returns the absolute index for the specified column key.int
getColumnCount()
Returns the number of columns contained by this data frame.Column
getColumnKey(int index)
Returns the column key at the specified absolute index.java.lang.String
getColumnName(Column column)
Returns the name of the column.ConstantAggregation
getConstant(java.lang.Object value)
Returns the aggregation method that returns a constant value.CountAggregation
getCount(Column column)
Returns the aggregation method for counting the number of values.CountDistinctAggregation
getCountDistinct(Column column)
Returns the aggregation method for counting the number of distinct values.CountDistinctWithNullAggregation
getCountDistinctWithNull(Column column)
Returns the aggregation method for counting the number of distinct values, including null value if present.protected Cube
getCube()
DataFrameAggregation
getDataFrameAggregation()
Returns data frame for aggregation.DistributiveStatisticsAggregation
getDistributiveStatistics(Column column)
Returns the aggregation method for computing the univariate statistics.FirstAggregation
getFirst(Column column)
Returns the aggregation method that returns a constant value.FirstQuartileAggregation
getFirstQuartile(Column column)
Returns the aggregation method for computing the median value.MaxAggregation
getMax(Column column)
Returns the aggregation method for finding the maximum value.MeanAggregation
getMean(Column column)
Returns the aggregation method for computing the mean value.MedianAggregation
getMedian(Column column)
Returns the aggregation method for computing the median value.MinAggregation
getMin(Column column)
Returns the aggregation method for finding the minimum value.RandomAggregation
getRandom(double min, double max)
Returns the aggregation method that returns a random value.int
getRowAddress(Row row)
Returns the absolute index for the specified row key.int
getRowCount()
Returns the number of rows contained by the this data frame.Row
getRowKey(int index)
Returns the row key at the specified absolute index.UnivariateStatistics
getStatistics(Column column)
StdDevAggregation
getStdDev(Column column)
Returns the aggregation method for computing the standard deviation.SumAggregation
getSum(Column column)
Returns the aggregation method for computing the sum.ThirdQuartileAggregation
getThirdQuartile(Column column)
Returns the aggregation method for computing the median value.UnivariateStatisticsAggregation
getUnivariateStatistics(Column column)
Returns the aggregation method for computing the univariate statistics.VarianceAggregation
getVariance(Column column)
Returns the aggregation method for computing the variance.VarianceAggregation
getVarianceByPopulation(Column column, Column population)
Returns the aggregation method for computing the variance by factoring in the specified population.Aggregation
getWeightedMean(Column weight, Column column)
Returns the aggregation method for computing the weigthed mean.Aggregation
getWeightedSum(Column weight, Column column)
Returns the aggregation method for computing the weighted sum.protected void
notifyDataFrameChanged(DataFrameEvent<Row,Column> event)
Fires an event event to listeners that have been registered to track changes to the data frame.DataFrame<Row,Column,V>
orderRows(SortKey<Column>... sortKeys)
Returns a new data frame reordered using the values coming from the specified columns.void
print()
Display the content of the data frame to the console.void
print(java.io.PrintStream out, java.lang.String caption, boolean html)
Display the content of the data frame to the specified output.void
printSchema()
Display the content of the data frame to the console.<Column> DataFrame<Row,Column,V>
reindexColumns(Column... columns)
Returns a new data frame with column reindexed using the specified values.DataFrame<java.lang.Integer,Column,V>
reindexRows()
Returns a new data frame reindexed using integers.MutableDataFrame<V,Column,V>
reindexRows(boolean keepColumn, Column column)
Returns a new data frame reindexed using the values coming from the specified column.DataFrame<MultiKey,Column,V>
reindexRows(boolean keepColumns, Column... columns)
Returns a new data frame reindexed using the values coming from the specified rows.MutableDataFrame<V,Column,V>
reindexRows(Column column)
Returns a new data frame reindexed using the values coming from the specified column.DataFrame<MultiKey,Column,V>
reindexRows(Column... columns)
Returns a new data frame reindexed using the values coming from the specified rows.DataFrame<Row,Column,V>
remapColumns(Column... columns)
DataFrame<Row,Column,V>
removeColumns(Column... columns)
void
removeDataFrameListener(DataFrameListener<Row,Column> listener)
Remove a listener to the list that's notified each time a change to the data frame occurs.void
removeDataFrameListeners()
Remove all listeners to the list that's notified each time a change to the data frame occurs.DataFrame<Row,Column,V>
removeDuplicates(Column... columns)
Returns a new data frame where duplicate entries for values of the specified column values.java.lang.Iterable<Row>
rows()
Returns the row keys.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.macrofocus.molap.dataframe.DataFrame
getColumnClass, getColumnIndex, getRow, getRowClass, getRowIndex, getValueAt, join
-
-
-
-
Method Detail
-
rows
public java.lang.Iterable<Row> rows()
Description copied from interface:DataFrame
Returns the row keys.
-
columns
public java.lang.Iterable<Column> columns()
Description copied from interface:DataFrame
Returns the column keys.
-
getRowKey
public Row 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 Column 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<Row,Column,V>
- Parameters:
index
- the index- Returns:
- the column key
-
getRowAddress
public int getRowAddress(Row 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<Row,Column,V>
- Parameters:
row
- the row key- Returns:
- the absolute index of the specified key.
-
getColumnAddress
public int getColumnAddress(Column 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<Row,Column,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<Row,Column,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<Row,Column,V>
- Returns:
- the number of columns.
-
getColumn
public Series<Row,V> getColumn(Column column)
Description copied from interface:DataFrame
Returns a series of all the values of a given column.
-
orderRows
public DataFrame<Row,Column,V> orderRows(SortKey<Column>... sortKeys)
Description copied from interface:DataFrame
Returns a new data frame reordered using the values coming from the specified columns.
-
reindexColumns
public <Column> DataFrame<Row,Column,V> reindexColumns(Column... columns)
Description copied from interface:DataFrame
Returns a new data frame with column reindexed using the specified values.- Specified by:
reindexColumns
in interfaceDataFrame<Row,Column,V>
- Parameters:
columns
- the values to use for the reindex columns- Returns:
- the reindexed data frame.
-
remapColumns
public DataFrame<Row,Column,V> remapColumns(Column... columns)
- Specified by:
remapColumns
in interfaceDataFrame<Row,Column,V>
-
removeColumns
public DataFrame<Row,Column,V> removeColumns(Column... columns)
- Specified by:
removeColumns
in interfaceDataFrame<Row,Column,V>
-
append
public DataFrame<Row,Column,V> append(DataFrame<Row,Column,V> dataFrame)
Description copied from interface:DataFrame
Returns a new data frame with the rows of the specified data frame appended to the end of the this data frame.
-
appendAndReindex
public DataFrame<java.lang.Integer,Column,V> appendAndReindex(DataFrame<Row,Column,V> dataFrame)
Description copied from interface:DataFrame
Returns a new data frame with the rows of the specified data frame appended to the end of the this data frame.- Specified by:
appendAndReindex
in interfaceDataFrame<Row,Column,V>
- Parameters:
dataFrame
- the data frame those rows are to be appended- Returns:
- a combined data frame.
-
filter
public FilterDataFrame filter(com.macrofocus.filter.MutableFilter<Row> filter)
Description copied from interface:DataFrame
Returns a new data frame those rows are filtered by the specified filter model.
-
removeDuplicates
public DataFrame<Row,Column,V> removeDuplicates(Column... columns)
Description copied from interface:DataFrame
Returns a new data frame where duplicate entries for values of the specified column values.- Specified by:
removeDuplicates
in interfaceDataFrame<Row,Column,V>
- Parameters:
columns
- the columns to use to check for duplicates- Returns:
- a new data frame
-
getStatistics
public UnivariateStatistics getStatistics(Column column)
- Specified by:
getStatistics
in interfaceDataFrame<Row,Column,V>
-
getCube
protected Cube getCube()
-
aggregate
public AggregateDataFrame<Column> aggregate(Aggregation... aggregations)
Description copied from interface:DataFrame
Returns a new data frame suitable for data aggregation. The additional methods provided to customize the aggregation criteria are provided by theAggregateDataFrame
.
-
aggregate
public AggregateDataFrame<Column> aggregate(boolean includeIndex, Aggregation... aggregations)
-
getDataFrameAggregation
public DataFrameAggregation getDataFrameAggregation()
Description copied from interface:DataFrame
Returns data frame for aggregation.- Specified by:
getDataFrameAggregation
in interfaceDataFrame<Row,Column,V>
- Returns:
- the aggregation data frame
-
getFirst
public FirstAggregation getFirst(Column column)
Description copied from interface:DataFrame
Returns the aggregation method that returns a constant value.
-
getConstant
public ConstantAggregation getConstant(java.lang.Object value)
Description copied from interface:DataFrame
Returns the aggregation method that returns a constant value.- Specified by:
getConstant
in interfaceDataFrame<Row,Column,V>
- Parameters:
value
- the constant value- Returns:
- the aggregation method
-
getRandom
public RandomAggregation getRandom(double min, double max)
Description copied from interface:DataFrame
Returns the aggregation method that returns a random value.
-
getSum
public SumAggregation getSum(Column column)
Description copied from interface:DataFrame
Returns the aggregation method for computing the sum.
-
getCount
public CountAggregation getCount(Column column)
Description copied from interface:DataFrame
Returns the aggregation method for counting the number of values.
-
getDistributiveStatistics
public DistributiveStatisticsAggregation getDistributiveStatistics(Column column)
Description copied from interface:DataFrame
Returns the aggregation method for computing the univariate statistics.- Specified by:
getDistributiveStatistics
in interfaceDataFrame<Row,Column,V>
- Parameters:
column
- the column key- Returns:
- the aggregation method
-
getMin
public MinAggregation getMin(Column column)
Description copied from interface:DataFrame
Returns the aggregation method for finding the minimum value.
-
getMax
public MaxAggregation getMax(Column column)
Description copied from interface:DataFrame
Returns the aggregation method for finding the maximum value.
-
getMean
public MeanAggregation getMean(Column column)
Description copied from interface:DataFrame
Returns the aggregation method for computing the mean value.
-
getVariance
public VarianceAggregation getVariance(Column column)
Description copied from interface:DataFrame
Returns the aggregation method for computing the variance.- Specified by:
getVariance
in interfaceDataFrame<Row,Column,V>
- Parameters:
column
- the column key- Returns:
- the aggregation method
-
getVarianceByPopulation
public VarianceAggregation getVarianceByPopulation(Column column, Column population)
Description copied from interface:DataFrame
Returns the aggregation method for computing the variance by factoring in the specified population.- Specified by:
getVarianceByPopulation
in interfaceDataFrame<Row,Column,V>
- Parameters:
column
- the column keypopulation
- the key of the column for the population- Returns:
- the aggregation method
-
getStdDev
public StdDevAggregation getStdDev(Column column)
Description copied from interface:DataFrame
Returns the aggregation method for computing the standard deviation.
-
getUnivariateStatistics
public UnivariateStatisticsAggregation getUnivariateStatistics(Column column)
Description copied from interface:DataFrame
Returns the aggregation method for computing the univariate statistics.- Specified by:
getUnivariateStatistics
in interfaceDataFrame<Row,Column,V>
- Parameters:
column
- the column key- Returns:
- the aggregation method
-
getMedian
public MedianAggregation getMedian(Column column)
Description copied from interface:DataFrame
Returns the aggregation method for computing the median value.
-
getFirstQuartile
public FirstQuartileAggregation getFirstQuartile(Column column)
Description copied from interface:DataFrame
Returns the aggregation method for computing the median value.- Specified by:
getFirstQuartile
in interfaceDataFrame<Row,Column,V>
- Parameters:
column
- the column key- Returns:
- the aggregation method
-
getThirdQuartile
public ThirdQuartileAggregation getThirdQuartile(Column column)
Description copied from interface:DataFrame
Returns the aggregation method for computing the median value.- Specified by:
getThirdQuartile
in interfaceDataFrame<Row,Column,V>
- Parameters:
column
- the column key- Returns:
- the aggregation method
-
getWeightedSum
public Aggregation getWeightedSum(Column weight, Column column)
Description copied from interface:DataFrame
Returns the aggregation method for computing the weighted sum.- Specified by:
getWeightedSum
in interfaceDataFrame<Row,Column,V>
column
- the column key- Returns:
- the aggregation method
-
getWeightedMean
public Aggregation getWeightedMean(Column weight, Column column)
Description copied from interface:DataFrame
Returns the aggregation method for computing the weigthed mean.- Specified by:
getWeightedMean
in interfaceDataFrame<Row,Column,V>
column
- the column key- Returns:
- the aggregation method
-
getCountDistinct
public CountDistinctAggregation getCountDistinct(Column column)
Description copied from interface:DataFrame
Returns the aggregation method for counting the number of distinct values.- Specified by:
getCountDistinct
in interfaceDataFrame<Row,Column,V>
- Parameters:
column
- the column key- Returns:
- the aggregation method
-
getCountDistinctWithNull
public CountDistinctWithNullAggregation getCountDistinctWithNull(Column column)
Description copied from interface:DataFrame
Returns the aggregation method for counting the number of distinct values, including null value if present.- Specified by:
getCountDistinctWithNull
in interfaceDataFrame<Row,Column,V>
- Parameters:
column
- the column key- Returns:
- the aggregation method
-
getCentroid
public CentroidAggregation getCentroid(Column column)
Description copied from interface:DataFrame
Returns the aggregation method for finding the centroid of geometries.- Specified by:
getCentroid
in interfaceDataFrame<Row,Column,V>
- Parameters:
column
- the column key- Returns:
- the aggregation method
-
getColumnName
public java.lang.String getColumnName(Column column)
Description copied from interface:DataFrame
Returns the name of the column. This is a convenience method for labeling purpose.- Specified by:
getColumnName
in interfaceDataFrame<Row,Column,V>
- Parameters:
column
- the key of the column- Returns:
- the name of the column
-
printSchema
@GwtIncompatible public void printSchema()
Description copied from interface:DataFrame
Display the content of the data frame to the console.- Specified by:
printSchema
in interfaceDataFrame<Row,Column,V>
-
print
@GwtIncompatible public void print()
Description copied from interface:DataFrame
Display the content of the data frame to the console.
-
print
@GwtIncompatible public void print(java.io.PrintStream out, java.lang.String caption, boolean html)
Description copied from interface:DataFrame
Display the content of the data frame to the specified output.
-
benchmark
public void benchmark()
Description copied from interface:DataFrame
Perform some repetitive operation to estimate the performance of the data frame.
-
reindexRows
public DataFrame<java.lang.Integer,Column,V> reindexRows()
Description copied from interface:DataFrame
Returns a new data frame reindexed using integers.- Specified by:
reindexRows
in interfaceDataFrame<Row,Column,V>
- Returns:
- the reindexed data frame.
-
reindexRows
public MutableDataFrame<V,Column,V> reindexRows(Column column)
Description copied from interface:DataFrame
Returns a new data frame reindexed using the values coming from the specified column.- Specified by:
reindexRows
in interfaceDataFrame<Row,Column,V>
- Parameters:
column
- the columns to use for the label values- Returns:
- the reindexed data frame.
-
reindexRows
public MutableDataFrame<V,Column,V> reindexRows(boolean keepColumn, Column column)
Description copied from interface:DataFrame
Returns a new data frame reindexed using the values coming from the specified column.- Specified by:
reindexRows
in interfaceDataFrame<Row,Column,V>
column
- the columns to use for the label values- Returns:
- the reindexed data frame.
-
reindexRows
public DataFrame<MultiKey,Column,V> reindexRows(Column... columns)
Description copied from interface:DataFrame
Returns a new data frame reindexed using the values coming from the specified rows.- Specified by:
reindexRows
in interfaceDataFrame<Row,Column,V>
- Parameters:
columns
- the columns to use for the label values- Returns:
- the reindexed data frame.
-
reindexRows
public DataFrame<MultiKey,Column,V> reindexRows(boolean keepColumns, Column... columns)
Description copied from interface:DataFrame
Returns a new data frame reindexed using the values coming from the specified rows.- Specified by:
reindexRows
in interfaceDataFrame<Row,Column,V>
columns
- the columns to use for the label values- Returns:
- the reindexed data frame.
-
addDataFrameListener
public void addDataFrameListener(DataFrameListener<Row,Column> listener)
Description copied from interface:DataFrame
Add a listener to the list that's notified each time a change to the data frame occurs.- Specified by:
addDataFrameListener
in interfaceDataFrame<Row,Column,V>
- Parameters:
listener
- the DataFrameListener
-
addWeakDataFrameListener
public void addWeakDataFrameListener(DataFrameListener<Row,Column> listener)
Description copied from interface:DataFrame
Add a listener to the list that's notified each time a change to the data frame occurs. The listener will automatically be disposed of should no other object have a reference to it.- Specified by:
addWeakDataFrameListener
in interfaceDataFrame<Row,Column,V>
- Parameters:
listener
- the DataFrameListener
-
removeDataFrameListener
public void removeDataFrameListener(DataFrameListener<Row,Column> listener)
Description copied from interface:DataFrame
Remove a listener to the list that's notified each time a change to the data frame occurs.- Specified by:
removeDataFrameListener
in interfaceDataFrame<Row,Column,V>
- Parameters:
listener
- the DataFrameListener
-
removeDataFrameListeners
public void removeDataFrameListeners()
Description copied from interface:DataFrame
Remove all listeners to the list that's notified each time a change to the data frame occurs.- Specified by:
removeDataFrameListeners
in interfaceDataFrame<Row,Column,V>
-
notifyDataFrameChanged
protected void notifyDataFrameChanged(DataFrameEvent<Row,Column> event)
Fires an event event to listeners that have been registered to track changes to the data frame.- Parameters:
event
- the event describing the changes
-
-