1 (***********************************************************************)
8 (* Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
9 (* Recherche Scientifique. All rights reserved. This file is *)
10 (* distributed under the terms of the GNU Lesser General Public *)
11 (* License, with the special exception on linking described in file *)
14 (***********************************************************************)
18 type label = QNameSet.t
20 type formula = Formula.t
24 type t = state * label * formula
26 let compare (st,la,f) (st',la',f') =
27 let x_1 = State.compare st st' in
29 else let x_2 = QNameSet.compare la la' in
31 else Formula.compare f f'
35 let print fmt (st,la,f) =
36 Format.fprintf fmt "(%a,%s,%a)"
44 include Set.Make(Transition)
48 mutable reco : StateSet.t;
49 mutable selec : StateSet.t;
50 mutable bottom : StateSet.t;
51 mutable top : StateSet.t;
52 mutable trans : SetT.t;
55 exception Not_found_transition
56 exception Transition_not_injective
58 let transition asta st lab =
60 (State.compare s st = 0) && (QNameSet.compare l lab = 0) in
61 let tr_set = SetT.elements (SetT.filter filter asta.trans) in
63 | [] -> raise Not_found_transition
64 | x::y::z -> raise Transition_not_injective
65 | [l] -> Transition.fo l
67 let transitions asta st =
68 let filter (s,l,f) = State.compare s st = 0 in
69 let rec remove_states l = match l with
71 | (a,s,l) :: tl -> (s,l) :: (remove_states tl) in
72 remove_states (SetT.elements (SetT.filter filter asta.trans))
75 reco = StateSet.empty;
76 selec = StateSet.empty;
77 bottom = StateSet.empty;
84 let pp = Format.fprintf fmt in
85 pp "Recognizing states: ";
86 StateSet.print fmt asta.reco;
87 pp "\nSelecting states: ";
88 StateSet.print fmt asta.selec;
89 pp "\nBottom states: ";
90 StateSet.print fmt asta.bottom;
92 StateSet.print fmt asta.top;
93 pp "\nTransitions: \n";
94 Format.fprintf fmt "{@[<hov 2> %a @]}" (* todo: check boxes *)
95 (Pretty.print_list ~sep:"@, " (Transition.print))
96 (SetT.elements (asta.trans))
99 let to_file out asta = ()