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 takes as input the expression tree representing the content of a streamable template, and analyses it. It performs two functions: firstly, to verify that the template is indeed streamable, and secondly, to generate a sequence of actions to be performed on processing the start of an element, and a sequence of actions to be performed at the end.

See Also:
Serialized Form

Field Summary
static int APPLY_CHILDREN
           
static TemplateInversion BUILT_IN_DOCUMENT_TEMPLATE
           
static TemplateInversion BUILT_IN_ELEMENT_TEMPLATE
           
static int COPY_OF_CHILDREN
           
static int COPY_OF_SELF
           
static int NEXT_MATCH
           
static int SKIP_CHILDREN
           
static int VALUE_OF_CHILDREN
           
 
Constructor Summary
TemplateInversion(Expression exp)
          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
 int getChildProcess()
          Ask how the descendants are to be processed
 List<StreamingAction> getLeftAction()
          Get the actions to be performed before processing the descendant nodes
 Mode getProcessChildrenMode()
          If the child process is APPLY_TEMPLATES, get the mode
 List<StreamingAction> getRightAction()
          Get the actions to be performed after processing the descendant nodes
 SlotManager getStackFrame()
          Get the stackframe identifying the slots used for local variables
 void invert(NodeTest nodeTest)
          Invert the body of the template.
 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
 

Field Detail

APPLY_CHILDREN

public static final int APPLY_CHILDREN
See Also:
Constant Field Values

COPY_OF_CHILDREN

public static final int COPY_OF_CHILDREN
See Also:
Constant Field Values

SKIP_CHILDREN

public static final int SKIP_CHILDREN
See Also:
Constant Field Values

VALUE_OF_CHILDREN

public static final int VALUE_OF_CHILDREN
See Also:
Constant Field Values

COPY_OF_SELF

public static final int COPY_OF_SELF
See Also:
Constant Field Values

NEXT_MATCH

public static final int NEXT_MATCH
See Also:
Constant Field Values

BUILT_IN_DOCUMENT_TEMPLATE

public static final TemplateInversion BUILT_IN_DOCUMENT_TEMPLATE

BUILT_IN_ELEMENT_TEMPLATE

public static final TemplateInversion BUILT_IN_ELEMENT_TEMPLATE
Constructor Detail

TemplateInversion

public TemplateInversion(Expression exp)
Create the Jackson inversion of a template, allowing the template to execute on a streamed input source.

Parameters:
exp - the body of the template
Method Detail

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

getLeftAction

public List<StreamingAction> getLeftAction()
Get the actions to be performed before processing the descendant nodes

Returns:
the pre-traversal actions

getRightAction

public List<StreamingAction> getRightAction()
Get the actions to be performed after processing the descendant nodes

Returns:
the post-traversal actions

getChildProcess

public int getChildProcess()
Ask how the descendants are to be processed

Returns:
a code indicating how the descendants are to be processed

getProcessChildrenMode

public Mode getProcessChildrenMode()
If the child process is APPLY_TEMPLATES, get the mode

Returns:
the mode in which the children are processed. Return null to mean the "#current" mode.

explain

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

Specified by:
explain in interface RuleTarget


Copyright (c) Saxonica Limited. All rights reserved.