Class AncestorCharacteristic

  • public class AncestorCharacteristic
    extends Characteristic
    Given an expression, this characteristic returns a boolean indicating whether or not the context item has a parent (or ancestor, respectively) that matches a given pattern
    • Constructor Detail

      • AncestorCharacteristic

        public AncestorCharacteristic​(Pattern pattern,
                                      boolean isParent)
        Define an AncestorCharacteristic
        pattern - the pattern that an ancestor/parent must satisfy if the the characteristic is to have the value true
        isParent - true if the pattern must match the immediate parent; false if the pattern must match some ancestor
    • Method Detail

      • evaluate

        public BooleanValue evaluate​(XPathContext context)
                              throws XPathException
        Evaluate the characteristic as applied to the context item
        Specified by:
        evaluate in class Characteristic
        context - the dynamic evaluation context; the context item is the item being matched
        true if there is an ancestor/parent satisfying the characteristic pattern. (We wrap this in a BooleanValue because the superclass expects Object, and using Boolean causes problems with C# translation.)
        XPathException - if pattern matching fails with a dynamic error
      • hashCode

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

        public boolean equals​(java.lang.Object obj)
        Test whether this characteristic is the same as another characteristic.
        equals in class java.lang.Object
        obj - the object to be compared
        true if the two characteristics are equivalent
      • toString

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