All Implemented Interfaces:
Serializable, Cloneable, Predicate<V>

public final class AndP<V> extends ConnectiveP<V>
Author:
Marko A. Rodriguez (http://markorodriguez.com)
See Also:
  • Constructor Details

    • AndP

      public AndP(List<P<V>> predicates)
  • Method Details

    • and

      public P<V> and(Predicate<? super V> predicate)
      Specified by:
      and in interface Predicate<V>
      Overrides:
      and in class ConnectiveP<V>
    • negate

      public P<V> negate()
      Specified by:
      negate in interface Predicate<V>
      Overrides:
      negate in class ConnectiveP<V>
    • resolve

      public void resolve(Traverser.Admin<?> traverser)
      Resolves child predicates with short-circuiting. Because a conjunction fails as soon as any child predicate cannot be satisfied, resolution stops at the first child that resolves empty (i.e. a scalar predicate whose child traversal produced no comparison value). This avoids evaluating the remaining child traversals, which may be expensive. Collection predicates (within/without) never resolve empty (they resolve to an empty collection), so they do not trigger the short-circuit.
      Overrides:
      resolve in class ConnectiveP<V>
    • isResolvedEmpty

      public boolean isResolvedEmpty()
      Description copied from class: P
      Returns true if the most recent call to P.resolve(Traverser.Admin) produced no results for a scalar predicate, meaning there is no meaningful comparison value.
      Overrides:
      isResolvedEmpty in class P<V>
    • toString

      public String toString()
      Overrides:
      toString in class P<V>
    • clone

      public AndP<V> clone()
      Overrides:
      clone in class ConnectiveP<V>