Package xbird.xquery.type

Examples of xbird.xquery.type.Type


        super(SYMBOL, StringType.STRING);
    }

    protected FunctionSignature[] signatures() {
        final FunctionSignature[] s = new FunctionSignature[4];
        Type anyatom = TypeRegistry.safeGet("xs:anyAtomicType?");
        s[0] = new FunctionSignature(getName(), new Type[] { anyatom, anyatom });
        s[1] = new FunctionSignature(getName(), new Type[] { anyatom, anyatom, anyatom });
        s[2] = new FunctionSignature(getName(), new Type[] { anyatom, anyatom, anyatom, anyatom });
        s[3] = new FunctionSignature(getName(), new Type[] { anyatom, anyatom, anyatom, anyatom,
                anyatom });
View Full Code Here


            return op.eval(dynEnv, sum, divby);
        } else if(firstItem instanceof DurationValue) {
            // Duration values must either all be xdt:yearMonthDuration values
            // or must all be xdt:dayTimeDuration values.
            DurationValue sum = (DurationValue) firstItem;
            Type firstType = firstItem.getType();
            assert (firstType != null);
            int size;
            for(size = 1; argItor.hasNext(); size++) {
                Item toadd = argItor.next();
                if(toadd instanceof DurationValue) {
View Full Code Here

            this._opr = opr;
            this._pkeyExprs = persistKeyExprs;
            this._skeyExprs = searchKeyExprs;
            final List<Type> keyTypes = new ArrayList<Type>(persistKeyExprs.size());
            for(XQExpression keyexpr : persistKeyExprs) {
                final Type t = keyexpr.getType();
                if(!(t instanceof NodeType) && !(t instanceof AtomicType)) {
                    keyTypes.add(StringType.STRING);
                } else {
                    keyTypes.add(t);
                }
View Full Code Here

        private Item mapArgument(Item item, int index, DynamicContext dynEnv)
                throws XQueryException {
            if(_isNodeComp) {
                return item;
            }
            final Type t = _keyTypes.get(index);
            if(t == StringType.STRING) {
                return new XString(item.stringValue());
            }
            final AtomicValue it = (item instanceof AtomicValue) ? (AtomicValue) item
                    : new XString(item.stringValue());
View Full Code Here

        super(SYMBOL, TypeRegistry.safeGet("xs:anyAtomicType?")); // TODO correct type
    }

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

            return sum;
        } else if(firstItem instanceof DurationValue) {
            // Duration values must either all be xdt:yearMonthDuration values
            // or must all be xdt:dayTimeDuration values.
            DurationValue sum = (DurationValue) firstItem;
            Type firstType = firstItem.getType();
            assert (firstType != null);
            while(argItor.hasNext()) {
                Item toadd = argItor.next();
                if(toadd instanceof DurationValue) {
                    throw new DynamicError("err:FORG0006", "Duration values must all be `"
View Full Code Here

    public XQExpression staticAnalysis(StaticContext statEnv) throws XQueryException {
        if(!_analyzed) {
            this._analyzed = true;
            XQExpression analyzed = _expr.staticAnalysis(statEnv);
            Type inferredType = analyzed.getType();
            if(!TypeUtil.subtypeOf(inferredType, _type)) {
                reportError("err:XPTY0004", "Declared type '" + _type
                        + "' does not accept inferred type '" + inferredType + '\'');
            }
            this._expr = analyzed;
View Full Code Here

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

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

            firstItem = ((UntypedAtomicValue) firstItem).castAs(DoubleType.DOUBLE, dynEnv);
        }
        if(!argItor.hasNext()) {
            return firstItem;
        }
        final Type firstType = firstItem.getType();
        if(firstItem instanceof XNumber) {
            XNumber max = (XNumber) firstItem;
            // If the converted sequence contains the value NaN, the value NaN is returned.
            if(max.isNaN()) {
                return max;
            }
            while(argItor.hasNext()) {
                Item it = argItor.next();
                if(it instanceof UntypedAtomicValue) {
                    it = ((UntypedAtomicValue) it).castAs(DoubleType.DOUBLE, dynEnv);
                } else if(!(it instanceof XNumber)) {
                    throw new DynamicError("err:FORG0006", "fs:plus(" + max.getType() + ", "
                            + it.getType() + ") is not defined");
                }
                XNumber cmp = (XNumber) it;
                if(cmp.isNaN()) {
                    return cmp;
                }
                if(cmp.compareTo(max) > 0) {
                    max = cmp;
                }
            }
            return max;
        } else if(firstItem instanceof DurationValue) {
            // Duration values must either all be xdt:yearMonthDuration values
            // or must all be xdt:dayTimeDuration values.
            DurationValue max = (DurationValue) firstItem;
            while(argItor.hasNext()) {
                Item it = argItor.next();
                if(it instanceof DurationValue) {
                    throw new DynamicError("err:FORG0006", "Duration values must all be `"
                            + firstType + "`, but found `" + it.getType() + "`");
                }
                DurationValue cmp = (DurationValue) it;
                if(cmp.compareTo(max) > 0) {
                    max = cmp;
                }
            }
            return max;
        } else if(TypeUtil.subtypeOf(firstType, StringType.STRING)) {
            AtomicValue max = (AtomicValue) firstItem;
            final int arglen = argv.size();
            final Collator collator;
            if(arglen == 2) {
                Item sec = argv.getItem(1);
                Type secType = sec.getType();
                if(!TypeUtil.subtypeOf(secType, StringType.STRING)) {
                    throw new DynamicError("err:FORG0006", "second argument is expected to be xs:string, but was "
                            + secType);
                }
                String uri = sec.stringValue();
                collator = CollationUtils.resolve(uri, dynEnv.getStaticContext());
            } else {
                collator = Collator.getInstance(); // compare in default locale
            }
            while(argItor.hasNext()) {
                Item it = argItor.next();
                Type cmpType = it.getType();
                if(!TypeUtil.subtypeOf(cmpType, StringType.STRING)) {
                    throw new DynamicError("err:FORG0006", "imcomparable xs:string and " + cmpType);
                }
                if(collator.compare(it, firstItem) > 0) {
                    max = (AtomicValue) it;
View Full Code Here

    }

    public AttributeTest(byte nodeKind, QualifiedName attributeName, QualifiedName typeName) {
        super(nodeKind);
        if(typeName != null) {
            final Type t = TypeRegistry.safeGet(typeName);
            if(t == null) {
                throw new XQRTException("err:XPST0001", "type '" + typeName + "' not resolved");
            }
            this.type = t;
        }
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.