Package com.saxonica.ee.stream.watch
Class PatternWatch
- java.lang.Object
-
- com.saxonica.ee.stream.watch.AbstractWatch
-
- com.saxonica.ee.stream.watch.PatternWatch
-
- All Implemented Interfaces:
Watch
- Direct Known Subclasses:
AccumulatorWatch,FieldWatch,MultiAccumulatorWatch,SelectorWatch,Trigger
public abstract class PatternWatch extends AbstractWatch
A Watch represents a class that is interested in looking at nodes for the purpose of evaluating uniqueness and key constraints, or for XSLT streaming; specifically, an implementation of Watch that retains a Pattern which is evaluated to see whether a particular node matches the Watch.
-
-
Constructor Summary
Constructors Constructor Description PatternWatch()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()The close() method is called immediately before the Watch is destroyed, that is, when the element whose declaration scopes the constraint implemented by this Watch goes out of scope.FleetingParentNodegetAnchorNode()Get the anchor node for the watch.PatterngetSelection()Get the selection (that is, the restricted XPath expression) that defines the nodes that this Watch is looking forbooleanmatchesNode(FleetingNode node, XPathContext context)Determine whether the watch matches a given nodebooleanmatchesNodesOfKind(UType kind)Ask whether the Watch is capable of matching nodes of a particular kindvoidopen(Terminator terminator)Open the watch.voidprocessItem(Item item)Signal that a node (other than an element) that matches the selection has been found.voidsetAnchorNode(FleetingParentNode anchor)Set the anchor node for the watch.voidsetSelection(Pattern selection)Set the selection (that is, the streamable XPath expression) that defines the nodes that this Watch is looking for-
Methods inherited from class com.saxonica.ee.stream.watch.AbstractWatch
getNamespaceResolver, getPipelineConfiguration, setNamespaceResolver, setPipelineConfiguration
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.saxonica.ee.stream.watch.Watch
endSelectedParentNode, startSelectedParentNode
-
-
-
-
Method Detail
-
matchesNode
public boolean matchesNode(FleetingNode node, XPathContext context) throws XPathException
Determine whether the watch matches a given node- Parameters:
node- the node to be testedcontext- the XPath dynamic context- Returns:
- true if the node is one of those the Watch is looking out for
- Throws:
XPathException- if a dynamic error occurs
-
matchesNodesOfKind
public boolean matchesNodesOfKind(UType kind)
Ask whether the Watch is capable of matching nodes of a particular kind- Parameters:
kind- the node kind as a UType- Returns:
- true if the watch is capabl of matching
-
setSelection
public void setSelection(Pattern selection)
Set the selection (that is, the streamable XPath expression) that defines the nodes that this Watch is looking for- Parameters:
selection- the streamable XPath expression
-
getSelection
public Pattern getSelection()
Get the selection (that is, the restricted XPath expression) that defines the nodes that this Watch is looking for- Returns:
- the selection
-
setAnchorNode
public void setAnchorNode(FleetingParentNode anchor)
Set the anchor node for the watch. This is the node to which the watch is scoped, typically the context node for the streamable path expression that defines the root of the subtree within which nodes are being sought.- Parameters:
anchor- The anchor node within which the watch is scoped
-
getAnchorNode
public final FleetingParentNode getAnchorNode()
Get the anchor node for the watch. This is the node to which the watch is scoped, typically the context node for the streamable path expression that defines the root of the subtree within which nodes are being sought.- Returns:
- The anchor node within which the watch is scoped
-
open
public void open(Terminator terminator) throws XPathException
Open the watch. This is done at the point where it first starts watching for nodes that match the selection.- Specified by:
openin interfaceWatch- Overrides:
openin classAbstractWatch- Parameters:
terminator-- Throws:
XPathException- May be raised if a dynamic error occurs
-
processItem
public void processItem(Item item) throws XPathException
Signal that a node (other than an element) that matches the selection has been found.- Specified by:
processItemin interfaceWatch- Overrides:
processItemin classAbstractWatch- Parameters:
item- the node that was matched.- Throws:
XPathException- May be raised if a dynamic error occurs
-
close
public void close() throws XPathExceptionThe close() method is called immediately before the Watch is destroyed, that is, when the element whose declaration scopes the constraint implemented by this Watch goes out of scope. The default implementation does nothing.- Specified by:
closein interfaceWatch- Overrides:
closein classAbstractWatch- Throws:
XPathException- May be raised if a dynamic error occurs
-
-