com.saxonica.stream
Class TemplateInversion

java.lang.Object
  extended by com.saxonica.stream.TemplateInversion
All Implemented Interfaces:
Serializable, RuleTarget

public class TemplateInversion
extends Object
implements RuleTarget

This class represents the inversion of a template body

See Also:
Serialized Form

Constructor Summary
TemplateInversion(Template originalTemplate, Configuration config)
          Create the Jackson inversion of a template, allowing the template to execute on a streamed input source.
 
Method Summary
 void explain(ExpressionPresenter presenter)
          Output diagnostic explanation to an ExpressionPresenter
 Template getOriginalTemplate()
          Get the original template of which this is an inversion
 SlotManager getStackFrame()
          Get the stackframe identifying the slots used for local variables
 Watch getWatch(WatchManager wm, Stack<XPathContext> contextStack)
          Get the WatchMaker associated with this template, if any.
 void invert(NodeTest nodeTest)
          Invert the body of the template.
static TemplateInversion makeBuiltInTemplate(WatchMaker watchMaker)
          Factory method to create built-in templates
 void setStackFrame(SlotManager frame)
          Set the stackframe identifying the slots used for local variables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateInversion

public TemplateInversion(Template originalTemplate,
                         Configuration config)
Create the Jackson inversion of a template, allowing the template to execute on a streamed input source.

Parameters:
originalTemplate - the template to be inverted
Method Detail

makeBuiltInTemplate

public static TemplateInversion makeBuiltInTemplate(WatchMaker watchMaker)
Factory method to create built-in templates


getWatch

public Watch getWatch(WatchManager wm,
                      Stack<XPathContext> contextStack)
               throws XPathException
Get the WatchMaker associated with this template, if any. This creates a watch to implement the "drill-down" instruction of the inverted template, for example if the drill-down instruction is CopyOfWatch with that expression as its selection.

Returns:
the WatchMaker if there is one, or null otherwise.
Throws:
XPathException

getOriginalTemplate

public Template getOriginalTemplate()
Get the original template of which this is an inversion

Returns:
the original template

invert

public void invert(NodeTest nodeTest)
            throws XPathException
Invert the body of the template.

Parameters:
nodeTest - The static item type of the context node for the template
Throws:
XPathException - if the template is non-streamable

setStackFrame

public void setStackFrame(SlotManager frame)
Set the stackframe identifying the slots used for local variables

Parameters:
frame - the stack frame skeleton

getStackFrame

public SlotManager getStackFrame()
Get the stackframe identifying the slots used for local variables

Returns:
the stack frame skeleton

explain

public void explain(ExpressionPresenter presenter)
Output diagnostic explanation to an ExpressionPresenter

Specified by:
explain in interface RuleTarget


Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.