Search in sources :

Example 6 with StructNode

use of org.sirix.node.interfaces.StructNode in project sirix by sirixdb.

the class XdmNodeReadTrxImpl method getFirstChildDeweyID.

@Override
public Optional<SirixDeweyID> getFirstChildDeweyID() {
    if (mResourceManager.getResourceConfig().mDeweyIDsStored) {
        final StructNode node = getStructuralNode();
        final long nodeKey = node.getNodeKey();
        Optional<SirixDeweyID> deweyID = Optional.<SirixDeweyID>empty();
        if (node.hasFirstChild()) {
            // Right sibling node.
            deweyID = moveTo(node.getFirstChildKey()).get().getDeweyID();
        }
        moveTo(nodeKey);
        return deweyID;
    }
    return Optional.<SirixDeweyID>empty();
}
Also used : SirixDeweyID(org.sirix.node.SirixDeweyID) StructNode(org.sirix.node.interfaces.StructNode)

Example 7 with StructNode

use of org.sirix.node.interfaces.StructNode in project sirix by sirixdb.

the class XdmNodeReadTrxImpl method getFirstChildKind.

@Override
public Kind getFirstChildKind() {
    assertNotClosed();
    if (mCurrentNode instanceof StructNode && hasFirstChild()) {
        final long nodeKey = mCurrentNode.getNodeKey();
        moveToFirstChild();
        final Kind firstChildKind = mCurrentNode.getKind();
        moveTo(nodeKey);
        return firstChildKind;
    }
    return Kind.UNKNOWN;
}
Also used : PageKind(org.sirix.page.PageKind) Kind(org.sirix.node.Kind) StructNode(org.sirix.node.interfaces.StructNode)

Example 8 with StructNode

use of org.sirix.node.interfaces.StructNode in project sirix by sirixdb.

the class XdmNodeReadTrxImpl method getLeftSiblingDeweyID.

@Override
public Optional<SirixDeweyID> getLeftSiblingDeweyID() {
    assertNotClosed();
    if (mResourceManager.getResourceConfig().mDeweyIDsStored) {
        final StructNode node = getStructuralNode();
        final long nodeKey = node.getNodeKey();
        Optional<SirixDeweyID> deweyID = Optional.<SirixDeweyID>empty();
        if (node.hasLeftSibling()) {
            // Left sibling node.
            deweyID = moveTo(node.getLeftSiblingKey()).get().getDeweyID();
        }
        moveTo(nodeKey);
        return deweyID;
    }
    return Optional.<SirixDeweyID>empty();
}
Also used : SirixDeweyID(org.sirix.node.SirixDeweyID) StructNode(org.sirix.node.interfaces.StructNode)

Example 9 with StructNode

use of org.sirix.node.interfaces.StructNode in project sirix by sirixdb.

the class XdmNodeReadTrxImpl method moveToLeftSibling.

@Override
public Move<? extends XdmNodeReadTrx> moveToLeftSibling() {
    assertNotClosed();
    final StructNode node = getStructuralNode();
    if (!node.hasLeftSibling()) {
        return Move.notMoved();
    }
    return moveTo(node.getLeftSiblingKey());
}
Also used : StructNode(org.sirix.node.interfaces.StructNode)

Example 10 with StructNode

use of org.sirix.node.interfaces.StructNode in project sirix by sirixdb.

the class XdmNodeReadTrxImpl method getLeftSiblingKind.

@Override
public Kind getLeftSiblingKind() {
    assertNotClosed();
    if (mCurrentNode instanceof StructNode && hasLeftSibling()) {
        final long nodeKey = mCurrentNode.getNodeKey();
        moveToLeftSibling();
        final Kind leftSiblKind = mCurrentNode.getKind();
        moveTo(nodeKey);
        return leftSiblKind;
    }
    return Kind.UNKNOWN;
}
Also used : PageKind(org.sirix.page.PageKind) Kind(org.sirix.node.Kind) StructNode(org.sirix.node.interfaces.StructNode)

Aggregations

StructNode (org.sirix.node.interfaces.StructNode)41 SirixDeweyID (org.sirix.node.SirixDeweyID)12 SirixUsageException (org.sirix.exception.SirixUsageException)11 ElementNode (org.sirix.node.ElementNode)10 TextNode (org.sirix.node.TextNode)8 ImmutableNode (org.sirix.node.interfaces.immutable.ImmutableNode)8 UnorderedKeyValuePage (org.sirix.page.UnorderedKeyValuePage)8 CommentNode (org.sirix.node.CommentNode)6 PINode (org.sirix.node.PINode)6 AttributeNode (org.sirix.node.AttributeNode)5 Kind (org.sirix.node.Kind)5 NamespaceNode (org.sirix.node.NamespaceNode)5 NameNode (org.sirix.node.interfaces.NameNode)5 Node (org.sirix.node.interfaces.Node)5 ValueNode (org.sirix.node.interfaces.ValueNode)5 PageKind (org.sirix.page.PageKind)5 Optional (java.util.Optional)3 PostOrderAxis (org.sirix.axis.PostOrderAxis)3 Axis (org.sirix.api.Axis)2 DescendantAxis (org.sirix.axis.DescendantAxis)2