projects
/
SXSI
/
XMLTree.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed error: Syscall param write(buf) points to uninitialised byte(s)
[SXSI/XMLTree.git]
/
XMLTree.cpp
diff --git
a/XMLTree.cpp
b/XMLTree.cpp
index
99d0395
..
249143c
100644
(file)
--- a/
XMLTree.cpp
+++ b/
XMLTree.cpp
@@
-357,7
+357,9
@@
bool XMLTree::IsChild(treeNode x, treeNode y)
if (!is_ancestor(Par, x, y)) return false;
\r
return depth(Par, x) == (depth(Par, y) + 1);
\r
}
\r
if (!is_ancestor(Par, x, y)) return false;
\r
return depth(Par, x) == (depth(Par, y) + 1);
\r
}
\r
-
\r
+bool XMLTree::IsFirstChild(treeNode x){
\r
+ return ((x != NULLT)&&(x==Root() || prev_sibling(Par,x) == NULLT));
\r
+}
\r
// NumChildren(x): number of children of node x. Constant time with the data structure
\r
// of Sadakane.
\r
int XMLTree::NumChildren(treeNode x)
\r
// NumChildren(x): number of children of node x. Constant time with the data structure
\r
// of Sadakane.
\r
int XMLTree::NumChildren(treeNode x)
\r
@@
-499,6
+501,14
@@
treeNode XMLTree::FirstChild(treeNode x)
return first_child(Par, x);
\r
}
\r
\r
return first_child(Par, x);
\r
}
\r
\r
+treeNode XMLTree::LastChild(treeNode x)
\r
+{
\r
+ if (x == Root() || isleaf(Par,x) || x == NULLT)
\r
+ return x;
\r
+ else
\r
+ return find_open(Par,find_close(Par,parent(Par,x))-1);
\r
+}
\r
+
\r
// NextSibling(x): returns the next sibling of node x, assuming it exists.
\r
treeNode XMLTree::NextSibling(treeNode x)
\r
{
\r
// NextSibling(x): returns the next sibling of node x, assuming it exists.
\r
treeNode XMLTree::NextSibling(treeNode x)
\r
{
\r