net.sf.saxon.instruct

Class Block

public class Block extends Instruction

Implements an imaginary xsl:block instruction which simply evaluates its contents. Used for top-level templates, xsl:otherwise, etc.
Constructor Summary
Block()
Method Summary
voidcheckPermittedContents(SchemaType parentType, StaticContext env, boolean whole)
Check that any elements and attributes constructed or returned by this expression are acceptable in the content model of a given complex type.
booleancreatesNewNodes()
Determine whether this instruction creates new nodes.
voiddisplay(int level, NamePool pool, PrintStream out)
Diagnostic print of expression structure.
static voiddisplayChildren(Expression[] children, int level, NamePool pool, PrintStream out)
Display the children of an instruction for diagostics
intgetCardinality()
Determine the cardinality of the expression
Expression[]getChildren()
Get the children of this instruction
intgetImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the items returned by this expression
SequenceIteratoriterate(XPathContext context)
Iterate over the results of all the child expressions
IteratoriterateSubExpressions()
static ExpressionmakeBlock(Expression e1, Expression e2)
Expressionoptimize(Optimizer opt, StaticContext env, ItemType contextItemType)
TailCallprocessLeavingTail(XPathContext context)
protected voidpromoteInst(PromotionOffer offer)
Handle promotion offers, that is, non-local tree rewrites.
voidsetChildren(Expression[] children)
Set the children of this instruction
Expressionsimplify(StaticContext env)
Simplify an expression.
ExpressiontypeCheck(StaticContext env, ItemType contextItemType)

Constructor Detail

Block

public Block()

Method Detail

checkPermittedContents

public void checkPermittedContents(SchemaType parentType, StaticContext env, boolean whole)
Check that any elements and attributes constructed or returned by this expression are acceptable in the content model of a given complex type. It's always OK to say yes, since the check will be repeated at run-time. The process of checking element and attribute constructors against the content model of a complex type also registers the type of content expected of those constructors, so the static validation can continue recursively.

createsNewNodes

public final boolean createsNewNodes()
Determine whether this instruction creates new nodes. This implementation returns true if any child instruction returns true.

display

public void display(int level, NamePool pool, PrintStream out)
Diagnostic print of expression structure. The expression is written to the System.err output stream

Parameters: level indentation level for this expression out

displayChildren

public static void displayChildren(Expression[] children, int level, NamePool pool, PrintStream out)
Display the children of an instruction for diagostics

getCardinality

public final int getCardinality()
Determine the cardinality of the expression

getChildren

public Expression[] getChildren()
Get the children of this instruction

Returns: the children of this instruction, as an array of Instruction objects. May return either a zero-length array or null if there are no children

getImplementationMethod

public int getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). This method indicates which of these methods is provided. This implementation provides both iterate() and process() methods natively.

getItemType

public final ItemType getItemType(TypeHierarchy th)
Determine the data type of the items returned by this expression

Parameters: th

Returns: the data type

iterate

public SequenceIterator iterate(XPathContext context)
Iterate over the results of all the child expressions

iterateSubExpressions

public Iterator iterateSubExpressions()

makeBlock

public static Expression makeBlock(Expression e1, Expression e2)

optimize

public Expression optimize(Optimizer opt, StaticContext env, ItemType contextItemType)

processLeavingTail

public TailCall processLeavingTail(XPathContext context)

promoteInst

protected void promoteInst(PromotionOffer offer)
Handle promotion offers, that is, non-local tree rewrites.

Parameters: offer The type of rewrite being offered

Throws: XPathException

setChildren

public void setChildren(Expression[] children)
Set the children of this instruction

Parameters: children The instructions that are children of this instruction

simplify

public Expression simplify(StaticContext env)
Simplify an expression. This performs any static optimization (by rewriting the expression as a different expression). The default implementation does nothing.

Returns: the simplified expression

Throws: XPathException if an error is discovered during expression rewriting

typeCheck

public Expression typeCheck(StaticContext env, ItemType contextItemType)