Class Precondition.BooleanPrecondition

  • Enclosing class:
    Precondition

    public static class Precondition.BooleanPrecondition
    extends Precondition
    A BooleanPrecondition can in principle test any boolean characteristic of a pattern. In practice it is used to test for the existence of a named ancestor/parent element. That is, in current use the Characteristic will always be an AncestorCharacteristic
    • Constructor Detail

      • BooleanPrecondition

        public BooleanPrecondition​(Characteristic characteristic)
        Create a precondition that maps directly to a boolean characteristic
        Parameters:
        characteristic - the boolean characteristic
    • Method Detail

      • testPrecondition

        protected boolean testPrecondition​(PreconditionMatcher matcher)
                                    throws XPathException
        Evaluate the precondition, which will be true if and only if the value of the characteristic for the current item is the boolean value true.
        Specified by:
        testPrecondition in class Precondition
        Parameters:
        matcher - the PreconditionMatcher: holds the dynamic context for evaluation.
        Returns:
        true if the precondition is satisfied
        Throws:
        XPathException - if evaluation of the precondition fails with a dynamic error
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object