Package org.openrefine.browsing.util
Class StringValuesFacetAggregator
- java.lang.Object
-
- org.openrefine.browsing.facets.RowInRecordAggregator<T>
-
- org.openrefine.browsing.facets.FacetAggregator<T>
-
- org.openrefine.browsing.util.ExpressionValueFacetAggregator<StringValuesFacetState>
-
- org.openrefine.browsing.util.StringValuesFacetAggregator
-
- All Implemented Interfaces:
Serializable
,Combiner<StringValuesFacetState>
,RecordAggregator<StringValuesFacetState>
,RowAggregator<StringValuesFacetState>
public class StringValuesFacetAggregator extends ExpressionValueFacetAggregator<StringValuesFacetState>
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
_cellIndex
protected ColumnModel
_columnModel
protected boolean
_selectBlanks
protected Set<String>
_selected
protected boolean
_selectErrors
-
Fields inherited from class org.openrefine.browsing.util.ExpressionValueFacetAggregator
_eval, _invert
-
-
Constructor Summary
Constructors Constructor Description StringValuesFacetAggregator(ColumnModel columnModel, int cellIndex, RowEvaluable evaluable, Set<String> selected, boolean selectBlanks, boolean selectErrors, boolean invert)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RowInRecordFilter
getRowFilter()
StringValuesFacetState
sum(StringValuesFacetState first, StringValuesFacetState second)
Merges two facet statistics from the same facet, computed on different sets of rows.protected StringValuesFacetState
withValue(StringValuesFacetState state, Object value, boolean inView)
Method to be implemented by subclasses to aggregate a value to their state.-
Methods inherited from class org.openrefine.browsing.util.ExpressionValueFacetAggregator
withRow, withRowOutsideView
-
Methods inherited from class org.openrefine.browsing.facets.RowInRecordAggregator
withRecord, withRow
-
-
-
-
Field Detail
-
_columnModel
protected final ColumnModel _columnModel
-
_cellIndex
protected final int _cellIndex
-
_selectBlanks
protected final boolean _selectBlanks
-
_selectErrors
protected final boolean _selectErrors
-
-
Constructor Detail
-
StringValuesFacetAggregator
public StringValuesFacetAggregator(ColumnModel columnModel, int cellIndex, RowEvaluable evaluable, Set<String> selected, boolean selectBlanks, boolean selectErrors, boolean invert)
Constructor.- Parameters:
columnModel
- the list of columns of the table where this facet is being appliedcellIndex
- the index of the base column where the evaluable is run (-1 if no base column is used, for instance for the flag/star facets)evaluable
- the evaluable which generates the values held by this facetselected
- the list of string values which are selectedselectBlanks
- whether blanks should be selectedselectErrors
- whether errors should be selectedinvert
- whether the selection should be inverted
-
-
Method Detail
-
sum
public StringValuesFacetState sum(StringValuesFacetState first, StringValuesFacetState second)
Description copied from interface:Combiner
Merges two facet statistics from the same facet, computed on different sets of rows. This generally amounts to summing all the statistics internally. This function is required to be associative: sum(a, sum(b, c)) == sum(sum(a, b), c)- Returns:
- the sum of both facet statistics
-
getRowFilter
public RowInRecordFilter getRowFilter()
- Specified by:
getRowFilter
in classFacetAggregator<StringValuesFacetState>
- Returns:
- a row filter which determines if a row matches this facet.
-
withValue
protected StringValuesFacetState withValue(StringValuesFacetState state, Object value, boolean inView)
Description copied from class:ExpressionValueFacetAggregator
Method to be implemented by subclasses to aggregate a value to their state. The value is guaranteed not to be a collection, it can be aggregated as such.- Specified by:
withValue
in classExpressionValueFacetAggregator<StringValuesFacetState>
- Parameters:
state
- the current aggregation statevalue
- the value to aggregateinView
- whether the value is in view (in the rows selected by other facets) or not.- Returns:
- the new aggregation state
-
-