Release coccinelle-0.2.1-rc1
[bpt/coccinelle.git] / commons / ocollection / oseti.ml
1 open Ocollection
2 open Oset
3
4 class ['a] oseti xs =
5 object(o)
6 inherit [int] oset
7
8 val data = xs (* Seti.empty *)
9 method toseti = data
10 method toset = Obj.magic data
11
12 method empty = {< data = Seti.empty >}
13 method add e = {< data = Seti.add e data >}
14 method iter f = Seti.iter f data
15 method view =
16 if Seti.is_empty data
17 then Empty
18 else let el = Seti.choose data in Cons (el, o#del el)
19
20 method del e = {< data = Seti.remove e data >}
21 method mem e = Seti.mem e data
22 method null = Seti.is_empty data
23
24 method tolist = Seti.elements data
25 method length = Seti.cardinal data
26
27 method union s = {< data = Seti.union data s#toseti >}
28 method inter s = {< data = Seti.inter data s#toseti >}
29 method minus s = {< data = Seti.diff data s#toseti >}
30
31 method invariant () = Seti.invariant data
32 method to_string () = Seti.string_of_seti data
33
34 method misc_op_hook () = {< data = Seti.patch3 data >}
35 end