public static class Precondition.StringHashPrecondition extends Precondition
It is used in two situations:
(a) for a predicate pattern in the form *[EXP = 'constant'] where the constant hash code is the hash code of the collation key of the constant string, and the characteristic is the set of hash codes corresponding to the collation keys of the strings selected by evaluating EXP.
(b) for a predicate pattern in the form *[contains(EXP, ' constant ')], typically encountered in DITA stylesheets, where the constant hash code is the hash code of the collation key of the token being matched (the constant with whitespace trimmed), and the characteristic is the set of hash codes corresponding to the collation keys of the tokens found by evaluating EXP and splitting on whitespace boundaries.
Precondition.BooleanPrecondition, Precondition.NumericComparisonPrecondition, Precondition.StringHashPrecondition
Constructor and Description |
---|
StringHashPrecondition(Characteristic<IntSet> characteristic,
AtomicMatchKey required,
StringCollator collator)
Create a StringHashPrecondition
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
boolean |
testPrecondition(PreconditionMatcher matcher)
Compute the value of the precondition for a given item.
|
java.lang.String |
toString() |
isSatisfied, setSlotNumber
public StringHashPrecondition(Characteristic<IntSet> characteristic, AtomicMatchKey required, StringCollator collator)
characteristic
- the characteristic that is tested by this precondition. This
must evaluate to a set of hashcodes for permitted string values.
The precondition is satisfied if the set of hash codes obtained
as the value of the characteristic includes the hash code of the
required key value. For example, given match=*[author='Kay']
,
the characteristic will be the set of hash codes of the values of
'author' children of the context item; the precondition is satisfied
if this includes the hash code of the string 'Kay' under the specified
collation.required
- the required key value, whose hash code must match one of the values in the
IntSet value of the characteristiccollator
- the collation to be used for comparisonpublic boolean testPrecondition(PreconditionMatcher matcher) throws XPathException
Precondition
testPrecondition
in class Precondition
matcher
- the PreconditionMatcher: holds the dynamic context for evaluation.XPathException
- if evaluation of the precondition fails with a dynamic errorpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.