Package org.pdf4j.saxon.value

Examples of org.pdf4j.saxon.value.SequenceType


        }

        if (requiredType != null) {
            // if declaration is null, we've already done the type checking in a previous pass
            final TypeHierarchy th = visitor.getConfiguration().getTypeHierarchy();
            SequenceType decl = requiredType;
            SequenceType sequenceType = SequenceType.makeSequenceType(
                    decl.getPrimaryType(), StaticProperty.ALLOWS_ZERO_OR_MORE);
            RoleLocator role = new RoleLocator(RoleLocator.VARIABLE, variableName, 0
            );
            //role.setSourceLocator(this);
            sequence = TypeChecker.strictTypeCheck(
View Full Code Here


        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

    private void checkAgainstRequiredType(ExpressionVisitor visitor)
    throws XPathException {
        // Note, in some cases we are doing this twice.
        RoleLocator role = new RoleLocator(RoleLocator.VARIABLE, variableQName, 0);
        //role.setSourceLocator(this);
        SequenceType r = requiredType;
        if (r != null && select != null) {
            // check that the expression is consistent with the required type
            select = TypeChecker.staticTypeCheck(select, requiredType, false, role, visitor);
        }
    }
View Full Code Here

                            break;
                        }
                        if (param instanceof XSLParam &&
                                ((XSLParam)param).getVariableQName().equals(withParam.getVariableQName())) {
                            ok = true;
                            SequenceType required = ((XSLParam)param).getRequiredType();
                            withParam.checkAgainstRequiredType(required);
                            break;
                        }
                    }
                    if (!ok) {
View Full Code Here

            int f = annotation.getFingerprint();
            checkSchemaNamespaceImported(f, declaration);
        } else if (type instanceof CombinedNodeTest) {
            NodeTest[] tests = ((CombinedNodeTest)type).getComponentNodeTests();
            for (int i=0; i<tests.length; i++) {
                SequenceType st = SequenceType.makeSequenceType(tests[i], StaticProperty.EXACTLY_ONE);
                checkImportedType(st, declaration);
            }
        }
    }
View Full Code Here

                (theParameterTypes[0] == XPathContext.class);
            firstParam = (usesContext ? 1 : 0);
        }
        argumentConverters = new PJConverter[argument.length];
        if (firstArg != 0) {
            SequenceType st = PJConverter.getEquivalentItemType(theClass);
            if (st != null) {
                RoleLocator role = new RoleLocator(
                    RoleLocator.FUNCTION, getFunctionName(), 0);
                argument[0] = TypeChecker.staticTypeCheck(
                                argument[0], st, false, role, visitor);
            }
            argumentConverters[0] = PJConverter.allocate(
                    config, argument[0].getItemType(th), argument[0].getCardinality(), theClass);
        }
        int j = firstParam;
        for (int i = firstArg; i < argument.length; i++) {
            SequenceType st = PJConverter.getEquivalentItemType(theParameterTypes[j]);
            if (st != null) {
                RoleLocator role = new RoleLocator(
                    RoleLocator.FUNCTION, getFunctionName(), i);
                argument[i] = TypeChecker.staticTypeCheck(
                                argument[i], st, false, role, visitor);
View Full Code Here

    */

    public SequenceType getRequiredType() {
        // System.err.println("Get required type of $" + getVariableName());
        final TypeHierarchy th = getConfiguration().getTypeHierarchy();
        SequenceType defaultType = (requiredType==null ? SequenceType.ANY_SEQUENCE : requiredType);
        if (assignable) {
            return defaultType;
        } else if (requiredType != null) {
            return requiredType;
        } else if (select!=null) {
View Full Code Here

     * variable; or if the supplied value contains a node that does not belong to this Configuration
     * (or another Configuration that shares the same namePool)
     */

    public void setVariable(XPathVariable variable, ValueRepresentation value) throws XPathException {
        SequenceType requiredType = variable.getRequiredType();
        if (requiredType != SequenceType.ANY_SEQUENCE) {
            XPathException err = TypeChecker.testConformance(value, requiredType, contextObject);
            if (err != null) {
                throw err;
            }
View Full Code Here

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

    public void fixupReferences() throws XPathException {
        final SequenceType type = getRequiredType();
        final TypeHierarchy th = getConfiguration().getTypeHierarchy();
        final Iterator iter = references.iterator();
        while (iter.hasNext()) {
            Value constantValue = null;
            int properties = 0;
            if (this instanceof XSLVariable && !isAssignable()) {
                if (select instanceof Literal) {
                    // 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

TOP

Related Classes of org.pdf4j.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.