Package xbird.xquery.type

Examples of xbird.xquery.type.Type


    @Override
    public XQExpression visit(CastableExpr expr, XQueryContext ctxt) throws XQueryException {
        header("CastableExpr");
        indentln();
        expr.getExpression().visit(this, ctxt);
        Type t = expr.getType();
        if(t != null) {
            buf.append(" castable as ");
            buf.append(t.toString());
        }
        indent--;
        return expr;
    }
View Full Code Here


    @Override
    public XQExpression visit(CastExpr expr, XQueryContext ctxt) throws XQueryException {
        header("CastExpr");
        indentln();
        expr.getExpression().visit(this, ctxt);
        Type t = expr.getType();
        if(t != null) {
            buf.append(" cast as ");
            buf.append(t.toString());
        }
        indent--;
        return expr;
    }
View Full Code Here

    @Override
    public XQExpression visit(ExternalVariable var, XQueryContext ctxt) throws XQueryException {
        final String name = var.getName();
        buf.append("declare variable $" + name);
        final Type type = var.getType();
        if(type != null) {
            buf.append(" as ");
            buf.append(type);
        }
        buf.append(" external;");
View Full Code Here

    @Override
    public XQExpression visit(InstanceofOp op, XQueryContext ctxt) throws XQueryException {
        header("InstanceofOp");
        indentln();
        op.getExpression().visit(this, ctxt);
        Type t = op.getType();
        if(t != null) {
            buf.append(" instance of ");
            buf.append(t.toString());
        }
        indent--;
        return op;
    }
View Full Code Here

            UserFunction newuf = ObjectUtils.deepCopy(func);
            List<ParametricVariable> newParams = newuf.getParameters();
            final int psize = newParams.size();
            for(int i = 0; i < psize; i++) {
                ParametricVariable p = newParams.get(i);
                Type implicitParamType = p.getType();
                XQExpression arg = argv.get(i);
                Type argType = arg.getType();
                if(implicitParamType != Untyped.UNTYPED && !implicitParamType.accepts(argType)) {
                    // type promotion is required for arguments
                    p.setValue(new TypePromotedExpr(arg, implicitParamType));
                } else {
                    p.setValue(arg);
View Full Code Here

            if(retExpr instanceof DirectFunctionCall && !(retExpr instanceof RecursiveCall)) {
                final DirectFunctionCall funcall = (DirectFunctionCall) retExpr;
                final List<XQExpression> params = funcall.getParams();
                if(params.size() == 1) {
                    FunctionSignature sig = funcall.getFunction().getFunctionSignature(1);
                    Type type = sig.getArgumentType(0);
                    Occurrence occ = type.quantifier();
                    if(!occ.accepts(Occurrence.OCC_ZERO_OR_MORE.getAlignment())) {
                        return flwr; //TODO REVIEWME
                    }
                    final XQExpression firstArg = params.get(0);
                    final XQExpression cutted = recApplyFLWRCuttingInternal(flwr, firstArg);
View Full Code Here

                if(refcnt == 1) {
                    for(Binding clause : flwr.getClauses()) {
                        final BindingVariable bindingVar = clause.getVariable();
                        if(bindingVar == referent) {
                            XQExpression bindingExpr = bindingVar.getValue();
                            Type type = bindingVar.getType();
                            if(type != Untyped.UNTYPED) {
                                return new TypePromotedExpr(bindingExpr, type);
                            } else {
                                return bindingExpr;
                            }
View Full Code Here

        super(funcName);
    }

    protected static int combinedArgTypes(Item it1, Item it2) {
        int t1, t2;
        Type type1 = it1.getType();
        if(type1 instanceof AtomicType) {
            t1 = ((AtomicType) type1).getTypeId();
            if(t1 == UNTYPED_ATOMIC_TID) {
                t1 = DOUBLE_TID;
            }
        } else {
            t1 = UNRESOLVED;
        }
        Type type2 = it2.getType();
        if(type2 instanceof AtomicType) {
            t2 = ((AtomicType) type2).getTypeId();
            if(t2 == UNTYPED_ATOMIC_TID) {
                t2 = DOUBLE_TID;
            }
View Full Code Here

        buf.append('(');
        for (int i=0; i < _list.size(); i++) {
            if (i != 0) {
                buf.append(" & ");
            }
            Type t = _list.get(i);
            buf.append(t.toString());
        }
        buf.append(')');
        return buf.toString();
    }
View Full Code Here

            idx++;
            int unknowns = 0;
            AtomicType[] expected = s.first;
            final int last = expected.length - 1;
            for(int j = 0; j < expected.length; j++) {
                Type argtype = argTypes[j];
                Type extype = expected[j];
                final boolean eq = (argtype == extype);
                if(eq || TypeUtil.subtypeOf(argtype, extype)) {//REVIEWME ok
                    if(!eq && argtype instanceof AtomicType) {
                        if(argtype == UntypedAtomicType.UNTYPED_ATOMIC
                                || argtype == AtomicType.ANY_ATOMIC_TYPE) {
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.