Package xbird.xquery.type

Examples of xbird.xquery.type.Type


    public static boolean instanceOf(final Sequence<? extends Item> value, final Type type) {
        final Occurrence occ = type.quantifier();
        if(value.isEmpty()) {
            return occ.accepts(Occurrence.OCC_ZERO.getAlignment());
        }
        final Type expected = (type instanceof SequenceType) ? ((SequenceType) type).prime() : type;
        int count = 0;
        final IFocus<? extends Item> valueItor = value.iterator();
        for(Item it : valueItor) {
            final Type actual = it.getType();
            if(!subtypeOf(actual, expected)) {
                valueItor.closeQuietly();
                return false;
            }
            count++;
View Full Code Here


        this._evalPocily = (EvaluationPolicy) in.readObject();
    }

    public void writeExternal(ObjectOutput out) throws IOException {
        _funcName.writeExternal(out);
        final Type returnType = _returnType;
        if(returnType == null) {
            out.writeBoolean(false);
        } else {
            out.writeBoolean(true);
            out.writeObject(returnType);
View Full Code Here

        final int arity = params.size();
        final FunctionSignature sig = getFunctionSignature(arity);
        final Type[] expectedTypes = sig.getArgumentTypes();
        assert (expectedTypes.length == arity);
        for(int i = 0; i < arity; i++) {
            Type expected = expectedTypes[i];
            XQExpression expr = params.get(i);
            Type actual = expr.getType();
            if(!TypeUtil.subtypeOf(actual, expected)) {// REVIEWME ok
                throw new TypeError("err:XPTY0004", i + "th parameter type '" + actual
                        + "' does not match to the expected argument type '" + expected + '\'');
            }
        }
View Full Code Here

            }
            XQExpression p = _parameters.get(i);
            buf.append(p.toString());
        }
        buf.append(") ");
        Type retType = getReturnType();
        if(retType != null) {
            buf.append("as ");
            buf.append(retType.toString());
        }
        buf.append("{\n");
        buf.append(_bodyExpression.toString());
        buf.append("\n}");
        return buf.toString();
View Full Code Here

        if(_bodyExpression == null) {
            throw new IllegalStateException("Expression is not binded!");
        }
        XQExpression analyzed = _bodyExpression.staticAnalysis(statEnv);
        this._bodyExpression = analyzed;
        final Type inferredType = analyzed.getType();
        if(_returnType == Untyped.UNTYPED) {
            this._returnType = inferredType;
        }
        return this;
    }
View Full Code Here

        super(SYMBOL, BooleanType.BOOLEAN);
    }

    protected FunctionSignature[] signatures() {
        final FunctionSignature[] s = new FunctionSignature[2];
        Type strq = TypeRegistry.safeGet("xs:string?");
        s[0] = new FunctionSignature(getName(), new Type[] { strq });
        s[1] = new FunctionSignature(getName(), new Type[] { strq, NodeType.ANYNODE });
        return s;
    }
View Full Code Here

        if(arglen == -1) {
            this._argumentTypes = null;
        } else {
            final Type[] argumentTypes = new Type[arglen];
            for(int i = 0; i < arglen; i++) {
                Type t = (Type) in.readObject();
                argumentTypes[i] = t;
            }
        }
        this._arity = in.readInt();
    }
View Full Code Here

        super(SYMBOL, StringType.STRING);
    }

    protected FunctionSignature[] signatures() {
        final FunctionSignature[] s = new FunctionSignature[2];
        Type strq = TypeRegistry.safeGet("xs:string?");
        s[0] = new FunctionSignature(getName(), new Type[] { strq, StringType.STRING,
                StringType.STRING });
        s[1] = new FunctionSignature(getName(), new Type[] { strq, StringType.STRING,
                StringType.STRING, StringType.STRING });
        return s;
View Full Code Here

        }
        // Returns the empty sequence if the node is not a document node.
        // Otherwise, returns the value of the dm:document-uri accessor of the document node.
        assert (argv.size() == 1);
        Item arg = argv.getItem(0);
        Type type = arg.getType();
        if(!TypeUtil.subtypeOf(type, DocumentTest.ANY_DOCUMENT)) {
            return ValueSequence.EMPTY_SEQUENCE;
        }
        final String docuri;
        if(arg instanceof DTMDocument) {
View Full Code Here

        super(SYMBOL, TypeRegistry.safeGet("xs:anyURI?"));
    }

    protected FunctionSignature[] signatures() {
        final FunctionSignature[] s = new FunctionSignature[2];
        Type str = TypeRegistry.safeGet("xs:string?");
        s[0] = new FunctionSignature(getName(), new Type[] { str });
        s[1] = new FunctionSignature(getName(), new Type[] { str, StringType.STRING });
        return s;
    }
View Full Code Here

TOP

Related Classes of xbird.xquery.type.Type

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.