com.saxonica.bytecode

## Class ValueComparisonCompiler

- java.lang.Object
- - com.saxonica.bytecode.ExpressionCompiler
  - - com.saxonica.bytecode.ToBooleanCompiler
    - - com.saxonica.bytecode.ValueComparisonCompiler

-     public class ValueComparisonCompiler
      extends ToBooleanCompiler

  Generate code for a ValueComparison

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ValueComparisonCompiler()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `compile(CompilerService compiler, Expression expression, Expression[] operands, int op, AtomicComparer comparer, boolean toItem)` This method handles both compileToBoolean and compileToItem.
    `void` | `compileToBoolean(CompilerService compiler, Expression expression)` Generate bytecode to evaluate the ValueComparison as a boolean value Precondition: none.
    `void` | `compileToItem(CompilerService compiler, Expression expression)` Generate bytecode to evaluate the expression as an Item Precondition: none.
    `static int` | `translateOperator(int op)`

    - ### Methods inherited from class com.saxonica.bytecode.ToBooleanCompiler

      `compileToIterator, compileToPush`

    - ### Methods inherited from class com.saxonica.bytecode.ExpressionCompiler

      `allocateStatic, compileItemFromInt, compileItemFromString, compileToLoop, compileToPrimitive, generateMethod, handleEmptyStringResult, 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

    - #### ValueComparisonCompiler

          public ValueComparisonCompiler()

  - ### Method Detail

    - #### compileToItem

          public void compileToItem(CompilerService compiler,
                           Expression expression)
                             throws CannotCompileException

      Generate bytecode to evaluate the expression as an Item Precondition: none. Postcondition: the stack contains either an item (the result of the expression), or null (representing an empty sequence).
      Overrides:
        `compileToItem` in class `ToBooleanCompiler`
      Parameters:
        `compiler` - the compiler service
        `expression` - the expression to be compiled
      Throws:
        `CannotCompileException`

    - #### compileToBoolean

          public void compileToBoolean(CompilerService compiler,
                              Expression expression)
                                throws CannotCompileException

      Generate bytecode to evaluate the ValueComparison as a boolean value Precondition: none. Postcondition: the stack contains an boolean value 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`

    - #### compile

          public static void compile(CompilerService compiler,
                     Expression expression,
                     Expression[] operands,
                     int op,
                     AtomicComparer comparer,
                     boolean toItem)
                              throws CannotCompileException

      This method handles both compileToBoolean and compileToItem. The difference is that in some circumstances compileToItem returns an empty sequence when compileToBoolean returns false;
      Parameters:
        `compiler` - the compiler service
        `expression` - the expression to be compiled
        `operands` -
        `op` - the Operator
        `comparer` - the AtomicComparer used to compare the two atomic values
        `toItem` - true if compiling to an Item rather than to a boolean
      Throws:
        `CannotCompileException` - if the expression cannot be compiled

    - #### translateOperator

          public static int translateOperator(int op)

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