com.saxonica.bytecode
Class SimpleNodeConstructorCompiler

java.lang.Object
  extended by com.saxonica.bytecode.ExpressionCompiler
      extended by com.saxonica.bytecode.ToIteratorCompiler
          extended by com.saxonica.bytecode.ToPushCompiler
              extended by com.saxonica.bytecode.SimpleNodeConstructorCompiler
Direct Known Subclasses:
CommentCompiler, NamespaceConstructorCompiler, ProcessingInstructionCompiler, ValueOfCompiler

public abstract class SimpleNodeConstructorCompiler
extends ToPushCompiler


Constructor Summary
SimpleNodeConstructorCompiler()
           
 
Method Summary
protected  void checkContent(CompilerService compiler, Expression expression)
          Compile code to check the content of the node, and adjust it if necessary On entry the proposed content is on the stack as a CharSequence; on exit the revised content must be on the stack as a CharSequence.
protected  void compileNodeName(CompilerService compiler, Expression expression)
          Compile code to generate the node name (if any) and leave it on the top of the stack.
 void compileToItem(CompilerService compiler, Expression expression)
          Generate bytecode to evaluate the expression as an Item Precondition: none.
 void compileToPush(CompilerService compiler, Expression expression)
          Generate bytecode to evaluate the expression in push mode Precondition: none.
protected  boolean isNamedNodeKind()
          Ask whether this instruction generates a kind of node that is named
protected  boolean isNoNodeIfEmpty(Expression expr)
          Overridable method to ask whether no node should be produced in the case that the content is empty
protected abstract  void pushNode(CompilerService compiler, Expression expression)
          Generate code to write the node to the current receiver.
 
Methods inherited from class com.saxonica.bytecode.ToPushCompiler
compileToIterator
 
Methods inherited from class com.saxonica.bytecode.ToIteratorCompiler
compileToBoolean
 
Methods inherited from class com.saxonica.bytecode.ExpressionCompiler
allocateStatic, compileItemFromInt, compileItemFromString, compileToLoop, compileToPrimitive, generateMethod, getConfiguration, handleEmptyStringResult, setConfiguration, throwXPathException, throwXPathException, unboxItem, verify, visitAnnotation, visitLineNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleNodeConstructorCompiler

public SimpleNodeConstructorCompiler()
Method Detail

compileToPush

public void compileToPush(CompilerService compiler,
                          Expression expression)
                   throws CannotCompileException
Description copied from class: ExpressionCompiler
Generate bytecode to evaluate the expression in push mode Precondition: none. Postcondition: at execution time, the stack is unchanged, and the value of the expression has been written to the current receiver

Overrides:
compileToPush in class ToIteratorCompiler
Parameters:
compiler - the compiler service
expression - the expression to be compiled
Throws:
CannotCompileException

isNoNodeIfEmpty

protected boolean isNoNodeIfEmpty(Expression expr)
Overridable method to ask whether no node should be produced in the case that the content is empty

Returns:
true if the rules for this instruction are that when the content is empty, no node is generated

checkContent

protected void checkContent(CompilerService compiler,
                            Expression expression)
Compile code to check the content of the node, and adjust it if necessary On entry the proposed content is on the stack as a CharSequence; on exit the revised content must be on the stack as a CharSequence.

Parameters:
compiler -
expression -

compileNodeName

protected void compileNodeName(CompilerService compiler,
                               Expression expression)
                        throws CannotCompileException
Compile code to generate the node name (if any) and leave it on the top of the stack. For node kinds that are always unnamed (such as comments), the stack is not changed. For node kinds that may be named or unnamed (namespace nodes), an entry is always added to the stack, which will be "" if the particular node has no name.

Throws:
CannotCompileException

pushNode

protected abstract void pushNode(CompilerService compiler,
                                 Expression expression)
Generate code to write the node to the current receiver. On entry the stack holds the current receiver, the node name (for named node kinds only) and the content (for all nodes), in general as instances of CharSequence

Parameters:
compiler -
expression -

isNamedNodeKind

protected boolean isNamedNodeKind()
Ask whether this instruction generates a kind of node that is named


compileToItem

public void compileToItem(CompilerService compiler,
                          Expression expression)
                   throws CannotCompileException
Description copied from class: ExpressionCompiler
Generate bytecode to evaluate the expression as an Item Precondition: none. Postcondition: at execution time, the stack contains either an item (the result of the expression), or null (representing an empty sequence).

Overrides:
compileToItem in class ToPushCompiler
Parameters:
compiler - the compiler service
expression - the expression to be compiled
Throws:
CannotCompileException


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