com.saxonica.codegen
Class TreatFnCompiler

java.lang.Object
  extended by com.saxonica.codegen.ExpressionCompiler
      extended by com.saxonica.codegen.SingletonExpressionCompiler
          extended by com.saxonica.codegen.TreatFnCompiler

public class TreatFnCompiler
extends SingletonExpressionCompiler

Generate Java code to implement the "treat as" functions exactly-one, etc. These functions essentially do nothing other than returning their operands; the work is all done in checking that the arguments are consistent with the function signature.


Constructor Summary
TreatFnCompiler()
           
 
Method Summary
 void compileAsLoop(CompilerService compiler, Expression expr, LoopAction action)
          Compile an XPath expression in the form of a loop.
 void compilePush(CompilerService compiler, Expression exp)
          Generate Java code to execute the expression in push mode, that is, code to write events to the current output Receiver
 String compileToItem(CompilerService compiler, Expression expr)
          Generate Java code to evaluate the expression as an Item
 String compileToIterator(CompilerService compiler, Expression exp)
          Generate Java code to evaluate the expression as a SequenceIterator
 String compileToValueRepresentation(CompilerService compiler, Expression expr)
          Generate Java code to evaluate the expression as a ValueRepresentation
 
Methods inherited from class com.saxonica.codegen.SingletonExpressionCompiler
compileToCharSequence, compileToEffectiveBooleanValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreatFnCompiler

public TreatFnCompiler()
Method Detail

compileToItem

public String compileToItem(CompilerService compiler,
                            Expression expr)
Description copied from class: ExpressionCompiler
Generate Java code to evaluate the expression as an Item

Specified by:
compileToItem in class ExpressionCompiler
Parameters:
compiler - the compiler service
expr - the expression to be compiled
Returns:
a simple Java expression (usually the name of a variable that has been declared) which will be of class Item, and which will hold the value of the expression at run-time (or hold null, representing an empty sequence).

compilePush

public void compilePush(CompilerService compiler,
                        Expression exp)
Description copied from class: ExpressionCompiler
Generate Java code to execute the expression in push mode, that is, code to write events to the current output Receiver

Overrides:
compilePush in class SingletonExpressionCompiler
Parameters:
compiler - the compiler service
exp - the expression to be compiled

compileToIterator

public String compileToIterator(CompilerService compiler,
                                Expression exp)
Description copied from class: ExpressionCompiler
Generate Java code to evaluate the expression as a SequenceIterator

Overrides:
compileToIterator in class SingletonExpressionCompiler
Parameters:
compiler - the compiler service
exp - the XPath expression to be compiled
Returns:
a simple Java expression (usually the name of a variable that has been declared) which will be of class SequenceIterator, and which at run-time will hold an iterator over the the value of the XPath expression

compileAsLoop

public void compileAsLoop(CompilerService compiler,
                          Expression expr,
                          LoopAction action)
Description copied from class: ExpressionCompiler
Compile an XPath expression in the form of a loop. This generates Java code that loops over the items in the result of the expression; the body of the loop is constructed by a callback to the supplied LoopAction (which will handle nested expressions)

Overrides:
compileAsLoop in class ExpressionCompiler
Parameters:
compiler - the CompilerService
expr - the XPath expression to be compiled
action - the action to be taken to compile code that processes each item in the sequence returned by the XPath expression

compileToValueRepresentation

public String compileToValueRepresentation(CompilerService compiler,
                                           Expression expr)
Description copied from class: ExpressionCompiler
Generate Java code to evaluate the expression as a ValueRepresentation

Overrides:
compileToValueRepresentation in class ExpressionCompiler
Parameters:
compiler - the compiler service
expr - the expression to be compiled
Returns:
a simple Java expression (usually the name of a variable that has been declared) which will be of class ValueRepresentation, and which at run-time will hold the value of the expression


Copyright (C) Michael H. Kay. All rights reserved.