Class LogicalFilter<R>

Type Parameters:
R - the type of resources (e.g. Feature) used as inputs.
All Implemented Interfaces:
Serializable, Predicate<R>, Filter<R>, Optimization.OnFilter<R>, LogicalOperator<R>
Direct Known Subclasses:
LogicalFilter.And, LogicalFilter.Or

abstract class LogicalFilter<R> extends FilterNode<R> implements LogicalOperator<R>, Optimization.OnFilter<R>
Logical filter (AND, OR) using an arbitrary number of operands. Operands are other filters.
Since:
1.1
Version:
1.2
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
    • operands

      protected final Filter<? super R>[] operands
      The filter on which to apply the logical operator.
  • Constructor Details

    • LogicalFilter

      LogicalFilter(Collection<? extends Filter<? super R>> op)
      Creates a new logical operator applied on the given operands.
      Parameters:
      op - operands of the new operator.
    • LogicalFilter

      LogicalFilter(Filter<? super R> operand1, Filter<? super R> operand2)
      Creates a new logical operator with the two given operands. This method does not verify if the operands are non-null; this check should be already done by the caller.
  • Method Details

    • createSameType

      protected abstract LogicalFilter<R> createSameType(Collection<? extends Filter<? super R>> op)
      Creates a new logical operator of the same kind than this operator.
      Parameters:
      op - operands of the new operator.
      Returns:
      the new operator.
    • getOperands

      public final List<Filter<? super R>> getOperands()
      Returns a list containing all of the child filters of this object.
      Specified by:
      getOperands in interface LogicalOperator<R>
    • getChildren

      protected final Collection<?> getChildren()
      Returns the children of this node for displaying purposes. This is used by Node.toString(), Node.hashCode() and Node.equals(Object) implementations.
      Specified by:
      getChildren in class Node
      Returns:
      the children of this node, or an empty collection if none.
    • optimize

      final Filter<? super R> optimize(Optimization optimization, Filter<R> ignore, Filter<R> shortCircuit)
      Returns the filter to use with duplicated operands removed, nested operations of the same type inlined, and literal values processed immediately. If no simplification has been applied, then this method returns this.
      Parameters:
      optimization - the simplifications or optimizations to apply on this filter.
      ignore - the filter to ignore (literal "true" or "false").
      shortCircuit - the filter to use if found (literal "true" or "false").