Search in sources :

Example 1 with ExpressionTimeValueBinner

use of com.google.refine.browsing.util.ExpressionTimeValueBinner 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 2 with ExpressionTimeValueBinner

use of com.google.refine.browsing.util.ExpressionTimeValueBinner 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

ExpressionTimeValueBinner (com.google.refine.browsing.util.ExpressionTimeValueBinner)2 RowEvaluable (com.google.refine.browsing.util.RowEvaluable)2 TimeBinIndex (com.google.refine.browsing.util.TimeBinIndex)2 Column (com.google.refine.model.Column)2 TimeBinRecordIndex (com.google.refine.browsing.util.TimeBinRecordIndex)1 TimeBinRowIndex (com.google.refine.browsing.util.TimeBinRowIndex)1