Package net.sf.saxon.value

Examples of net.sf.saxon.value.SequenceType


        int newcard = cardinality & getCardinality();
        if (newcard==0) {
            // this will probably lead to a type error later
            newcard = getCardinality();
        }
        SequenceType seqType = SequenceType.makeSequenceType(newItemType, newcard);
        setStaticType(seqType, constantValue, properties);
    }
View Full Code Here


        // "some" and "every" have no ordering constraints

        Optimizer opt = visitor.getConfiguration().getOptimizer();
        sequence = ExpressionTool.unsorted(opt, sequence, false);

        SequenceType decl = getRequiredType();
        SequenceType sequenceType = SequenceType.makeSequenceType(decl.getPrimaryType(),
                                             StaticProperty.ALLOWS_ZERO_OR_MORE);
        RoleLocator role = new RoleLocator(RoleLocator.VARIABLE, getVariableQName(), 0);
        //role.setSourceLocator(this);
        sequence = TypeChecker.strictTypeCheck(
                                sequence, sequenceType, role, visitor.getStaticContext());
View Full Code Here

        int loc = exec.getLocationMap().allocateLocationId(systemId, lineNumber);
        var.setLocationId(loc);
        var.setContainer(var);

        final SequenceType type = getRequiredType();
        Iterator iter = references.iterator();
        while (iter.hasNext()) {
            BindingReference ref = (BindingReference)iter.next();
            ref.fixup(var);
            Value constantValue = null;
            int properties = 0;
            Expression select = value;
            if (select instanceof Literal && !isParameter) {
                // we can't rely on the constant value because it hasn't yet been type-checked,
                // which could change it (eg by numeric promotion). Rather than attempt all the type-checking
                // now, we do a quick check. See test bug64
                int relation = th.relationship(select.getItemType(th), type.getPrimaryType());
                if (relation == TypeHierarchy.SAME_TYPE || relation == TypeHierarchy.SUBSUMED_BY) {
                    constantValue = ((Literal)select).getValue();
                }
            }
            if (select != null) {
View Full Code Here

    public XQSequenceType getStaticResultType() throws XQException {
        checkNotClosed();
        Expression exp = expression.getExpression();    // unwrap two layers!
        ItemType itemType = exp.getItemType(connection.getConfiguration().getTypeHierarchy());
        int cardinality = exp.getCardinality();
        SequenceType staticType = SequenceType.makeSequenceType(itemType, cardinality);
        return new SaxonXQSequenceType(staticType, connection.getConfiguration());
    }
View Full Code Here

            indexed = true;
        }

        LetExpression let = new LetExpression();
        let.setVariableQName(new StructuredQName("zz", NamespaceConstant.SAXON, "zz" + let.hashCode()));
        SequenceType type = SequenceType.makeSequenceType(child.getItemType(th), child.getCardinality());
        let.setRequiredType(type);
        ExpressionTool.copyLocationInfo(containingExpression, let);
        let.setSequence(LazyExpression.makeLazyExpression(child));
        let.setAction(containingExpression);
        let.adoptChildExpression(containingExpression);
View Full Code Here

        if (exp==null) return null;
        try {
            exp = exp.analyze(staticContext, Type.ITEM_TYPE);
            if (explaining) {
                System.err.println("Attribute '" + name + "' of element '" + getDisplayName() + "' at line " + getLineNumber() + ':');
                System.err.println("Static type: " + new SequenceType(exp.getItemType(), exp.getCardinality()));
                System.err.println("Optimized expression tree:"); exp.display(10, getNamePool(), System.err);
            }
            if (getConfiguration().getTraceListener() != null) {
                InstructionDetails details = new InstructionDetails();
                details.setConstructType(Location.XPATH_IN_XSLT);
View Full Code Here

    // TODO: this is a copy of code in XSLGeneralVariable
    private void checkAgainstRequiredType(StaticContext env)
    throws XPathException {
        RoleLocator role =
                new RoleLocator(RoleLocator.VARIABLE, variableName, 0);
        SequenceType r = requiredType;
        if (r != null) {
            // check that the expression is consistent with the required type

            if (select != null) {
                select = TypeChecker.staticTypeCheck(select, requiredType, false, role, env);
View Full Code Here

     * @param cardinality the cardinality of the argument
     */

    public static void arg(Entry e, int a, ItemType type, int cardinality) {
        try {
            e.argumentTypes[a] = new SequenceType(type, cardinality);
        } catch (ArrayIndexOutOfBoundsException err) {
            System.err.println("Internal Saxon error: Can't set argument " + a + " of " + e.name);
        }
    }
View Full Code Here

    /**
    * Notify all references to this variable of the data type
    */

    public void fixupReferences() throws TransformerConfigurationException {
        SequenceType type = getRequiredType();
        Iterator iter = references.iterator();
        while (iter.hasNext()) {
            Value constantValue = null;
            int properties = 0;
            if (this instanceof XSLVariable && !isAssignable()) {
                if (select instanceof Value) {
                    // we can't rely on the constant value because it hasn't yet been type-checked,
                    // which could change it (eg by numeric promotion). Rather than attempt all the type-checking
                    // now, we do a quick check. See test bug64
                    int relation = Type.relationship(select.getItemType(), type.getPrimaryType());
                    if (relation == Type.SAME_TYPE || relation == Type.SUBSUMED_BY) {
                        constantValue = (Value)select;
                    }
                }
                if (select != null) {
View Full Code Here

        if (requiredType == SequenceType.ANY_SEQUENCE && !isParameter) {
            // no type was declared; try to deduce a type from the value
            try {
                ItemType itemType = value.getItemType();
                int cardinality = value.getCardinality();
                requiredType = new SequenceType(itemType, cardinality);
                var.setRequiredType(requiredType);
            } catch (Exception err) {
                // exceptions can happen because references to variables and functions are still unbound
            }
        }
View Full Code Here

TOP

Related Classes of net.sf.saxon.value.SequenceType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.