Package org.openrefine.browsing.util
Class ExpressionValueFacetAggregator<T extends FacetState>
- java.lang.Object
-
- org.openrefine.browsing.facets.RowInRecordAggregator<T>
-
- org.openrefine.browsing.facets.FacetAggregator<T>
-
- org.openrefine.browsing.util.ExpressionValueFacetAggregator<T>
-
- Type Parameters:
T
-
- All Implemented Interfaces:
Serializable
,Combiner<T>
,RecordAggregator<T>
,RowAggregator<T>
- Direct Known Subclasses:
NumericFacetAggregator
,StringValuesFacetAggregator
,TimeRangeFacetAggregator
public abstract class ExpressionValueFacetAggregator<T extends FacetState> extends FacetAggregator<T>
Base class for facet aggregators which update their state by evaluating an expression and aggregating its result. If the result is a collection, each of the individual values are aggregated independently.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected RowEvaluable
_eval
protected boolean
_invert
-
Constructor Summary
Constructors Constructor Description ExpressionValueFacetAggregator(boolean invert, RowEvaluable eval)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description T
withRow(T state, long rowId, Row row, Record record)
Adds statistics obtained from a single row to the facet state.T
withRowOutsideView(T state, long rowId, Row row, Record record)
LikeRowAggregator.withRow(Object, long, Row)
} except that this method is called on rows that are excluded by at least two facets, so the values in this row do not normally count towards the statistics displayed in facets.protected abstract T
withValue(T 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.facets.FacetAggregator
getRowFilter
-
Methods inherited from class org.openrefine.browsing.facets.RowInRecordAggregator
withRecord, withRow
-
-
-
-
Field Detail
-
_invert
protected final boolean _invert
-
_eval
protected final RowEvaluable _eval
-
-
Constructor Detail
-
ExpressionValueFacetAggregator
public ExpressionValueFacetAggregator(boolean invert, RowEvaluable eval)
- Parameters:
invert
- used to generate the record filtereval
- the evaluable to run on each row
-
-
Method Detail
-
withValue
protected abstract T withValue(T state, Object value, boolean inView)
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.- 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
-
withRow
public T withRow(T state, long rowId, Row row, Record record)
Description copied from class:RowInRecordAggregator
Adds statistics obtained from a single row to the facet state. Given that facet states are expected to be immutable, this returns a new facet state object.- Specified by:
withRow
in classRowInRecordAggregator<T extends FacetState>
rowId
- the row id of the row to ingestrow
- the row to ingestrecord
- the enclosing record of the row, if available (in records mode), null otherwise- Returns:
- the facet state updated with this row
-
withRowOutsideView
public T withRowOutsideView(T state, long rowId, Row row, Record record)
Description copied from class:FacetAggregator
LikeRowAggregator.withRow(Object, long, Row)
} except that this method is called on rows that are excluded by at least two facets, so the values in this row do not normally count towards the statistics displayed in facets. This is useful for facets which require computing global statistics on the entire dataset regardless of which filtering is in place.- Overrides:
withRowOutsideView
in classFacetAggregator<T extends FacetState>
rowId
- the row id of the row to ingestrow
- the row to ingestrecord
- the enclosing record of the row if available, null otherwise- Returns:
- the facet state updated with this row
-
-