Class TreeCompiler

  • All Implemented Interfaces:
    Compiler

    public class TreeCompiler
    extends java.lang.Object
    implements Compiler
    Version:
    $Revision: 652845 $ $Date: 2008-05-02 12:46:46 -0500 (Fri, 02 May 2008) $
    Author:
    Dmitri Plotnikov
    • Field Detail

      • QNAME_NAME

        private static final QName QNAME_NAME
    • Constructor Detail

      • TreeCompiler

        public TreeCompiler()
    • Method Detail

      • number

        public java.lang.Object number​(java.lang.String value)
        Description copied from interface: Compiler
        Produces an EXPRESSION object that represents a numeric constant.
        Specified by:
        number in interface Compiler
        Parameters:
        value - numeric String
        Returns:
        Object
      • literal

        public java.lang.Object literal​(java.lang.String value)
        Description copied from interface: Compiler
        Produces an EXPRESSION object that represents a string constant.
        Specified by:
        literal in interface Compiler
        Parameters:
        value - String literal
        Returns:
        Object
      • qname

        public java.lang.Object qname​(java.lang.String prefix,
                                      java.lang.String name)
        Description copied from interface: Compiler
        Produces an QNAME that represents a name with an optional prefix.
        Specified by:
        qname in interface Compiler
        Parameters:
        prefix - String prefix
        name - String name
        Returns:
        Object
      • sum

        public java.lang.Object sum​(java.lang.Object[] arguments)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing the sum of all argumens
        Specified by:
        sum in interface Compiler
        Parameters:
        arguments - are EXPRESSION objects
        Returns:
        Object
      • minus

        public java.lang.Object minus​(java.lang.Object left,
                                      java.lang.Object right)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing left minus right
        Specified by:
        minus in interface Compiler
        Parameters:
        left - is an EXPRESSION object
        right - is an EXPRESSION object
        Returns:
        Object
      • multiply

        public java.lang.Object multiply​(java.lang.Object left,
                                         java.lang.Object right)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing left multiplied by right
        Specified by:
        multiply in interface Compiler
        Parameters:
        left - is an EXPRESSION object
        right - is an EXPRESSION object
        Returns:
        Object
      • divide

        public java.lang.Object divide​(java.lang.Object left,
                                       java.lang.Object right)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing left divided by right
        Specified by:
        divide in interface Compiler
        Parameters:
        left - is an EXPRESSION object
        right - is an EXPRESSION object
        Returns:
        Object
      • mod

        public java.lang.Object mod​(java.lang.Object left,
                                    java.lang.Object right)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing left modulo right
        Specified by:
        mod in interface Compiler
        Parameters:
        left - is an EXPRESSION object
        right - is an EXPRESSION object
        Returns:
        Object
      • lessThan

        public java.lang.Object lessThan​(java.lang.Object left,
                                         java.lang.Object right)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing the comparison: left less than right
        Specified by:
        lessThan in interface Compiler
        Parameters:
        left - is an EXPRESSION object
        right - is an EXPRESSION object
        Returns:
        Object
      • lessThanOrEqual

        public java.lang.Object lessThanOrEqual​(java.lang.Object left,
                                                java.lang.Object right)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing the comparison: left less than or equal to right
        Specified by:
        lessThanOrEqual in interface Compiler
        Parameters:
        left - is an EXPRESSION object
        right - is an EXPRESSION object
        Returns:
        Object
      • greaterThan

        public java.lang.Object greaterThan​(java.lang.Object left,
                                            java.lang.Object right)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing the comparison: left greater than right
        Specified by:
        greaterThan in interface Compiler
        Parameters:
        left - is an EXPRESSION object
        right - is an EXPRESSION object
        Returns:
        Object
      • greaterThanOrEqual

        public java.lang.Object greaterThanOrEqual​(java.lang.Object left,
                                                   java.lang.Object right)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing the comparison: left greater than or equal to right
        Specified by:
        greaterThanOrEqual in interface Compiler
        Parameters:
        left - is an EXPRESSION object
        right - is an EXPRESSION object
        Returns:
        Object
      • equal

        public java.lang.Object equal​(java.lang.Object left,
                                      java.lang.Object right)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing the comparison: left equals to right
        Specified by:
        equal in interface Compiler
        Parameters:
        left - is an EXPRESSION object
        right - is an EXPRESSION object
        Returns:
        Object
      • notEqual

        public java.lang.Object notEqual​(java.lang.Object left,
                                         java.lang.Object right)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing the comparison: left is not equal to right
        Specified by:
        notEqual in interface Compiler
        Parameters:
        left - is an EXPRESSION object
        right - is an EXPRESSION object
        Returns:
        Object
      • minus

        public java.lang.Object minus​(java.lang.Object argument)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing unary negation of the argument
        Specified by:
        minus in interface Compiler
        Parameters:
        argument - is an EXPRESSION object
        Returns:
        Object
      • variableReference

        public java.lang.Object variableReference​(java.lang.Object qName)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing variable reference
        Specified by:
        variableReference in interface Compiler
        Parameters:
        qName - is a QNAME object
        Returns:
        Object
      • function

        public java.lang.Object function​(int code,
                                         java.lang.Object[] args)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing the computation of a core function with the supplied arguments.
        Specified by:
        function in interface Compiler
        Parameters:
        code - is one of FUNCTION_... constants
        args - are EXPRESSION objects
        Returns:
        Object
      • function

        public java.lang.Object function​(java.lang.Object name,
                                         java.lang.Object[] args)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing the computation of a library function with the supplied arguments.
        Specified by:
        function in interface Compiler
        Parameters:
        name - is a QNAME object (function name)
        args - are EXPRESSION objects
        Returns:
        Object
      • and

        public java.lang.Object and​(java.lang.Object[] arguments)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing logical conjunction of all arguments
        Specified by:
        and in interface Compiler
        Parameters:
        arguments - are EXPRESSION objects
        Returns:
        Object
      • or

        public java.lang.Object or​(java.lang.Object[] arguments)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing logical disjunction of all arguments
        Specified by:
        or in interface Compiler
        Parameters:
        arguments - are EXPRESSION objects
        Returns:
        Object
      • union

        public java.lang.Object union​(java.lang.Object[] arguments)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing union of all node sets
        Specified by:
        union in interface Compiler
        Parameters:
        arguments - are EXPRESSION objects
        Returns:
        Object
      • locationPath

        public java.lang.Object locationPath​(boolean absolute,
                                             java.lang.Object[] steps)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing a location path
        Specified by:
        locationPath in interface Compiler
        Parameters:
        absolute - indicates whether the path is absolute
        steps - are STEP objects
        Returns:
        Object
      • expressionPath

        public java.lang.Object expressionPath​(java.lang.Object expression,
                                               java.lang.Object[] predicates,
                                               java.lang.Object[] steps)
        Description copied from interface: Compiler
        Produces an EXPRESSION object representing a filter expression
        Specified by:
        expressionPath in interface Compiler
        Parameters:
        expression - is an EXPRESSION object
        predicates - are EXPRESSION objects
        steps - are STEP objects
        Returns:
        Object
      • nodeNameTest

        public java.lang.Object nodeNameTest​(java.lang.Object qname)
        Description copied from interface: Compiler
        Produces a NODE_TEST object that represents a node name test.
        Specified by:
        nodeNameTest in interface Compiler
        Parameters:
        qname - is a QNAME object
        Returns:
        Object
      • nodeTypeTest

        public java.lang.Object nodeTypeTest​(int nodeType)
        Description copied from interface: Compiler
        Produces a NODE_TEST object that represents a node type test.
        Specified by:
        nodeTypeTest in interface Compiler
        Parameters:
        nodeType - is a NODE_TEST object
        Returns:
        Object
      • processingInstructionTest

        public java.lang.Object processingInstructionTest​(java.lang.String instruction)
        Description copied from interface: Compiler
        Produces a NODE_TEST object that represents a processing instruction test.
        Specified by:
        processingInstructionTest in interface Compiler
        Parameters:
        instruction - is a NODE_TEST object
        Returns:
        Object
      • step

        public java.lang.Object step​(int axis,
                                     java.lang.Object nodeTest,
                                     java.lang.Object[] predicates)
        Description copied from interface: Compiler
        Produces a STEP object that represents a node test.
        Specified by:
        step in interface Compiler
        Parameters:
        axis - is one of the AXIS_... constants
        nodeTest - is a NODE_TEST object
        predicates - are EXPRESSION objects
        Returns:
        Object
      • toExpressionArray

        private Expression[] toExpressionArray​(java.lang.Object[] array)
        Get an Object[] as an Expression[].
        Parameters:
        array - Object[]
        Returns:
        Expression[]
      • toStepArray

        private Step[] toStepArray​(java.lang.Object[] array)
        Get an Object[] as a Step[].
        Parameters:
        array - Object[]
        Returns:
        Step[]
      • isNameAttributeTest

        private boolean isNameAttributeTest​(Expression arg)
        Learn whether arg is a name attribute test.
        Parameters:
        arg - Expression to test
        Returns:
        boolean