X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=tree.ml;h=74903de82c44a654a15ba2a81e69d82b21655d8c;hb=0d7eadaaedb0e9b485242975263b8f0480fc2f39;hp=c968f105d99ca77f2c1f6611babd2ace0786d186;hpb=cea756c7adc49891004bfe455628010eb7a28bc9;p=SXSI%2Fxpathcomp.git diff --git a/tree.ml b/tree.ml index c968f10..74903de 100644 --- a/tree.ml +++ b/tree.ml @@ -168,16 +168,9 @@ module DocIdSet = struct let compare = compare_node end) end -let is_nil t = match t.node with - | Nil -> true - | Node(i) -> equal_node i nil - | _ -> false - -let is_node t = -match t.node with - | Node(i) -> not(equal_node i nil) - | _ -> false +let is_nil t = t.node == Nil +let is_node t = t.node != Nil let node_of_t t = let _ = Tag.init (Obj.magic t) in @@ -232,7 +225,7 @@ let compare a b = match a.node,b.node with let equal a b = (compare a b) == 0 -let norm (n : [`Tree ] node ) = if tree_is_nil n then Nil else Node (n) +let norm (n : [`Tree ] node ) = if n == -1 then Nil else Node (n) let nts = function Nil -> "Nil" @@ -279,7 +272,7 @@ let node_sibling n = | Node i -> { n with node= norm(tree_next_sibling n.doc i) } | _ -> { n with node = Nil } -let node_sibling_ctx n _ = +let node_sibling_ctx n _ = match n.node with | Node i -> { n with node= norm(tree_next_sibling n.doc i) } | _ -> { n with node = Nil }