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 void
close()
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.FleetingParentNode
getAnchorNode()
Get the anchor node for the watch.Pattern
getSelection()
Get the selection (that is, the restricted XPath expression) that defines the nodes that this Watch is looking forboolean
matchesNode(FleetingNode node, XPathContext context)
Determine whether the watch matches a given nodeboolean
matchesNodesOfKind(UType kind)
Ask whether the Watch is capable of matching nodes of a particular kindvoid
open(Terminator terminator)
Open the watch.void
processItem(Item item)
Signal that a node (other than an element) that matches the selection has been found.void
setAnchorNode(FleetingParentNode anchor)
Set the anchor node for the watch.void
setSelection(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:
open
in interfaceWatch
- Overrides:
open
in classAbstractWatch
- Parameters:
terminator
- action to be taken on failure- 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:
processItem
in interfaceWatch
- Overrides:
processItem
in classAbstractWatch
- Parameters:
item
- the node that was matched.- Throws:
XPathException
- May be raised if a dynamic error occurs
-
close
public void close() throws XPathException
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. The default implementation does nothing.- Specified by:
close
in interfaceWatch
- Overrides:
close
in classAbstractWatch
- Throws:
XPathException
- May be raised if a dynamic error occurs
-
-