Package org.apache.vxquery.datamodel.accessors.nodes

Examples of org.apache.vxquery.datamodel.accessors.nodes.NodeTreePointable


    @Override
    protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
            throws AlgebricksException {
        final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
        final DataOutput dOut = abvs.getDataOutput();
        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);
                        result.set(abvs);
                    }
                } catch (Exception e) {
                    throw new SystemException(ErrorCode.SYSE0001, e);
View Full Code Here


    private boolean processIfAttribute(TaggedValuePointable tvp, DictionaryBuilder db) throws IOException {
        if (tvp.getTag() != ValueTag.NODE_TREE_TAG) {
            return false;
        }
        NodeTreePointable ntp = ppool.takeOne(NodeTreePointable.class);
        try {
            tvp.getValue(ntp);
            TaggedValuePointable innerTvp = ppool.takeOne(TaggedValuePointable.class);
            try {
                ntp.getRootNode(innerTvp);
                if (innerTvp.getTag() != ValueTag.ATTRIBUTE_NODE_TAG) {
                    return false;
                }
                AttributeNodePointable anp = ppool.takeOne(AttributeNodePointable.class);
                try {
View Full Code Here

    private void processChild(TaggedValuePointable tvp, DictionaryBuilder db) throws IOException, SystemException {
        if (tvp.getTag() != ValueTag.NODE_TREE_TAG) {
            enb.addChild(tvp);
        } else {
            NodeTreePointable ntp = ppool.takeOne(NodeTreePointable.class);
            try {
                tvp.getValue(ntp);
                TaggedValuePointable innerTvp = ppool.takeOne(TaggedValuePointable.class);
                try {
                    ntp.getRootNode(innerTvp);
                    byte nTag = innerTvp.getTag();
                    switch (nTag) {
                        case ValueTag.ATTRIBUTE_NODE_TAG: {
                            throw new SystemException(ErrorCode.XQTY0024);
                        }
View Full Code Here

    @Override
    protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
            throws AlgebricksException {
        final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
        final DataOutput dOut = abvs.getDataOutput();
        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.
                if (tvp1.getTag() == ValueTag.NODE_TREE_TAG) {
                    try {
                        abvs.reset();
                        tvp1.getValue(ntp);
                        dOut.write(ValueTag.XS_INT_TAG);
                        tvp1.getValue(ntp);
                        dOut.writeInt(ntp.getRootNodeId());
                        result.set(abvs);
                    } catch (Exception e) {
                        throw new SystemException(ErrorCode.SYSE0001, e);
                    }
                } else {
View Full Code Here

    private boolean processIfAttribute(TaggedValuePointable tvp, DictionaryBuilder db) throws IOException {
        if (tvp.getTag() != ValueTag.NODE_TREE_TAG) {
            return false;
        }
        NodeTreePointable ntp = ppool.takeOne(NodeTreePointable.class);
        try {
            tvp.getValue(ntp);
            TaggedValuePointable innerTvp = ppool.takeOne(TaggedValuePointable.class);
            try {
                ntp.getRootNode(innerTvp);
                if (innerTvp.getTag() != ValueTag.ATTRIBUTE_NODE_TAG) {
                    return false;
                }
                AttributeNodePointable anp = ppool.takeOne(AttributeNodePointable.class);
                try {
View Full Code Here

    private void processChild(TaggedValuePointable tvp, DictionaryBuilder db) throws IOException, SystemException {
        if (tvp.getTag() != ValueTag.NODE_TREE_TAG) {
            enb.addChild(tvp);
        } else {
            NodeTreePointable ntp = ppool.takeOne(NodeTreePointable.class);
            try {
                tvp.getValue(ntp);
                TaggedValuePointable innerTvp = ppool.takeOne(TaggedValuePointable.class);
                try {
                    ntp.getRootNode(innerTvp);
                    byte nTag = innerTvp.getTag();
                    switch (nTag) {
                        case ValueTag.ATTRIBUTE_NODE_TAG: {
                            throw new SystemException(ErrorCode.XQTY0024);
                        }
View Full Code Here

    @Override
    protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
            throws AlgebricksException {
        final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
        final DataOutput dOut = abvs.getDataOutput();
        final NodeTreePointable ntp = (NodeTreePointable) NodeTreePointable.FACTORY.createPointable();
        final TypedPointables tp = new TypedPointables();

        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, tp);
                    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);
                        result.set(abvs);
                    }
                } catch (Exception e) {
                    throw new SystemException(ErrorCode.SYSE0001, e);
View Full Code Here

TOP

Related Classes of org.apache.vxquery.datamodel.accessors.nodes.NodeTreePointable

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.