T
- type of object the predicate can evaluate in memory.public abstract class QueryRewriter<T>
extends java.lang.Object
Subclasses may document their rewrite rules by declaring public methods with
QueryRewriter.Rewrite
annotations, such as:
@Rewrite("A=(owner:*) B=(status:*)") public Predicate r1_ownerStatus(@Named("A") OperatorPredicate owner, @Named("B") OperatorPredicate status) { }
Rewrite methods are applied in order by declared name, so naming methods with a numeric prefix to ensure a specific ordering (if required) is suggested.
Modifier and Type | Class and Description |
---|---|
static class |
QueryRewriter.Definition<T,R extends QueryRewriter<T>>
Defines the rewrite rules known by a QueryRewriter.
|
protected static interface |
QueryRewriter.NoCostComputation |
protected static interface |
QueryRewriter.Rewrite
Denotes a method which wants to replace a predicate expression.
|
protected static interface |
QueryRewriter.RewriteRule<T>
Applies a rewrite rule to a Predicate.
|
Modifier | Constructor and Description |
---|---|
protected |
QueryRewriter(QueryRewriter.Definition<T,? extends QueryRewriter<T>> def) |
Modifier and Type | Method and Description |
---|---|
Predicate<T> |
and(java.util.Collection<? extends Predicate<T>> that)
Combine the passed predicates into a single AND node.
|
Predicate<T> |
and(Predicate<T>... that)
Combine the passed predicates into a single AND node.
|
Predicate<T> |
not(Predicate<T> that)
Invert the passed node.
|
Predicate<T> |
or(java.util.Collection<? extends Predicate<T>> that)
Combine the passed predicates into a single OR node.
|
Predicate<T> |
or(Predicate<T>... that)
Combine the passed predicates into a single OR node.
|
protected Predicate<T> |
preRewrite(Predicate<T> in) |
protected Predicate<T> |
replaceGenericNodes(Predicate<T> in) |
Predicate<T> |
rewrite(Predicate<T> in)
Apply rewrites to a graph until it stops changing.
|
protected QueryRewriter(QueryRewriter.Definition<T,? extends QueryRewriter<T>> def)
public Predicate<T> and(java.util.Collection<? extends Predicate<T>> that)
public Predicate<T> and(Predicate<T>... that)
public Predicate<T> or(java.util.Collection<? extends Predicate<T>> that)
public Predicate<T> or(Predicate<T>... that)
public final Predicate<T> rewrite(Predicate<T> in)
in
- the graph to rewrite.