(*****************************************************************************)
type universe = int * UriManager.uri option
-
+
+let eq u1 u2 =
+ match u1,u2 with
+ | (id1, Some uri1),(id2, Some uri2) ->
+ id1 = id2 && UriManager.eq uri1 uri2
+ | (id1, None),(id2, None) -> id1 = id2
+ | _ -> false
+
+let compare (id1, uri1) (id2, uri2) =
+ let cmp = id1 - id2 in
+ if cmp = 0 then
+ match uri1,uri2 with
+ | None, None -> 0
+ | Some _, None -> 1
+ | None, Some _ -> ~-1
+ | Some uri1, Some uri2 -> UriManager.compare uri1 uri2
+ else
+ cmp
+
module UniverseType = struct
type t = universe
- let compare (n1,u1) (n2,u2) =
- let ndiff = n1 - n2 in
- if ndiff <> 0 then ndiff
- else
- match u1,u2 with
- None, None -> 0
- | Some u1, Some u2 -> UriManager.compare u1 u2
- | None, Some _ -> 1
- | Some _, None -> -1
+ let compare = compare
end
module SOF = Set.Make(UniverseType)
MAL.iter (fun k v -> assert_univ k; assert_entry v)graph;
List.iter assert_univ univlist
-let eq u1 u2 =
- match u1,u2 with
- | (id1, Some uri1),(id2, Some uri2) ->
- id1 = id2 && UriManager.eq uri1 uri2
- | (id1, None),(id2, None) -> id1 = id2
- | _ -> false
-
-let compare (id1, uri1) (id2, uri2) =
- let cmp = id1 - id2 in
- if cmp = 0 then
- match uri1,uri2 with
- | None, None -> 0
- | Some _, None -> 1
- | None, Some _ -> ~-1
- | Some uri1, Some uri2 -> UriManager.compare uri1 uri2
- else
- cmp
-
let is_anon = function (_,None) -> true | _ -> false
(* EOF *)