Package xbird.xquery.type.Type

Examples of xbird.xquery.type.Type.Occurrence


    public BXQSequenceType(SequenceType type) {
        this.type_ = type;
    }

    public int getItemOccurrence() {
        final Occurrence occ = type_.quantifier();
        switch(occ) {
            case OCC_EXACTLY_ONE:
                return OCC_EXACTLY_ONE;
            case OCC_MORE:
            case OCC_ONE_OR_MORE:
View Full Code Here


            }
        }
    }

    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++;
        }
        valueItor.closeQuietly();
        if(count == 0) {
            throw new IllegalStateException();
        }
        if(count == 1) {
            return occ.accepts(Occurrence.OCC_EXACTLY_ONE.getAlignment());
        } else {
            return occ.accepts(Occurrence.OCC_MORE.getAlignment());
        }
    }
View Full Code Here

                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);
                    if(cutted != flwr) {
View Full Code Here

    [114] AtomicType   ::= QName
    ************************************************************************/
    final public Type parseSequenceType() throws ParseException, XQueryException {
        boolean isAtomic = false;
        final ItemType itemType;
        Occurrence occurrenceIndicator = Occurrence.OCC_EXACTLY_ONE;
        switch(jj_nt.kind) {
            case EmptySequence:
                currentToken = jj_consume_token(EmptySequence);
                {
                    if(true)
View Full Code Here

     [114] AtomicType   ::= QName
     ************************************************************************/
    final public Type parseSequenceType() throws ParseException, XQueryException {
        boolean isAtomic = false;
        final ItemType itemType;
        Occurrence occurrenceIndicator = Occurrence.OCC_EXACTLY_ONE;
        switch(jj_nt.kind) {
            case EmptySequence:
                currentToken = jj_consume_token(EmptySequence);
                {
                    if(true)
View Full Code Here

TOP

Related Classes of xbird.xquery.type.Type.Occurrence

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.