Interface Filter

All Superinterfaces:
ConcurrencyControl<Filter>, Expression
All Known Subinterfaces:
LiteralFilter, ReindexingFilter, WhereFilter
All Known Implementing Classes:
AbstractConditionFilter, AbstractRangeFilter, AutoTuningIncrementalReleaseFilter, BaseIncrementalReleaseFilter, ByteRangeFilter, CharRangeFilter, ClockFilter, ComparableRangeFilter, ComposedFilter, ConditionFilter, ConjunctiveFilter, DisjunctiveFilter, DoubleRangeFilter, DownsampledWhereFilter, DynamicWhereFilter, FilterAnd, FilterBase, FilterComparison, FilterIn, FilterIsNaN, FilterIsNull, FilterNot, FilterOr, FilterPattern, FilterSerial, FilterWithDeclaredBarriers, FilterWithRespectedBarriers, FloatRangeFilter, Function, IncrementalReleaseFilter, InstantRangeFilter, IntRangeFilter, LongRangeFilter, MatchFilter, Method, RangeFilter, RawString, RollingReleaseFilter, ShortRangeFilter, SingleSidedComparableRangeFilter, SortedClockFilter, TimeSeriesFilter, UnsortedClockFilter, VectorComponentFilterWrapper, WhereAllFilter, WhereFilterDelegatingBase, WhereFilterImpl, WhereFilterInvertedImpl, WhereFilterLivenessArtifactImpl, WhereFilterSerialImpl, WhereFilterWithDeclaredBarriersImpl, WhereFilterWithRespectedBarriersImpl, WhereNoneFilter

