|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface NodeId
Represents the internal id of a node within eXist. Basically, all stored nodes in eXist need to have an id that implements this interface. The id will be assigned according to used numbering scheme. From a given id, we can determine the relationship of the node it represents to any other node in the same document.
Field Summary | |
---|---|
static NodeId |
DOCUMENT_NODE
Static field representing the document node. |
static NodeId |
END_OF_DOCUMENT
|
static int |
IS_CHILD
|
static int |
IS_DESCENDANT
|
static int |
IS_SELF
|
static int |
LENGTH_NODE_ID_UNITS
|
static NodeId |
ROOT_NODE
|
Method Summary | |
---|---|
boolean |
after(NodeId other,
boolean isFollowing)
Returns true if the node represented by this node id comes after the argument node in document order. |
NodeId |
append(NodeId other)
|
boolean |
before(NodeId other,
boolean isPreceding)
Returns true if the node represented by this node id comes before the argument node in document order. |
int |
compareTo(NodeId other)
|
int |
computeRelation(NodeId ancestor)
Computes the relationship of this node to the given potential ancestor node. |
boolean |
equals(NodeId other)
|
NodeId |
getChild(int child)
Returns a new NodeId representing the nth child node of this node. |
NodeId |
getParentId()
Returns a new NodeId representing the parent of the current node. |
int |
getTreeLevel()
Returns the level within the document tree at which this node occurs. |
NodeId |
insertBefore()
|
NodeId |
insertNode(NodeId right)
|
boolean |
isChildOf(NodeId parent)
Is the current node a child node of the specified parent? |
boolean |
isDescendantOf(NodeId ancestor)
Is the current node id a descendant of the specified node? |
boolean |
isDescendantOrSelfOf(NodeId ancestor)
|
boolean |
isSiblingOf(NodeId sibling)
|
NodeId |
newChild()
Returns a new NodeId representing the first child node of this node. |
NodeId |
nextSibling()
Returns a new NodeId representing the next following sibling of this node. |
NodeId |
precedingSibling()
Returns a new NodeId representing the prececing sibling of this node. |
void |
serialize(byte[] data,
int offset)
Serializes the node id to an array of bytes. |
int |
size()
Returns the size (in bytes) of this node id. |
int |
units()
|
NodeId |
write(NodeId previous,
VariableByteOutputStream os)
Write the node id to a VariableByteOutputStream . |
void |
write(VariableByteOutputStream os)
Write the node id to a VariableByteOutputStream . |
Methods inherited from interface java.lang.Comparable |
---|
compareTo |
Field Detail |
---|
static final int LENGTH_NODE_ID_UNITS
static final NodeId DOCUMENT_NODE
static final NodeId END_OF_DOCUMENT
static final NodeId ROOT_NODE
static final int IS_CHILD
static final int IS_DESCENDANT
static final int IS_SELF
Method Detail |
---|
NodeId newChild()
NodeId getChild(int child)
child
- the position of the child
NodeId nextSibling()
NodeId precedingSibling()
NodeId insertNode(NodeId right)
NodeId insertBefore()
NodeId append(NodeId other)
NodeId getParentId()
DOCUMENT_NODE
will be returned.
For the document itself, the parent id will be null.
boolean after(NodeId other, boolean isFollowing)
other
- the node id to compare withisFollowing
- if true, return false for descendants of the current node
boolean before(NodeId other, boolean isPreceding)
other
- the node id to compare withisPreceding
- if true, return false for ancestors of the current node
boolean isDescendantOf(NodeId ancestor)
ancestor
- node id of the potential ancestor
boolean isDescendantOrSelfOf(NodeId ancestor)
boolean isChildOf(NodeId parent)
parent
- the parent node
int computeRelation(NodeId ancestor)
IS_CHILD
, IS_DESCENDANT
or IS_SELF
. If the nodes are not in a ancestor-descendant relation,
the method returns -1.
ancestor
- the (potential) ancestor node to check against
boolean isSiblingOf(NodeId sibling)
int getTreeLevel()
int compareTo(NodeId other)
boolean equals(NodeId other)
int size()
int units()
void serialize(byte[] data, int offset)
data
- the byte array to be filledoffset
- offset into the arrayvoid write(VariableByteOutputStream os) throws IOException
VariableByteOutputStream
.
os
- the output stream
IOException
- if there's a problem with the underlying output streamNodeId write(NodeId previous, VariableByteOutputStream os) throws IOException
VariableByteOutputStream
. To save
storage space, only store those byte which are different from the previous node id.
previous
- the node id previously written or nullos
- the output stream
IOException
- if there's a problem with the underlying output stream
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |