Package org.apache.vxquery.types

Examples of org.apache.vxquery.types.NodeType


public class NodeTestFilter {

    public static INodeFilter getNodeTestFilter(SequenceType sType) {
        INodeFilter filter;
        final NodeType nodeType = (NodeType) sType.getItemType();
        switch (nodeType.getNodeKind()) {
            case ATTRIBUTE: {
                AttributeType aType = (AttributeType) nodeType;
                NameTest nameTest = aType.getNameTest();
                byte[] uri = nameTest.getUri();
                byte[] localName = nameTest.getLocalName();
View Full Code Here


                    vType = vType.getBaseType();
                }
                return vType != null;
            }
        } else if (it instanceof NodeType && tag == ValueTag.NODE_TREE_TAG) {
            NodeType nt = (NodeType) it;
            NodeKind kind = nt.getNodeKind();
            if (kind == NodeKind.ANY) {
                return true;
            } else {
                tvp.getValue(ntp);
                ntp.getRootNode(tempTVP1);
                switch (tempTVP1.getTag()) {
                    case ValueTag.ATTRIBUTE_NODE_TAG:
                        if (kind == NodeKind.ATTRIBUTE) {
                            if (nt.equals(AttributeType.ANYATTRIBUTE)) {
                                return true;
                            } else {

                            }
                        }
                        break;

                    case ValueTag.COMMENT_NODE_TAG:
                        return kind == NodeKind.ATTRIBUTE;

                    case ValueTag.DOCUMENT_NODE_TAG:
                        if (kind == NodeKind.DOCUMENT) {
                            if (nt.equals(DocumentType.ANYDOCUMENT)) {
                                return true;
                            } else {

                            }
                        }
                        break;

                    case ValueTag.ELEMENT_NODE_TAG:
                        if (kind == NodeKind.ELEMENT) {
                            if (nt.equals(ElementType.ANYELEMENT)) {
                                return true;
                            } else {

                            }
                        }
                        break;

                    case ValueTag.PI_NODE_TAG:
                        if (kind == NodeKind.PI) {
                            if (nt.equals(ProcessingInstructionType.ANYPI)) {
                                return true;
                            } else {
                                ProcessingInstructionType pit = (ProcessingInstructionType) nt;
                                tempTVP1.getValue(pinp);
                                pinp.getTarget(ntp, utf8sp);
View Full Code Here

                        vType = vType.getBaseType();
                    }
                    return vType != null;
                }
            } else if (it instanceof NodeType && testST.getItemType() instanceof NodeType) {
                NodeType nt = (NodeType) it;
                NodeKind kind = nt.getNodeKind();
                NodeType testNT = (NodeType) testST.getItemType();
                NodeKind testKind = testNT.getNodeKind();
                if (kind == NodeKind.ANY || kind == testKind) {
                    return true;
                }
            }
            return false;
View Full Code Here

                    if (ctxExpr == null) {
                        ctxExpr = vre(tCtx.varScope.lookupVariable(XMLQueryCompilerConstants.DOT_VAR_NAME)
                                .getLogicalVariable());
                    }
                    Function axisFn = translateAxis(axis);
                    NodeType nt = translateNodeTest(axis, axisNode.getNodeTest());
                    int ntCode = currCtx.encodeSequenceType(SequenceType.create(nt, Quantifier.QUANT_ONE));
                    ctxExpr = sfce(axisFn,
                            treat(ctxExpr, SequenceType.create(AnyNodeType.INSTANCE, Quantifier.QUANT_STAR)),
                            ce(SequenceType.create(BuiltinTypeRegistry.XS_INT, Quantifier.QUANT_ONE), ntCode));
                    asc = isForwardAxis(axis);
View Full Code Here

                throw new IllegalStateException("Unknown axis: " + axis);
        }
    }

    private NodeType translateNodeTest(AxisStepNode.Axis axis, ASTNode nodeTest) throws SystemException {
        NodeType nt = AnyNodeType.INSTANCE;
        if (nodeTest != null) {
            switch (nodeTest.getTag()) {
                case NAME_TEST: {
                    NameTestNode ntn = (NameTestNode) nodeTest;
                    String uri = null;
View Full Code Here

                    if (ctxExpr == null) {
                        ctxExpr = vre(tCtx.varScope.lookupVariable(XMLQueryCompilerConstants.DOT_VAR_NAME)
                                .getLogicalVariable());
                    }
                    Function axisFn = translateAxis(axis);
                    NodeType nt = translateNodeTest(axis, axisNode.getNodeTest());
                    int ntCode = currCtx.encodeSequenceType(SequenceType.create(nt, Quantifier.QUANT_ONE));
                    ctxExpr = sfce(axisFn,
                            treat(ctxExpr, SequenceType.create(AnyNodeType.INSTANCE, Quantifier.QUANT_STAR)),
                            ce(SequenceType.create(BuiltinTypeRegistry.XS_INT, Quantifier.QUANT_ONE), ntCode));
                    asc = isForwardAxis(axis);
View Full Code Here

                throw new IllegalStateException("Unknown axis: " + axis);
        }
    }

    private NodeType translateNodeTest(AxisStepNode.Axis axis, ASTNode nodeTest) throws SystemException {
        NodeType nt = AnyNodeType.INSTANCE;
        if (nodeTest != null) {
            switch (nodeTest.getTag()) {
                case NAME_TEST: {
                    NameTestNode ntn = (NameTestNode) nodeTest;
                    String uri = null;
View Full Code Here

        itemTvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
        first = true;
    }

    private void setNodeTest(SequenceType sType) {
        final NodeType nodeType = (NodeType) sType.getItemType();
        switch (nodeType.getNodeKind()) {
            case ANY:
                filter = new INodeFilter() {
                    @Override
                    public boolean accept(NodeTreePointable ntp, TaggedValuePointable tvp) {
                        return true;
View Full Code Here

                    vType = vType.getBaseType();
                }
                return vType != null;
            }
        } else if (it instanceof NodeType && tag == ValueTag.NODE_TREE_TAG) {
            NodeType nt = (NodeType) it;
            NodeKind kind = nt.getNodeKind();
            if (kind == NodeKind.ANY) {
                return true;
            } else {
                tvp.getValue(ntp);
                ntp.getRootNode(tempTVP1);
                switch (tempTVP1.getTag()) {
                    case ValueTag.ATTRIBUTE_NODE_TAG:
                        if (kind == NodeKind.ATTRIBUTE) {
                            if (nt.equals(AttributeType.ANYATTRIBUTE)) {
                                return true;
                            } else {

                            }
                        }
                        break;

                    case ValueTag.COMMENT_NODE_TAG:
                        return kind == NodeKind.ATTRIBUTE;

                    case ValueTag.DOCUMENT_NODE_TAG:
                        if (kind == NodeKind.DOCUMENT) {
                            if (nt.equals(DocumentType.ANYDOCUMENT)) {
                                return true;
                            } else {

                            }
                        }
                        break;

                    case ValueTag.ELEMENT_NODE_TAG:
                        if (kind == NodeKind.ELEMENT) {
                            if (nt.equals(ElementType.ANYELEMENT)) {
                                return true;
                            } else {

                            }
                        }
                        break;

                    case ValueTag.PI_NODE_TAG:
                        if (kind == NodeKind.PI) {
                            if (nt.equals(ProcessingInstructionType.ANYPI)) {
                                return true;
                            } else {
                                ProcessingInstructionType pit = (ProcessingInstructionType) nt;
                                tempTVP1.getValue(pinp);
                                pinp.getTarget(ntp, utf8sp);
View Full Code Here

                    if (ctxExpr == null) {
                        ctxExpr = vre(tCtx.varScope.lookupVariable(XMLQueryCompilerConstants.DOT_VAR_NAME)
                                .getLogicalVariable());
                    }
                    Function axisFn = translateAxis(axis);
                    NodeType nt = translateNodeTest(axis, axisNode.getNodeTest());
                    int ntCode = currCtx.encodeSequenceType(SequenceType.create(nt, Quantifier.QUANT_ONE));
                    ctxExpr = sfce(axisFn,
                            treat(ctxExpr, SequenceType.create(AnyNodeType.INSTANCE, Quantifier.QUANT_STAR)),
                            ce(SequenceType.create(BuiltinTypeRegistry.XS_INT, Quantifier.QUANT_ONE), ntCode));
                    asc = isForwardAxis(axis);
View Full Code Here

TOP

Related Classes of org.apache.vxquery.types.NodeType

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.