public interface Filter extends Expression, ConcurrencyControl<Filter>
Represents an evaluate-able filter.
See Also:
  • Method Details

    • from

      static Collection<? extends Filter> from(String... expressions)
    • from

      static Collection<? extends Filter> from(Collection<String> expressions)
    • ofTrue

      static LiteralFilter ofTrue()
      Creates an always-true-filter.

      Equivalent to Literal.of(true).

      Returns:
      the always-true-filter
    • ofFalse

      static LiteralFilter ofFalse()
      Creates an always-false-filter.

      Equivalent to Literal.of(false).

      Returns:
      the always-false-filter
    • isNull

      static FilterIsNull isNull(Expression expression)
      Creates an is-null-filter.
      Parameters:
      expression - the expression
      Returns:
      the is-null-filter
    • isNaN

      static FilterIsNaN isNaN(Expression expression)
      Creates an is-nan-filter.
      Parameters:
      expression - the expression
      Returns:
      the is-nan-filter
    • isNotNull

      static FilterNot<FilterIsNull> isNotNull(Expression expression)
      Creates an is-not-null-filter.

      Equivalent to not(isNull(expression)).

      Parameters:
      expression - the expression
      Returns:
      the is-not-null-filter
    • isNotNaN

      static FilterNot<FilterIsNaN> isNotNaN(Expression expression)
      Creates an is-not-nan-filter.

      Equivalent to not(isNaN(expression)).

      Parameters:
      expression - the expression
      Returns:
      the is-not-nan-filter
    • isTrue

      static FilterComparison isTrue(Expression expression)
      Creates an is-true-filter.

      Equivalent to FilterComparison.eq(expression, ofTrue()).

      Parameters:
      expression - the expression
      Returns:
      the equals-true-filter
    • isFalse

      static FilterComparison isFalse(Expression expression)
      Creates an is-false-filter.

      Equivalent to FilterComparison.eq(expression, ofFalse()).

      Parameters:
      expression - the expression
      Returns:
      @return the equals-false-filter
    • not

      static <F extends Filter> FilterNot<F> not(F filter)
      Creates a not-filter from filter. Callers should typically prefer invert(), unless the "not" context needs to be preserved.
      Type Parameters:
      F - the type of filter
      Parameters:
      filter - the filter
      Returns:
      the not-filter
    • or

      static Filter or(Filter... filters)
      Creates a filter that evaluates to true when any of filters evaluates to true, and false when none of the filters evaluates to true. This implies that ofFalse() is returned when filters is empty.
      Parameters:
      filters - the filters
      Returns:
      the filter
    • or

      static Filter or(Collection<? extends Filter> filters)
      Creates a filter that evaluates to true when any of filters evaluates to true, and false when none of the filters evaluates to true. This implies that ofFalse() is returned when filters is empty.
      Parameters:
      filters - the filters
      Returns:
      the filter
    • and

      static Filter and(Filter... filters)
      Creates a filter that evaluates to true when all of the filters evaluate to true, and false when any of the filters evaluates to false. This implies that ofTrue() is returned when filters is empty.
      Parameters:
      filters - the filters
      Returns:
      the filter
    • and

      static Filter and(Collection<? extends Filter> filters)
      Creates a filter that evaluates to true when all of the filters evaluate to true, and false when any of the filters evaluates to false. This implies that ofTrue() is returned when filters is empty.
      Parameters:
      filters - the filters
      Returns:
      the filter
    • serial

      static Filter serial(Filter filter)
      Wraps the given filter with a FilterSerial to enforce serial execution.

      Parameters:
      filter - the filter to wrap
      Returns:
      a FilterSerial instance wrapping the provided filter
    • declaredBarriers

      static FilterWithDeclaredBarriers declaredBarriers(Filter filter, Object... barriers)
      Wraps the given filter with a FilterBarrier to declare one or more barriers that other filters can respect.
      Parameters:
      filter - the filter to wrap
      barriers - the barrier objects being declared
      Returns:
      a FilterBarrier instance wrapping the provided filter
    • respectedBarrier

      static FilterWithRespectedBarriers respectedBarrier(Filter filter, Object... respectedBarriers)
      Wraps the given filter with a FilterBarrier to declare a barrier that other filters can respect.
      Parameters:
      filter - the filter to wrap
      respectedBarriers - the barrier objects that need to be respected
      Returns:
      a FilterBarrier instance wrapping the provided filter
    • extractAnds

      static Collection<Filter> extractAnds(Filter filter)
      Performs a non-recursive "and-extraction" against filter. If filter is a FilterAnd, FilterAnd.filters() will be returned. If filter is ofTrue(), an empty list will be returned. Otherwise, a singleton list of filter will be returned.
      Parameters:
      filter - the filter
      Returns:
      the and-extracted filter
    • invert

      Filter invert()
      The logical inversion of this. While logically equivalent to Filter.not(this), implementations of this method will return more specifically typed inversions where applicable.
      Returns:
      the inverse filter
      See Also:
    • withSerial

      default Filter withSerial()
      Description copied from interface: ConcurrencyControl
      Applies serial concurrency control to the expression.

      The serial wrapped filter/selectable is guaranteed to process exactly the set of rows as if any prior filters/selectables were applied, but it will do so in a serial manner. If this is a filter, then the expression will not evaluate additional rows or skip rows that future filters may eliminate. Take care when selecting marking filters/selectables as serial, as the operation will not be able to take advantage of powerful optimizations.

      • Concurrency impact: The expression will never be invoked concurrently with itself.
      • Intra-expression ordering impact: Rows are evaluated sequentially in row set order.
      • Inter-expression ordering impact: For a filter, serial acts as an absolute reordering barrier, ensuring that no parts of a filter are executed out of order relative to this serial wrapper.

        For selectables, additional ordering constraints are controlled by the value of the QueryTable.SERIAL_SELECT_IMPLICIT_BARRIERS. This is set by the property QueryTable.serialSelectImplicitBarriers (defaulting to the value of QueryTable.statelessSelectByDefault).

        If QueryTable.SERIAL_SELECT_IMPLICIT_BARRIERS is false, then no additional ordering between selectable expressions is imposed. As with every select or update call, if column B references column A, then the necessary inputs from column A are evaluated before column B is evaluated. To impose further ordering constraints, use barriers.

        If QueryTable.SERIAL_SELECT_IMPLICIT_BARRIERS is true, then a serial selectable is an absolute barrier with respect to all other serial selectables. This prohibits serial selectables from being evaluated concurrently, permitting them to access global state. Selectables that are not serial may be reordered with respect to a serial selectable.

      Specified by:
      withSerial in interface ConcurrencyControl<Filter>
      Returns:
      a new instance of T with serial concurrency control applied.
    • withRespectedBarriers

      default Filter withRespectedBarriers(Object... respectedBarriers)
      Description copied from interface: ConcurrencyControl
      Specifies that the filter/selectable should respect the ordering constraints of the given barriers.

      Filters that define a barrier (using ConcurrencyControl.withDeclaredBarriers(Object...)) will be executed entirely before filters/selectables that respect that barrier.

      It is an error to respect a barrier that has not already been defined per the natural left to right ordering of filters/selectables at the operation level. This is to minimize the risk of user error as the API is loosely typed.

      Object equals and Object.hashCode() hashCode will be used to identify which barriers are respected.

      Specified by:
      withRespectedBarriers in interface ConcurrencyControl<Filter>
      Parameters:
      respectedBarriers - the unique barrier object identifiers to respect
      Returns:
      a new instance of T with the respects barrier rule applied
    • withDeclaredBarriers

      default Filter withDeclaredBarriers(Object... declaredBarriers)
      Description copied from interface: ConcurrencyControl
      Designates the filter/selectable as declaring the specified barrier object(s).

      A barrier does not affect concurrency but imposes an ordering constraint for the filters or selectables that respect the same barrier. When a filter/selectable is marked as respecting a barrier object, it indicates that the respecting filter/selectable will be executed entirely after the filter/selectable declaring the barrier.

      Each barrier must be unique and declared by at most one filter. Object equals and Object.hashCode() hashCode will be used to determine uniqueness and identification of barrier objects.

      Specified by:
      withDeclaredBarriers in interface ConcurrencyControl<Filter>
      Parameters:
      declaredBarriers - the unique barrier object identifiers
      Returns:
      a new instance of T with the declaredBarriers applied
    • walk

      <T> T walk(Filter.Visitor<T> visitor)