-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdomain.ml
52 lines (42 loc) · 1.4 KB
/
domain.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
type domain = Pos of Poset.t
| Ev of Event.t
type t = {
poset_list : Poset.t list;
event_list : Event.t list;
}
let get_events t = t.event_list
let get_posets t = t.poset_list
let get_poset_from_filename s dlist =
List.find
(fun d ->
match d with Ev e -> false
| Pos p ->
(match (Poset.filename p) with Some n -> (s=n)
| None -> false))
dlist
let print_posets t =
List.iteri
(fun i p -> Format.printf "@.poset nb %d" i; Poset.print_poset p)
t.poset_list
let print_domain = function
| Pos p -> (match p.Poset.filename with
| Some f -> Format.printf"%s " f
| None -> Poset.print_poset p)
| Ev e -> Event.print_event e
let print_domain_list l =
List.iter (fun d -> print_domain d) l;
Format.printf"\n"
let add_posets p current_posets =
{ poset_list = p::current_posets.poset_list;
event_list = (Poset.events p)@current_posets.event_list; }
let set_posets file_list env =
let posets : t = { poset_list = []; event_list = []; } in
let posets_file =
List.fold_left
(fun t file ->
let s = Poset.read_poset_from_file file env in
add_posets s t) posets file_list in
let () = if (!Param.debug_mode)
then (Format.printf "\n********* the posets are:";
print_posets posets_file) in
posets_file