Package org.apache.commons.jxpath.ri

# Interface Compiler

All Known Implementing Classes:
  `TreeCompiler`

public interface Compiler
The Compiler APIs are completely agnostic to the actual types of objects produced and consumed by the APIs. Arguments and return values are declared as java.lang.Object.

Since objects returned by Compiler methods are passed as arguments to other Compiler methods, the descriptions of these methods use virtual types. There are four virtual object types: EXPRESSION, QNAME, STEP and NODE_TEST.

The following example illustrates this notion. This sequence compiles the XPath "foo[round(1 div 2)]/text()":

>           Object qname1 = compiler.qname(null, "foo")
>           Object expr1 = compiler.number("1");
>           Object expr2 = compiler.number("2");
>           Object expr3 = compiler.div(expr1, expr2);
>           Object expr4 = compiler.
>                   coreFunction(Compiler.FUNCTION_ROUND, new Object[]{expr3});
>           Object test1 = compiler.nodeNameTest(qname1);
>           Object step1 = compiler.
>                   step(Compiler.AXIS_CHILD, test1, new Object[]{expr4});
>           Object test2 = compiler.nodeTypeTest(Compiler.NODE_TYPE_TEXT);
>           Object step2 = compiler.nodeTypeTest(Compiler.AXIS_CHILD, test2, null);
>           Object expr5 = compiler.locationPath(false, new Object[]{step1, step2});

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `AXIS_ANCESTOR`
  Constant 4
  `static final int`
  `AXIS_ANCESTOR_OR_SELF`
  Constant 10
  `static final int`
  `AXIS_ATTRIBUTE`
  Constant 5
  `static final int`
  `AXIS_CHILD`
  Constant 2
  `static final int`
  `AXIS_DESCENDANT`
  Constant 9
  `static final int`
  `AXIS_DESCENDANT_OR_SELF`
  Constant 13
  `static final int`
  `AXIS_FOLLOWING`
  Constant 8
  `static final int`
  `AXIS_FOLLOWING_SIBLING`
  Constant 11
  `static final int`
  `AXIS_NAMESPACE`
  Constant 6
  `static final int`
  `AXIS_PARENT`
  Constant 3
  `static final int`
  `AXIS_PRECEDING`
  Constant 7
  `static final int`
  `AXIS_PRECEDING_SIBLING`
  Constant 12
  `static final int`
  `AXIS_SELF`
  Constant 1
  `static final int`
  `FUNCTION_BOOLEAN`
  Constant 18
  `static final int`
  `FUNCTION_CEILING`
  Constant 26
  `static final int`
  `FUNCTION_CONCAT`
  Constant 9
  `static final int`
  `FUNCTION_CONTAINS`
  Constant 11
  `static final int`
  `FUNCTION_COUNT`
  Constant 3
  `static final int`
  `FUNCTION_ENDS_WITH`
  Constant 31
  `static final int`
  `FUNCTION_FALSE`
  Constant 21
  `static final int`
  `FUNCTION_FLOOR`
  Constant 25
  `static final int`
  `FUNCTION_FORMAT_NUMBER`
  Constant 30
  `static final int`
  `FUNCTION_ID`
  Constant 4
  `static final int`
  `FUNCTION_KEY`
  Constant 29
  `static final int`
  `FUNCTION_LANG`
  Constant 22
  `static final int`
  `FUNCTION_LAST`
  Constant 1
  `static final int`
  `FUNCTION_LOCAL_NAME`
  Constant 5
  `static final int`
  `FUNCTION_NAME`
  Constant 7
  `static final int`
  `FUNCTION_NAMESPACE_URI`
  Constant 6
  `static final int`
  `FUNCTION_NORMALIZE_SPACE`
  Constant 16
  `static final int`
  `FUNCTION_NOT`
  Constant 19
  `static final int`
  `FUNCTION_NULL`
  Constant 28
  `static final int`
  `FUNCTION_NUMBER`
  Constant 23
  `static final int`
  `FUNCTION_POSITION`
  Constant 2
  `static final int`
  `FUNCTION_ROUND`
  Constant 27
  `static final int`
  `FUNCTION_STARTS_WITH`
  Constant 10
  `static final int`
  `FUNCTION_STRING`
  Constant 8
  `static final int`
  `FUNCTION_STRING_LENGTH`
  Constant 15
  `static final int`
  `FUNCTION_SUBSTRING`
  Constant 14
  `static final int`
  `FUNCTION_SUBSTRING_AFTER`
  Constant 13
  `static final int`
  `FUNCTION_SUBSTRING_BEFORE`
  Constant 12
  `static final int`
  `FUNCTION_SUM`
  Constant 24
  `static final int`
  `FUNCTION_TRANSLATE`
  Constant 17
  `static final int`
  `FUNCTION_TRUE`
  Constant 20
  `static final int`
  `NODE_TYPE_COMMENT`
  Constant 3
  `static final int`
  `NODE_TYPE_NODE`
  Constant 1
  `static final int`
  `NODE_TYPE_PI`
  Constant 4
  `static final int`
  `NODE_TYPE_TEXT`
  Constant 2

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `and(Object[] arguments)`
  Produces an EXPRESSION object representing logical conjunction of all arguments
  `Object`
  `divide(Object left, Object right)`
  Produces an EXPRESSION object representing left divided by right
  `Object`
  `equal(Object left, Object right)`
  Produces an EXPRESSION object representing the comparison: left equals to right
  `Object`
  `expressionPath(Object expression, Object[] predicates, Object[] steps)`
  Produces an EXPRESSION object representing a filter expression
  `Object`
  `function(int code, Object[] args)`
  Produces an EXPRESSION object representing the computation of a core function with the supplied arguments.
  `Object`
  `function(Object name, Object[] args)`
  Produces an EXPRESSION object representing the computation of a library function with the supplied arguments.
  `Object`
  `greaterThan(Object left, Object right)`
  Produces an EXPRESSION object representing the comparison: left greater than right
  `Object`
  `greaterThanOrEqual(Object left, Object right)`
  Produces an EXPRESSION object representing the comparison: left greater than or equal to right
  `Object`
  `lessThan(Object left, Object right)`
  Produces an EXPRESSION object representing the comparison: left less than right
  `Object`
  `lessThanOrEqual(Object left, Object right)`
  Produces an EXPRESSION object representing the comparison: left less than or equal to right
  `Object`
  `literal(String value)`
  Produces an EXPRESSION object that represents a string constant.
  `Object`
  `locationPath(boolean absolute, Object[] steps)`
  Produces an EXPRESSION object representing a location path
  `Object`
  `minus(Object argument)`
  Produces an EXPRESSION object representing unary negation of the argument
  `Object`
  `minus(Object left, Object right)`
  Produces an EXPRESSION object representing left minus right
  `Object`
  `mod(Object left, Object right)`
  Produces an EXPRESSION object representing left modulo right
  `Object`
  `multiply(Object left, Object right)`
  Produces an EXPRESSION object representing left multiplied by right
  `Object`
  `nodeNameTest(Object qname)`
  Produces a NODE_TEST object that represents a node name test.
  `Object`
  `nodeTypeTest(int nodeType)`
  Produces a NODE_TEST object that represents a node type test.
  `Object`
  `notEqual(Object left, Object right)`
  Produces an EXPRESSION object representing the comparison: left is not equal to right
  `Object`
  `number(String value)`
  Produces an EXPRESSION object that represents a numeric constant.
  `Object`
  `or(Object[] arguments)`
  Produces an EXPRESSION object representing logical disjunction of all arguments
  `Object`
  `processingInstructionTest(String instruction)`
  Produces a NODE_TEST object that represents a processing instruction test.
  `Object`
  `qname(String prefix, String name)`
  Produces an QNAME that represents a name with an optional prefix.
  `Object`
  `step(int axis, Object nodeTest, Object[] predicates)`
  Produces a STEP object that represents a node test.
  `Object`
  `sum(Object[] arguments)`
  Produces an EXPRESSION object representing the sum of all argumens
  `Object`
  `union(Object[] arguments)`
  Produces an EXPRESSION object representing union of all node sets
  `Object`
  `variableReference(Object qname)`
  Produces an EXPRESSION object representing variable reference

