Package org.apache.sis.filter
Class LogicalFilter<R>
java.lang.Object
org.apache.sis.internal.filter.Node
org.apache.sis.filter.FilterNode<R>
org.apache.sis.filter.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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
The "And" operation (⋀).(package private) static final class
The negation filter (¬).(package private) static final class
The "Or" operation (⋁). -
Field Summary
FieldsModifier and TypeFieldDescriptionThe filter on which to apply the logical operator.private static final long
For cross-version compatibility. -
Constructor Summary
ConstructorsConstructorDescriptionLogicalFilter
(Collection<? extends Filter<? super R>> op) Creates a new logical operator applied on the given operands.LogicalFilter
(Filter<? super R> operand1, Filter<? super R> operand2) Creates a new logical operator with the two given operands. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract LogicalFilter
<R> createSameType
(Collection<? extends Filter<? super R>> op) Creates a new logical operator of the same kind than this operator.protected final Collection
<?> Returns the children of this node for displaying purposes.Returns a list containing all of the child filters of this object.Returns the filter to use with duplicated operands removed, nested operations of the same type inlined, and literal values processed immediately.Methods inherited from class org.apache.sis.filter.FilterNode
and, negate, or
Methods inherited from class org.apache.sis.internal.filter.Node
createName, createType, equals, getGeometryLibrary, hashCode, symbol, toGeometryWrapper, toString, unwrap, warning
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.sis.internal.geoapi.filter.LogicalOperator
getExpressions, getOperatorType
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
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
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
Creates a new logical operator of the same kind than this operator.- Parameters:
op
- operands of the new operator.- Returns:
- the new operator.
-
getOperands
Returns a list containing all of the child filters of this object.- Specified by:
getOperands
in interfaceLogicalOperator<R>
-
getChildren
Returns the children of this node for displaying purposes. This is used byNode.toString()
,Node.hashCode()
andNode.equals(Object)
implementations.- Specified by:
getChildren
in classNode
- 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 returnsthis
.- 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").
-