X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=tagSet.ml;h=ba3f431c3cb6e88a5457c2a250b8759406e2408d;hb=cad5e2e2831477cba1f6211c57b9a4cc5b58bd55;hp=8495f6cc5e7c5e392471536ff616f4f00dbe72d5;hpb=d64e3a3a9ef6329caafdba848ef78427fce0d689;p=SXSI%2Fxpathcomp.git diff --git a/tagSet.ml b/tagSet.ml index 8495f6c..ba3f431 100644 --- a/tagSet.ml +++ b/tagSet.ml @@ -1,7 +1,32 @@ -include FiniteCofinite.Make(Ptset) +(* module Ptset = +struct + include Set.Make (struct type t = int let compare = (-) end) + let hash = Hashtbl.hash +end + *) +module M : FiniteCofinite.S with type elt = Tag.t and type set = Ptset.Int.t = + FiniteCofinite.Make(Ptset.Int) +include M + let tag t = singleton t let pcdata = singleton Tag.pcdata let attribute = singleton Tag.attribute let star = diff any (cup pcdata attribute) let node = neg attribute + +let print ppf t = + let print_set s = + Format.fprintf ppf "{"; + Ptset.Int.iter + (fun t -> Format.fprintf ppf "'%s' " (Tag.to_string t)) + s; + Format.fprintf ppf "}" + in + if is_finite t then + if is_empty t then + Format.fprintf ppf "∅" else print_set (positive t) + else + Format.fprintf ppf "Σ"; + if not (is_any t) then + (Format.fprintf ppf "\\" ; print_set (negative t))