- ## Field Details

  - ### NODE_TYPE_NODE

    static final int NODE_TYPE_NODE
    Constant 1
    See Also:
      - Constant Field Values

  - ### NODE_TYPE_TEXT

    static final int NODE_TYPE_TEXT
    Constant 2
    See Also:
      - Constant Field Values

  - ### NODE_TYPE_COMMENT

    static final int NODE_TYPE_COMMENT
    Constant 3
    See Also:
      - Constant Field Values

  - ### NODE_TYPE_PI

    static final int NODE_TYPE_PI
    Constant 4
    See Also:
      - Constant Field Values

  - ### AXIS_SELF

    static final int AXIS_SELF
    Constant 1
    See Also:
      - Constant Field Values

  - ### AXIS_CHILD

    static final int AXIS_CHILD
    Constant 2
    See Also:
      - Constant Field Values

  - ### AXIS_PARENT

    static final int AXIS_PARENT
    Constant 3
    See Also:
      - Constant Field Values

  - ### AXIS_ANCESTOR

    static final int AXIS_ANCESTOR
    Constant 4
    See Also:
      - Constant Field Values

  - ### AXIS_ATTRIBUTE

    static final int AXIS_ATTRIBUTE
    Constant 5
    See Also:
      - Constant Field Values

  - ### AXIS_NAMESPACE

    static final int AXIS_NAMESPACE
    Constant 6
    See Also:
      - Constant Field Values

  - ### AXIS_PRECEDING

    static final int AXIS_PRECEDING
    Constant 7
    See Also:
      - Constant Field Values

  - ### AXIS_FOLLOWING

    static final int AXIS_FOLLOWING
    Constant 8
    See Also:
      - Constant Field Values

  - ### AXIS_DESCENDANT

    static final int AXIS_DESCENDANT
    Constant 9
    See Also:
      - Constant Field Values

  - ### AXIS_ANCESTOR_OR_SELF

    static final int AXIS_ANCESTOR_OR_SELF
    Constant 10
    See Also:
      - Constant Field Values

  - ### AXIS_FOLLOWING_SIBLING

    static final int AXIS_FOLLOWING_SIBLING
    Constant 11
    See Also:
      - Constant Field Values

  - ### AXIS_PRECEDING_SIBLING

    static final int AXIS_PRECEDING_SIBLING
    Constant 12
    See Also:
      - Constant Field Values

  - ### AXIS_DESCENDANT_OR_SELF

    static final int AXIS_DESCENDANT_OR_SELF
    Constant 13
    See Also:
      - Constant Field Values

  - ### FUNCTION_LAST

    static final int FUNCTION_LAST
    Constant 1
    See Also:
      - Constant Field Values

  - ### FUNCTION_POSITION

    static final int FUNCTION_POSITION
    Constant 2
    See Also:
      - Constant Field Values

  - ### FUNCTION_COUNT

    static final int FUNCTION_COUNT
    Constant 3
    See Also:
      - Constant Field Values

  - ### FUNCTION_ID

    static final int FUNCTION_ID
    Constant 4
    See Also:
      - Constant Field Values

  - ### FUNCTION_LOCAL_NAME

    static final int FUNCTION_LOCAL_NAME
    Constant 5
    See Also:
      - Constant Field Values

  - ### FUNCTION_NAMESPACE_URI

    static final int FUNCTION_NAMESPACE_URI
    Constant 6
    See Also:
      - Constant Field Values

  - ### FUNCTION_NAME

    static final int FUNCTION_NAME
    Constant 7
    See Also:
      - Constant Field Values

  - ### FUNCTION_STRING

    static final int FUNCTION_STRING
    Constant 8
    See Also:
      - Constant Field Values

  - ### FUNCTION_CONCAT

    static final int FUNCTION_CONCAT
    Constant 9
    See Also:
      - Constant Field Values

  - ### FUNCTION_STARTS_WITH

    static final int FUNCTION_STARTS_WITH
    Constant 10
    See Also:
      - Constant Field Values

  - ### FUNCTION_CONTAINS

    static final int FUNCTION_CONTAINS
    Constant 11
    See Also:
      - Constant Field Values

  - ### FUNCTION_SUBSTRING_BEFORE

    static final int FUNCTION_SUBSTRING_BEFORE
    Constant 12
    See Also:
      - Constant Field Values

  - ### FUNCTION_SUBSTRING_AFTER

    static final int FUNCTION_SUBSTRING_AFTER
    Constant 13
    See Also:
      - Constant Field Values

  - ### FUNCTION_SUBSTRING

    static final int FUNCTION_SUBSTRING
    Constant 14
    See Also:
      - Constant Field Values

  - ### FUNCTION_STRING_LENGTH

    static final int FUNCTION_STRING_LENGTH
    Constant 15
    See Also:
      - Constant Field Values

  - ### FUNCTION_NORMALIZE_SPACE

    static final int FUNCTION_NORMALIZE_SPACE
    Constant 16
    See Also:
      - Constant Field Values

  - ### FUNCTION_TRANSLATE

    static final int FUNCTION_TRANSLATE
    Constant 17
    See Also:
      - Constant Field Values

  - ### FUNCTION_BOOLEAN

    static final int FUNCTION_BOOLEAN
    Constant 18
    See Also:
      - Constant Field Values

  - ### FUNCTION_NOT

    static final int FUNCTION_NOT
    Constant 19
    See Also:
      - Constant Field Values

  - ### FUNCTION_TRUE

    static final int FUNCTION_TRUE
    Constant 20
    See Also:
      - Constant Field Values

  - ### FUNCTION_FALSE

    static final int FUNCTION_FALSE
    Constant 21
    See Also:
      - Constant Field Values

  - ### FUNCTION_LANG

    static final int FUNCTION_LANG
    Constant 22
    See Also:
      - Constant Field Values

  - ### FUNCTION_NUMBER

    static final int FUNCTION_NUMBER
    Constant 23
    See Also:
      - Constant Field Values

  - ### FUNCTION_SUM

    static final int FUNCTION_SUM
    Constant 24
    See Also:
      - Constant Field Values

  - ### FUNCTION_FLOOR

    static final int FUNCTION_FLOOR
    Constant 25
    See Also:
      - Constant Field Values

  - ### FUNCTION_CEILING

    static final int FUNCTION_CEILING
    Constant 26
    See Also:
      - Constant Field Values

  - ### FUNCTION_ROUND

    static final int FUNCTION_ROUND
    Constant 27
    See Also:
      - Constant Field Values

  - ### FUNCTION_NULL

    static final int FUNCTION_NULL
    Constant 28
    See Also:
      - Constant Field Values

  - ### FUNCTION_KEY

    static final int FUNCTION_KEY
    Constant 29
    See Also:
      - Constant Field Values

  - ### FUNCTION_FORMAT_NUMBER

    static final int FUNCTION_FORMAT_NUMBER
    Constant 30
    See Also:
      - Constant Field Values

  - ### FUNCTION_ENDS_WITH

    static final int FUNCTION_ENDS_WITH
    Constant 31
    See Also:
      - Constant Field Values

