Search in sources :

Example 1 with RowEvaluable

use of com.google.refine.browsing.util.RowEvaluable in project OpenRefine by OpenRefine.

the class RangeFacet method computeChoices.

@Override
public void computeChoices(Project project, FilteredRows filteredRows) {
    if (_eval != null && _errorMessage == null) {
        RowEvaluable rowEvaluable = getRowEvaluable(project);
        Column column = project.columnModel.getColumnByCellIndex(_cellIndex);
        String key = "numeric-bin:row-based:" + _expression;
        NumericBinIndex index = (NumericBinIndex) column.getPrecompute(key);
        if (index == null) {
            index = new NumericBinRowIndex(project, rowEvaluable);
            column.setPrecompute(key, index);
        }
        retrieveDataFromBaseBinIndex(index);
        ExpressionNumericValueBinner binner = new ExpressionNumericValueBinner(rowEvaluable, index);
        filteredRows.accept(project, binner);
        retrieveDataFromBinner(binner);
    }
}
Also used : NumericBinRowIndex(com.google.refine.browsing.util.NumericBinRowIndex) Column(com.google.refine.model.Column) NumericBinIndex(com.google.refine.browsing.util.NumericBinIndex) ExpressionNumericValueBinner(com.google.refine.browsing.util.ExpressionNumericValueBinner) ExpressionBasedRowEvaluable(com.google.refine.browsing.util.ExpressionBasedRowEvaluable) RowEvaluable(com.google.refine.browsing.util.RowEvaluable)

Example 2 with RowEvaluable

use of com.google.refine.browsing.util.RowEvaluable in project OpenRefine by OpenRefine.

the class RangeFacet method computeChoices.

@Override
public void computeChoices(Project project, FilteredRecords filteredRecords) {
    if (_eval != null && _errorMessage == null) {
        RowEvaluable rowEvaluable = getRowEvaluable(project);
        Column column = project.columnModel.getColumnByCellIndex(_cellIndex);
        String key = "numeric-bin:record-based:" + _expression;
        NumericBinIndex index = (NumericBinIndex) column.getPrecompute(key);
        if (index == null) {
            index = new NumericBinRecordIndex(project, rowEvaluable);
            column.setPrecompute(key, index);
        }
        retrieveDataFromBaseBinIndex(index);
        ExpressionNumericValueBinner binner = new ExpressionNumericValueBinner(rowEvaluable, index);
        filteredRecords.accept(project, binner);
        retrieveDataFromBinner(binner);
    }
}
Also used : NumericBinRecordIndex(com.google.refine.browsing.util.NumericBinRecordIndex) Column(com.google.refine.model.Column) NumericBinIndex(com.google.refine.browsing.util.NumericBinIndex) ExpressionNumericValueBinner(com.google.refine.browsing.util.ExpressionNumericValueBinner) ExpressionBasedRowEvaluable(com.google.refine.browsing.util.ExpressionBasedRowEvaluable) RowEvaluable(com.google.refine.browsing.util.RowEvaluable)

Example 3 with RowEvaluable

use of com.google.refine.browsing.util.RowEvaluable in project OpenRefine by OpenRefine.

the class TimeRangeFacet method computeChoices.

@Override
public void computeChoices(Project project, FilteredRows filteredRows) {
    if (_eval != null && _errorMessage == null) {
        RowEvaluable rowEvaluable = getRowEvaluable(project);
        Column column = project.columnModel.getColumnByCellIndex(_cellIndex);
        String key = "time-bin:row-based:" + _expression;
        TimeBinIndex index = (TimeBinIndex) column.getPrecompute(key);
        if (index == null) {
            index = new TimeBinRowIndex(project, rowEvaluable);
            column.setPrecompute(key, index);
        }
        retrieveDataFromBaseBinIndex(index);
        ExpressionTimeValueBinner binner = new ExpressionTimeValueBinner(rowEvaluable, index);
        filteredRows.accept(project, binner);
        retrieveDataFromBinner(binner);
    }
}
Also used : TimeBinRowIndex(com.google.refine.browsing.util.TimeBinRowIndex) Column(com.google.refine.model.Column) ExpressionTimeValueBinner(com.google.refine.browsing.util.ExpressionTimeValueBinner) TimeBinIndex(com.google.refine.browsing.util.TimeBinIndex) RowEvaluable(com.google.refine.browsing.util.RowEvaluable)

Example 4 with RowEvaluable

use of com.google.refine.browsing.util.RowEvaluable in project OpenRefine by OpenRefine.

the class TimeRangeFacet method computeChoices.

@Override
public void computeChoices(Project project, FilteredRecords filteredRecords) {
    if (_eval != null && _errorMessage == null) {
        RowEvaluable rowEvaluable = getRowEvaluable(project);
        Column column = project.columnModel.getColumnByCellIndex(_cellIndex);
        String key = "time-bin:record-based:" + _expression;
        TimeBinIndex index = (TimeBinIndex) column.getPrecompute(key);
        if (index == null) {
            index = new TimeBinRecordIndex(project, rowEvaluable);
            column.setPrecompute(key, index);
        }
        retrieveDataFromBaseBinIndex(index);
        ExpressionTimeValueBinner binner = new ExpressionTimeValueBinner(rowEvaluable, index);
        filteredRecords.accept(project, binner);
        retrieveDataFromBinner(binner);
    }
}
Also used : Column(com.google.refine.model.Column) ExpressionTimeValueBinner(com.google.refine.browsing.util.ExpressionTimeValueBinner) TimeBinRecordIndex(com.google.refine.browsing.util.TimeBinRecordIndex) TimeBinIndex(com.google.refine.browsing.util.TimeBinIndex) RowEvaluable(com.google.refine.browsing.util.RowEvaluable)

Aggregations

RowEvaluable (com.google.refine.browsing.util.RowEvaluable)4 Column (com.google.refine.model.Column)4 ExpressionBasedRowEvaluable (com.google.refine.browsing.util.ExpressionBasedRowEvaluable)2 ExpressionNumericValueBinner (com.google.refine.browsing.util.ExpressionNumericValueBinner)2 ExpressionTimeValueBinner (com.google.refine.browsing.util.ExpressionTimeValueBinner)2 NumericBinIndex (com.google.refine.browsing.util.NumericBinIndex)2 TimeBinIndex (com.google.refine.browsing.util.TimeBinIndex)2 NumericBinRecordIndex (com.google.refine.browsing.util.NumericBinRecordIndex)1 NumericBinRowIndex (com.google.refine.browsing.util.NumericBinRowIndex)1 TimeBinRecordIndex (com.google.refine.browsing.util.TimeBinRecordIndex)1 TimeBinRowIndex (com.google.refine.browsing.util.TimeBinRowIndex)1