Class SquareArrayConstructor

    • Constructor Detail

      • SquareArrayConstructor

        public SquareArrayConstructor​(java.util.List<Expression> children)
        Create an array constructor with defined members
        Parameters:
        children - expressions defining the members (comma-separated subexpressions)
    • Method Detail

      • setOperanda

        protected void setOperanda​(OperandArray operanda)
        Set the data structure for the operands of this expression. This must be created during initialisation of the expression and must not be subsequently changed
        Parameters:
        operanda - the data structure for expression operands
      • getOperanda

        public OperandArray getOperanda()
        Get the data structure holding the operands of this expression.
        Returns:
        the data structure holding expression operands
      • getOperand

        public Operand getOperand​(int i)
      • operands

        public java.lang.Iterable<Operand> operands()
        Description copied from class: Expression
        Get the immediate sub-expressions of this expression, with information about the relationship of each expression to its parent expression.

        If the expression is a Callable, then it is required that the order of the operands returned by this function is the same as the order of arguments supplied to the corresponding call() method.

        Overrides:
        operands in class Expression
        Returns:
        an iterator containing the sub-expressions of this expression
      • getExpressionName

        public java.lang.String getExpressionName()
        Description copied from class: Expression
        Get a name identifying the kind of expression, in terms meaningful to a user.
        Overrides:
        getExpressionName in class Expression
        Returns:
        a name identifying the kind of expression, in terms meaningful to a user. The name will always be in the form of a lexical XML QName, and should match the name used in export() output displaying the expression.
      • getStreamerName

        public java.lang.String getStreamerName()
        Description copied from class: Expression
        Get the (partial) name of a class that supports streaming of this kind of expression
        Overrides:
        getStreamerName in class Expression
        Returns:
        the partial name of a class that can be instantiated to provide streaming support in Saxon-EE, or null if there is no such class
      • computeSpecialProperties

        protected int computeSpecialProperties()
        Description copied from class: Expression
        Compute the special properties of this expression. These properties are denoted by a bit-significant integer, possible values are in class StaticProperty. The "special" properties are properties other than cardinality and dependencies, and most of them relate to properties of node sequences, for example whether the nodes are in document order.
        Overrides:
        computeSpecialProperties in class Expression
        Returns:
        the special properties, as a bit-significant integer
      • equals

        public boolean equals​(java.lang.Object other)
        Is this expression the same as another expression?
        Overrides:
        equals in class Expression
        Parameters:
        other - the expression to be compared with this one
        Returns:
        true if the two expressions are statically equivalent
      • computeHashCode

        protected int computeHashCode()
        Hashcode supporting equals()
        Overrides:
        computeHashCode in class Expression
        Returns:
        a computed hash code
      • typeCheck

        public Expression typeCheck​(ExpressionVisitor visitor,
                                    ContextItemStaticInfo contextInfo)
                             throws XPathException
        Description copied from class: Expression
        Perform type checking of an expression and its subexpressions. This is the second phase of static optimization.

        This checks statically that the operands of the expression have the correct type; if necessary it generates code to do run-time type checking or type conversion. A static type error is reported only if execution cannot possibly succeed, that is, if a run-time type error is inevitable. The call may return a modified form of the expression.

        This method is called after all references to functions and variables have been resolved to the declaration of the function or variable. However, the types of such functions and variables may not be accurately known if they have not been explicitly declared.

        Overrides:
        typeCheck in class Expression
        Parameters:
        visitor - an expression visitor
        contextInfo - Information available statically about the context item: whether it is (possibly) absent; its static type; its streaming posture.
        Returns:
        the original expression, rewritten to perform necessary run-time type checks, and to perform other type-related optimizations
        Throws:
        XPathException - if an error is discovered during this phase (typically a type error)
      • optimize

        public Expression optimize​(ExpressionVisitor visitor,
                                   ContextItemStaticInfo contextInfo)
                            throws XPathException
        Description copied from class: Expression
        Perform optimisation of an expression and its subexpressions. This is the third and final phase of static optimization.

        This method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.

        Overrides:
        optimize in class Expression
        Parameters:
        visitor - an expression visitor
        contextInfo - the static type of "." at the point where this expression is invoked. The parameter is set to null if it is known statically that the context item will be undefined. If the type of the context item is not known statically, the argument is set to Type.ITEM_TYPE
        Returns:
        the original expression, rewritten if appropriate to optimize execution
        Throws:
        XPathException - if an error is discovered during this phase (typically a type error)
      • copy

        public Expression copy​(RebindingMap rebindings)
        Copy an expression. This makes a deep copy.
        Specified by:
        copy in class Expression
        Parameters:
        rebindings - variables that need to be re-bound
        Returns:
        the copy of the original expression
      • getItemType

        public final ItemType getItemType()
        Determine the data type of the items returned by this expression
        Specified by:
        getItemType in class Expression
        Returns:
        the data type
      • getStaticUType

        public UType getStaticUType​(UType contextItemType)
        Get the static type of the expression as a UType, following precisely the type inference rules defined in the XSLT 3.0 specification.
        Overrides:
        getStaticUType in class Expression
        Parameters:
        contextItemType - the static type of the context item
        Returns:
        the static item type of the expression according to the XSLT 3.0 defined rules
      • export

        public void export​(ExpressionPresenter out)
                    throws XPathException
        Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.
        Specified by:
        export in interface ExportAgent
        Specified by:
        export in class Expression
        Parameters:
        out - the expression presenter used to display the structure
        Throws:
        XPathException - if the export fails, for example if an expression is found that won't work in the target environment.
      • toShortString

        public java.lang.String toShortString()
        Description copied from class: Expression
        Produce a short string identifying the expression for use in error messages
        Overrides:
        toShortString in class Expression
        Returns:
        a short string, sufficient to identify the expression
      • toString

        public java.lang.String toString()
        Description copied from class: Expression

        The toString() method for an expression attempts to give a representation of the expression in an XPath-like form.

        For subclasses of Expression that represent XPath expressions, the result should always be a string that parses as an XPath 3.0 expression. The expression produced should be equivalent to the original making certain assumptions about the static context. In general the expansion will make no assumptions about namespace bindings, except that (a) the prefix "xs" is used to refer to the XML Schema namespace, and (b) the default function namespace is assumed to be the "fn" namespace.

        In the case of XSLT instructions and XQuery expressions, the toString() method gives an abstracted view of the syntax that is not designed in general to be parseable.

        Overrides:
        toString in class Expression
        Returns:
        a representation of the expression as a string
      • ping

        public void ping()
        Description copied from interface: Pingable
        Notify that an event has occurred; the recipient is expected to know what this means.
        Specified by:
        ping in interface Pingable
      • makeArray

        protected ArrayItem makeArray​(java.util.List<GroundedValue> members)
        Construct an array, given a list of members
        Parameters:
        members - the members of the array
        Returns:
        the constructed array
      • evaluateItem

        public Item evaluateItem​(XPathContext context)
                          throws XPathException
        Evaluate an expression as a single item. This always returns either a single Item or null (denoting the empty sequence). No conversion is done. This method should not be used unless the static type of the expression is a subtype of "item" or "item?": that is, it should not be called if the expression may return a sequence. There is no guarantee that this condition will be detected.
        Overrides:
        evaluateItem in class Expression
        Parameters:
        context - The context in which the expression is to be evaluated
        Returns:
        the node or atomic value that results from evaluating the expression; or null to indicate that the result is an empty sequence
        Throws:
        XPathException - if any dynamic error occurs evaluating the expression