From: Kim Nguyễn Date: Tue, 16 Oct 2012 11:59:04 +0000 (+0200) Subject: Documentation step 2: Properly document node test functions. X-Git-Url: http://git.nguyen.vg/gitweb/?p=SXSI%2FXMLTree.git;a=commitdiff_plain;h=01c39298054f3d532fca0ab704c8ddbb4de02450 Documentation step 2: Properly document node test functions. --- diff --git a/xml-tree.hpp b/xml-tree.hpp index 68e5f36..8d4af6a 100644 --- a/xml-tree.hpp +++ b/xml-tree.hpp @@ -95,14 +95,53 @@ public: //Node_T tests + /** + * [is_leaf(n)] returns true if [n] is a leaf (i.e. if [num_children(n)] + * returns 0 + * Runs in O(1) + */ inline bool is_leaf(node_t) const; + + /** + * [is_ancestor(n, m)] returns true if [n] is an ancestor of [m], false + * otherwise + * Runs in O(1) + */ inline bool is_ancestor(node_t, node_t) const; + + /** + * [is_right_descendant(n, m)] returns true if [m] is a descendant-or-self of + * a following-sibling of [n], false otherwise + * Runs in O(1) + */ inline bool is_right_descendant(node_t, node_t) const; + + /** + * [is_child(n, m)] returns true if [m] is a child of [n] + * Runs in O(1) + */ bool is_child(node_t, node_t) const; + + /** + * [is_first_child(n, m)] returns true if [m] is the first child of [n] + * Runs in O(1) + */ inline bool is_first_child(node_t) const; + + /** + * [is_nil(n)] returns true if [n] is equal to xml_tree::NIL + * Runs in O(1) + */ inline bool is_nil(node_t) const; + + /** + * [is_open(n)] returns true if [n], seen as an index in the + * underlying BP representation corresponds to an opening parenthesis. + * Runs in O(1) + */ inline bool is_open(node_t) const; + //Numbering functions uint32_t depth(node_t) const; uint32_t preorder(node_t) const; uint32_t postorder(node_t) const;