All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.saxon.expr.instruct.LocalParamBlock Maven / Gradle / Ivy

There is a newer version: 10.5
Show newest version
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2013 Saxonica Limited.
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
// This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

package net.sf.saxon.expr.instruct;



import net.sf.saxon.expr.Expression;
import net.sf.saxon.expr.StaticProperty;
import net.sf.saxon.expr.XPathContext;
import net.sf.saxon.expr.parser.ExpressionVisitor;
import net.sf.saxon.expr.parser.PromotionOffer;
import net.sf.saxon.trace.ExpressionPresenter;
import net.sf.saxon.trans.XPathException;
import net.sf.saxon.type.ErrorType;
import net.sf.saxon.type.ItemType;
import net.sf.saxon.type.TypeHierarchy;

import java.util.Arrays;
import java.util.Iterator;


/**
* Represents the set of xsl:param elements at the start of an xsl:iterate instruction
*/

public class LocalParamBlock extends Instruction {

    private LocalParamSetter[] children;

    /**
     * Create the block of parameters
     * @param params the parameters
     */

    public LocalParamBlock(LocalParamSetter[] params) {
        this.children = params;
        for (LocalParamSetter child : children) {
            adoptChildExpression(child);
        }
    }

    public String getExpressionName() {
        return "block";
    }

    /**
    * Get the children of this instruction
    * @return the children of this instruction, as an array of Instruction objects. May return
     * a zero-length array if there are no children
    */

    public LocalParamSetter[] getChildren() {
        return children;
    }


    public int computeSpecialProperties() {
        return 0;
    }

    /*@NotNull*/
    public Iterator iterateSubExpressions() {
        return Arrays.asList((Expression[])children).iterator();
    }

    /**
     * Replace one subexpression by a replacement subexpression
     * @param original the original subexpression
     * @param replacement the replacement subexpression
     * @return true if the original subexpression is found
     */

    public boolean replaceSubExpression(Expression original, Expression replacement) {
        boolean found = false;
        if (replacement instanceof LocalParamSetter) {
            for (int c=0; c




© 2015 - 2024 Weber Informatics LLC | Privacy Policy