Examples of TaggedValuePointable


Examples of org.apache.vxquery.datamodel.accessors.TaggedValuePointable

        final FunctionHelper.TypedPointables tp = new FunctionHelper.TypedPointables();

        return new AbstractTaggedValueArgumentScalarEvaluator(args) {
            @Override
            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
                TaggedValuePointable tvp1 = args[0];
                try {
                    abvs.reset();
                    switch (tvp1.getTag()) {
                        case ValueTag.XS_STRING_TAG:
                            tvp1.getValue(tp.utf8sp);
                            castToDouble.convertString(tp.utf8sp, dOut);
                            break;
                        case ValueTag.XS_UNTYPED_ATOMIC_TAG:
                            tvp1.getValue(tp.utf8sp);
                            castToDouble.convertUntypedAtomic(tp.utf8sp, dOut);
                            break;
                        case ValueTag.XS_BOOLEAN_TAG:
                            tvp1.getValue(tp.boolp);
                            castToDouble.convertBoolean(tp.boolp, dOut);
                            break;
                        //                        case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
                        case ValueTag.XS_INTEGER_TAG:
                        case ValueTag.XS_NON_POSITIVE_INTEGER_TAG:
                        case ValueTag.XS_NEGATIVE_INTEGER_TAG:
                        case ValueTag.XS_LONG_TAG:
                        case ValueTag.XS_NON_NEGATIVE_INTEGER_TAG:
                        case ValueTag.XS_UNSIGNED_LONG_TAG:
                        case ValueTag.XS_POSITIVE_INTEGER_TAG:
                        case ValueTag.XS_UNSIGNED_INT_TAG:
                            tvp1.getValue(tp.longp);
                            castToDouble.convertInteger(tp.longp, dOut);
                            break;
                        //                        case ValueTag.XS_DAY_TIME_DURATION_TAG:
                        case ValueTag.XS_INT_TAG:
                        case ValueTag.XS_UNSIGNED_SHORT_TAG:
                            tvp1.getValue(tp.intp);
                            castToDouble.convertInt(tp.intp, dOut);
                            break;
                        case ValueTag.XS_DECIMAL_TAG:
                            tvp1.getValue(tp.decp);
                            castToDouble.convertDecimal(tp.decp, dOut);
                            break;
                        case ValueTag.XS_DOUBLE_TAG:
                            tvp1.getValue(tp.doublep);
                            castToDouble.convertDouble(tp.doublep, dOut);
                            break;
                        case ValueTag.XS_FLOAT_TAG:
                            tvp1.getValue(tp.floatp);
                            castToDouble.convertFloat(tp.floatp, dOut);
                            break;
                        case ValueTag.XS_SHORT_TAG:
                        case ValueTag.XS_UNSIGNED_BYTE_TAG:
                            tvp1.getValue(tp.shortp);
                            castToDouble.convertShort(tp.shortp, dOut);
                            break;
                        case ValueTag.XS_BYTE_TAG:
                            tvp1.getValue(tp.bytep);
                            castToDouble.convertByte(tp.bytep, dOut);
                            break;
                        default:
                            dOut.write(ValueTag.XS_DOUBLE_TAG);
                            dOut.writeDouble(Double.NaN);
View Full Code Here

Examples of org.apache.vxquery.datamodel.accessors.TaggedValuePointable

            throws AlgebricksException {
        final SequencePointable seqp = (SequencePointable) SequencePointable.FACTORY.createPointable();
        return new AbstractTaggedValueArgumentScalarEvaluator(args) {
            @Override
            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
                TaggedValuePointable tvp = args[0];
                if (tvp.getTag() == ValueTag.SEQUENCE_TAG) {
                    tvp.getValue(seqp);
                    if (seqp.getEntryCount() == 0) {
                        XDMConstants.setTrue(result);
                        return;
                    }
                }
View Full Code Here

Examples of org.apache.vxquery.datamodel.accessors.TaggedValuePointable

                }
           }

            @Override
            protected void step(TaggedValuePointable[] args) throws SystemException {
                TaggedValuePointable tvp = args[0];
                if (tvp.getTag() == ValueTag.SEQUENCE_TAG) {
                    tvp.getValue(seq);
                    int seqLen = seq.getEntryCount();
                    for (int j = 0; j < seqLen; ++j) {
                        seq.getEntry(j, p);
                        addItem(p);
                    }
View Full Code Here

Examples of org.apache.vxquery.datamodel.accessors.TaggedValuePointable

        return new AbstractTaggedValueArgumentScalarEvaluator(args) {
            private final BooleanPointable bp = (BooleanPointable) BooleanPointable.FACTORY.createPointable();

            @Override
            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
                TaggedValuePointable arg = args[0];
                arg.getValue(bp);
                if (bp.getBoolean()) {
                    XDMConstants.setFalse(result);
                } else {
                    XDMConstants.setTrue(result);
                }
View Full Code Here

Examples of org.apache.vxquery.datamodel.accessors.TaggedValuePointable

        final DataOutput dOutInner = abvsInner.getDataOutput();

        return new AbstractTaggedValueArgumentScalarEvaluator(args) {
            @Override
            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
                TaggedValuePointable tvp1 = args[0];
                long value;
                long YMDuration = 0, DTDuration = 0;

                switch (tvp1.getTag()) {
                    case ValueTag.SEQUENCE_TAG:
                        tvp1.getValue(seqp);
                        if (seqp.getEntryCount() == 0) {
                            XDMConstants.setEmptySequence(result);
                            return;
                        }
                        break;
                    case ValueTag.XS_DURATION_TAG:
                        tvp1.getValue(durationp);
                        YMDuration = durationp.getYearMonth();
                        DTDuration = durationp.getDayTime();
                        break;
                    case ValueTag.XS_DAY_TIME_DURATION_TAG:
                        tvp1.getValue(longp);
                        DTDuration = longp.getLong();
                        break;
                    case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
                        tvp1.getValue(intp);
                        YMDuration = intp.getInteger();
                        break;
                    default:
                        throw new SystemException(ErrorCode.FORG0006);
                }
View Full Code Here

Examples of org.apache.vxquery.datamodel.accessors.TaggedValuePointable

        final DataOutput dOut = abvs.getDataOutput();

        return new AbstractTaggedValueArgumentScalarEvaluator(args) {
            @Override
            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
                TaggedValuePointable tvp1 = args[0];
                // Only accept node trees as input.
                try {
                    int localNodeId = FunctionHelper.getLocalNodeId(tvp1);
                    if (localNodeId == -1) {
                        XDMConstants.setEmptySequence(result);
View Full Code Here

Examples of org.apache.vxquery.datamodel.accessors.TaggedValuePointable

        final DataOutput dOutInteger2 = abvsInteger2.getDataOutput();

        return new AbstractTaggedValueArgumentScalarEvaluator(args) {
            @Override
            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
                TaggedValuePointable tvp1 = args[0];
                TaggedValuePointable tvp2 = args[1];
               
                if (tvp1.getTag() == ValueTag.SEQUENCE_TAG) {
                    tvp1.getValue(seqp);
                    if (seqp.getEntryCount() == 0) {
                        XDMConstants.setEmptySequence(result);
                        return;
                    }
                    throw new SystemException(ErrorCode.XPTY0004);
                }
                if (tvp2.getTag() == ValueTag.SEQUENCE_TAG) {
                    tvp2.getValue(seqp);
                    if (seqp.getEntryCount() == 0) {
                        XDMConstants.setEmptySequence(result);
                        return;
                    }
                    throw new SystemException(ErrorCode.XPTY0004);
                }
               
                boolean booleanResult = transformThenCompareTaggedValues(aOp, tvp1, tvp2, dCtx);
                try {
                    abvs.reset();
                    dOut.write(ValueTag.XS_BOOLEAN_TAG);
                    dOut.write(booleanResult ? 1 : 0);
                    result.set(abvs);
                } catch (Exception e) {
                    throw new SystemException(ErrorCode.SYSE0001, e);
                }
            }

            protected boolean transformThenCompareTaggedValues(AbstractValueComparisonOperation aOp,
                    TaggedValuePointable tvp1, TaggedValuePointable tvp2, DynamicContext dCtx) throws SystemException {
                TaggedValuePointable tvp1new = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
                TaggedValuePointable tvp2new = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();

                try {
                    if (tvp1.getTag() == ValueTag.XS_UNTYPED_ATOMIC_TAG) {
                        // Only need to change tag since the storage is the same for untyped atomic and string.
                        tvp1.getByteArray()[0] = ValueTag.XS_STRING_TAG;
                        tvp1new = tvp1;
                    } else if (FunctionHelper.isDerivedFromInteger(tvp1.getTag())) {
                        abvsInteger1.reset();
                        FunctionHelper.getIntegerPointable(tvp1, dOutInteger1);
                        tvp1new.set(abvsInteger1.getByteArray(), abvsInteger1.getStartOffset(),
                                LongPointable.TYPE_TRAITS.getFixedLength() + 1);
                    } else {
                        tvp1new = tvp1;
                    }
                    if (tvp2.getTag() == ValueTag.XS_UNTYPED_ATOMIC_TAG) {
                        // Only need to change tag since the storage is the same for untyped atomic and string.
                        tvp2.getByteArray()[0] = ValueTag.XS_STRING_TAG;
                        tvp2new = tvp2;
                    } else if (FunctionHelper.isDerivedFromInteger(tvp2.getTag())) {
                        abvsInteger2.reset();
                        FunctionHelper.getIntegerPointable(tvp2, dOutInteger2);
                        tvp2new.set(abvsInteger2.getByteArray(), abvsInteger2.getStartOffset(),
                                LongPointable.TYPE_TRAITS.getFixedLength() + 1);
                    } else {
                        tvp2new = tvp2;
                    }
View Full Code Here

Examples of org.apache.vxquery.datamodel.accessors.TaggedValuePointable

        final LongPointable longp = (LongPointable) LongPointable.FACTORY.createPointable();
        return new AbstractTaggedValueArgumentScalarEvaluator(args) {
            @Override
            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
                try {
                    TaggedValuePointable tvp2 = args[1];
                    if (tvp2.getTag() != ValueTag.XS_INTEGER_TAG) {
                        throw new SystemException(ErrorCode.FORG0006);
                    }
                    tvp2.getValue(longp);

                    abvs.reset();
                    sb.reset(abvs);
                    TaggedValuePointable tvp1 = args[0];
                    if (tvp1.getTag() == ValueTag.SEQUENCE_TAG) {
                        tvp1.getValue(seq);
                        int seqLen = seq.getEntryCount();
                        if (longp.getLong() < 1 || longp.getLong() > seqLen) {
                            // Position is outside the sequence. Return target.
                            result.set(tvp1);
                            return;
View Full Code Here

Examples of org.apache.vxquery.datamodel.accessors.TaggedValuePointable

        final NodeTreePointable ntp = (NodeTreePointable) NodeTreePointable.FACTORY.createPointable();

        return new AbstractTaggedValueArgumentScalarEvaluator(args) {
            @Override
            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
                TaggedValuePointable tvp1 = args[0];
                // Only accept node trees as input.
                try {
                    int localNodeId = FunctionHelper.getLocalNodeId(tvp1);
                    if (localNodeId == -1) {
                        XDMConstants.setEmptySequence(result);
                    } else {
                        tvp1.getValue(ntp);

                        abvs.reset();
                        dOut.write(ValueTag.XS_LONG_TAG);
                        dOut.writeInt(ntp.getRootNodeId());
                        dOut.writeInt(localNodeId);
View Full Code Here

Examples of org.apache.vxquery.datamodel.accessors.TaggedValuePointable

    @Override
    protected void constructNode(DictionaryBuilder db, TaggedValuePointable[] args, IMutableValueStorage mvs)
            throws IOException, SystemException {
        pinb.reset(mvs);
        TaggedValuePointable targetArg = args[0];
        targetArg.getValue(vp);
        pinb.setTarget(vp);
        TaggedValuePointable contentArg = args[1];
        contentArg.getValue(vp);
        pinb.setContent(vp);
        pinb.finish();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.