Package com.saxonica.ee.trans
Class TokenMatchOperand
- java.lang.Object
-
- com.saxonica.ee.trans.Characteristic<IntSet>
-
- com.saxonica.ee.trans.TokenMatchOperand
-
public class TokenMatchOperand extends Characteristic<IntSet>
Given an expression, this characteristic evaluates the set of hash keys corresponding to the whitespace-separated tokens in the string values of the items selected by that expression.It is used typically in optimizing patterns in DITA stylesheets, where the pattern takes the form *[@class = ' topic/li '] or similar. In this example the characteristic will be obtained by tokenizing the value of @class on whitespace boundaries, and finding the hash code of the collation key of each of these tokens. This set of hash codes is then compared with the hashcode of the constant string ' topic/li '. The benefit comes only when a rule chain contains many rules with this same general structure, but different constant strings; the same set of hash codes will then be compared against each of the string constants in turn.
-
-
Constructor Summary
Constructors Constructor Description TokenMatchOperand(Expression exp)
Create a token match characteristic
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
IntSet
evaluate(XPathContext context)
Evaluate the value of this characteristic for the context itemint
hashCode()
java.lang.String
toString()
-
Methods inherited from class com.saxonica.ee.trans.Characteristic
getSlotNumber, setSlotNumber
-
-
-
-
Constructor Detail
-
TokenMatchOperand
public TokenMatchOperand(Expression exp)
Create a token match characteristic- Parameters:
exp
- the expression to be tokenized. In the case of DITA-OT stylesheets, this expression will generally be "@class".
-
-
Method Detail
-
evaluate
public IntSet evaluate(XPathContext context) throws XPathException
Description copied from class:Characteristic
Evaluate the value of this characteristic for the context item- Specified by:
evaluate
in classCharacteristic<IntSet>
- Parameters:
context
- the dynamic evaluation context; the context item is the item being matched- Returns:
- the value of the characteristic
- Throws:
XPathException
- if evaluation of the characteristic fails
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-