- ## Method Details

  - ### and

    Object and(Object[] arguments)
    Produces an EXPRESSION object representing logical conjunction of all arguments
    Parameters:
      `arguments` - are EXPRESSION objects
    Returns:
      Object

  - ### divide

    Object divide(Object left, Object right)
    Produces an EXPRESSION object representing left divided by right
    Parameters:
      `left` - is an EXPRESSION object
      `right` - is an EXPRESSION object
    Returns:
      Object

  - ### equal

    Object equal(Object left, Object right)
    Produces an EXPRESSION object representing the comparison: left equals to right
    Parameters:
      `left` - is an EXPRESSION object
      `right` - is an EXPRESSION object
    Returns:
      Object

  - ### expressionPath

    Object expressionPath(Object expression, Object[] predicates, Object[] steps)
    Produces an EXPRESSION object representing a filter expression
    Parameters:
      `expression` - is an EXPRESSION object
      `predicates` - are EXPRESSION objects
      `steps` - are STEP objects
    Returns:
      Object

  - ### function

    Object function(int code, Object[] args)
    Produces an EXPRESSION object representing the computation of a core function with the supplied arguments.
    Parameters:
      `code` - is one of FUNCTION_... constants
      `args` - are EXPRESSION objects
    Returns:
      Object

  - ### function

    Object function(Object name, Object[] args)
    Produces an EXPRESSION object representing the computation of a library function with the supplied arguments.
    Parameters:
      `name` - is a QNAME object (function name)
      `args` - are EXPRESSION objects
    Returns:
      Object

  - ### greaterThan

    Object greaterThan(Object left, Object right)
    Produces an EXPRESSION object representing the comparison: left greater than right
    Parameters:
      `left` - is an EXPRESSION object
      `right` - is an EXPRESSION object
    Returns:
      Object

  - ### greaterThanOrEqual

    Object greaterThanOrEqual(Object left, Object right)
    Produces an EXPRESSION object representing the comparison: left greater than or equal to right
    Parameters:
      `left` - is an EXPRESSION object
      `right` - is an EXPRESSION object
    Returns:
      Object

  - ### lessThan

    Object lessThan(Object left, Object right)
    Produces an EXPRESSION object representing the comparison: left less than right
    Parameters:
      `left` - is an EXPRESSION object
      `right` - is an EXPRESSION object
    Returns:
      Object

  - ### lessThanOrEqual

    Object lessThanOrEqual(Object left, Object right)
    Produces an EXPRESSION object representing the comparison: left less than or equal to right
    Parameters:
      `left` - is an EXPRESSION object
      `right` - is an EXPRESSION object
    Returns:
      Object

  - ### literal

    Object literal(String value)
    Produces an EXPRESSION object that represents a string constant.
    Parameters:
      `value` - String literal
    Returns:
      Object

  - ### locationPath

    Object locationPath(boolean absolute, Object[] steps)
    Produces an EXPRESSION object representing a location path
    Parameters:
      `absolute` - indicates whether the path is absolute
      `steps` - are STEP objects
    Returns:
      Object

  - ### minus

    Object minus(Object argument)
    Produces an EXPRESSION object representing unary negation of the argument
    Parameters:
      `argument` - is an EXPRESSION object
    Returns:
      Object

  - ### minus

    Object minus(Object left, Object right)
    Produces an EXPRESSION object representing left minus right
    Parameters:
      `left` - is an EXPRESSION object
      `right` - is an EXPRESSION object
    Returns:
      Object

  - ### mod

    Object mod(Object left, Object right)
    Produces an EXPRESSION object representing left modulo right
    Parameters:
      `left` - is an EXPRESSION object
      `right` - is an EXPRESSION object
    Returns:
      Object

  - ### multiply

    Object multiply(Object left, Object right)
    Produces an EXPRESSION object representing left multiplied by right
    Parameters:
      `left` - is an EXPRESSION object
      `right` - is an EXPRESSION object
    Returns:
      Object

  - ### nodeNameTest

    Object nodeNameTest(Object qname)
    Produces a NODE_TEST object that represents a node name test.
    Parameters:
      `qname` - is a QNAME object
    Returns:
      Object

  - ### nodeTypeTest

    Object nodeTypeTest(int nodeType)
    Produces a NODE_TEST object that represents a node type test.
    Parameters:
      `nodeType` - is a NODE_TEST object
    Returns:
      Object

  - ### notEqual

    Object notEqual(Object left, Object right)
    Produces an EXPRESSION object representing the comparison: left is not equal to right
    Parameters:
      `left` - is an EXPRESSION object
      `right` - is an EXPRESSION object
    Returns:
      Object

  - ### number

    Object number(String value)
    Produces an EXPRESSION object that represents a numeric constant.
    Parameters:
      `value` - numeric String
    Returns:
      Object

  - ### or

    Object or(Object[] arguments)
    Produces an EXPRESSION object representing logical disjunction of all arguments
    Parameters:
      `arguments` - are EXPRESSION objects
    Returns:
      Object

  - ### processingInstructionTest

    Object processingInstructionTest(String instruction)
    Produces a NODE_TEST object that represents a processing instruction test.
    Parameters:
      `instruction` - is a NODE_TEST object
    Returns:
      Object

  - ### qname

    Object qname(String prefix, String name)
    Produces an QNAME that represents a name with an optional prefix.
    Parameters:
      `prefix` - String prefix
      `name` - String name
    Returns:
      Object

  - ### step

    Object step(int axis, Object nodeTest, Object[] predicates)
    Produces a STEP object that represents a node test.
    Parameters:
      `axis` - is one of the AXIS_... constants
      `nodeTest` - is a NODE_TEST object
      `predicates` - are EXPRESSION objects
    Returns:
      Object

  - ### sum

    Object sum(Object[] arguments)
    Produces an EXPRESSION object representing the sum of all argumens
    Parameters:
      `arguments` - are EXPRESSION objects
    Returns:
      Object

  - ### union

    Object union(Object[] arguments)
    Produces an EXPRESSION object representing union of all node sets
    Parameters:
      `arguments` - are EXPRESSION objects
    Returns:
      Object

  - ### variableReference

    Object variableReference(Object qname)
    Produces an EXPRESSION object representing variable reference
    Parameters:
      `qname` - is a QNAME object
    Returns:
      Object