com.saxonica.bytecode
Class ContainsCompiler

java.lang.Object
  extended by com.saxonica.bytecode.ExpressionCompiler
      extended by com.saxonica.bytecode.ToBooleanCompiler
          extended by com.saxonica.bytecode.ContainsCompiler

public class ContainsCompiler
extends ToBooleanCompiler

Generate bytecode for a call on fn:contains


Constructor Summary
ContainsCompiler()
           
 
Method Summary
 void compileToBoolean(CompilerService compiler, Expression expression)
          Generate bytecode to evaluate the expression as a boolean Precondition: none.
protected static void returnIfEmpty(CompilerService compiler, Expression arg, LabelInfo returnLabel, int popsNeeded)
          Utility method for use by subclasses to generate code that causes an boolean result to be returned if the first argument is an empty sequence or zero-length string.
static void useDynamicCollation(CompilerService compiler, CollatingFunction function, StringCollator stringCollator)
          Common code for handling non-standard collations in starts-with and similar functions.
 
Methods inherited from class com.saxonica.bytecode.ToBooleanCompiler
compileToItem, compileToIterator, compileToPush
 
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

ContainsCompiler

public ContainsCompiler()
Method Detail

compileToBoolean

public void compileToBoolean(CompilerService compiler,
                             Expression expression)
                      throws CannotCompileException
Description copied from class: ExpressionCompiler
Generate bytecode to evaluate the expression as a boolean Precondition: none. Postcondition: at execution time, the stack contains an integer (0=false, 1=true) representing the result of the expression

Specified by:
compileToBoolean in class ExpressionCompiler
Parameters:
compiler - the compiler service
expression - the expression to be compiled
Throws:
CannotCompileException

returnIfEmpty

protected static void returnIfEmpty(CompilerService compiler,
                                    Expression arg,
                                    LabelInfo returnLabel,
                                    int popsNeeded)
Utility method for use by subclasses to generate code that causes an boolean result to be returned if the first argument is an empty sequence or zero-length string. Precondition: the value of the first argument is on the stack, as a CharSequence Postcondition: either the control has jumped to the return label with the given result on the stack, or control drops through with the value of the first argument still on the stack (as supplied).

Parameters:
compiler - the compiler
arg - the first argument
returnLabel - the label to jump to if the argument is an empty sequence or zero-length string
popsNeeded - the number of items to pop from the stack if jumping to the return label

useDynamicCollation

public static void useDynamicCollation(CompilerService compiler,
                                       CollatingFunction function,
                                       StringCollator stringCollator)
                                throws CannotCompileException
Common code for handling non-standard collations in starts-with and similar functions. This is used both when the collation is explicitly specified and when it is dynamically computed. On exit a StringCollator will have been added to the stack.

Parameters:
compiler -
function -
stringCollator -
Throws:
CannotCompileException


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