Commit f6f1be78 authored by POTTIER Francois's avatar POTTIER Francois

Renamed [UnionFind.find] to [UnionFind.get].

parent 20b4c0e3
...@@ -384,7 +384,7 @@ let () = ...@@ -384,7 +384,7 @@ let () =
(* Define accessors. *) (* Define accessors. *)
let represented state = let represented state =
UnionFind.find (represented state) UnionFind.get (represented state)
let representeds states = let representeds states =
if Lr1.NodeSet.is_empty states then if Lr1.NodeSet.is_empty states then
......
...@@ -71,7 +71,7 @@ let var_name = ...@@ -71,7 +71,7 @@ let var_name =
^ let d = !name_counter / 26 in if d = 0 then "" else string_of_int d ^ let d = !name_counter / 26 in if d = 0 then "" else string_of_int d
in in
fun v -> fun v ->
let repr = UnionFind.find v in let repr = UnionFind.get v in
match repr.name with match repr.name with
None -> let name = next_name () in repr.name <- Some name; name None -> let name = next_name () in repr.name <- Some name; name
| Some x -> x | Some x -> x
...@@ -111,7 +111,7 @@ let rec paren_nt_type colors = function ...@@ -111,7 +111,7 @@ let rec paren_nt_type colors = function
args^" -> *", true args^" -> *", true
and paren_var (white, black) x = and paren_var (white, black) x =
let descr = UnionFind.find x in let descr = UnionFind.get x in
if Mark.same descr.mark white then begin if Mark.same descr.mark white then begin
descr.mark <- black; descr.mark <- black;
var_name x, false var_name x, false
...@@ -150,7 +150,7 @@ let dfs action x = ...@@ -150,7 +150,7 @@ let dfs action x =
let black = Mark.fresh () in let black = Mark.fresh () in
let rec visit_var x = let rec visit_var x =
let descr = UnionFind.find x in let descr = UnionFind.get x in
if not (Mark.same descr.mark black) then begin if not (Mark.same descr.mark black) then begin
descr.mark <- black; descr.mark <- black;
action x; action x;
...@@ -191,7 +191,7 @@ exception BadArityError of int * int ...@@ -191,7 +191,7 @@ exception BadArityError of int * int
let rec unify_var toplevel x y = let rec unify_var toplevel x y =
if not (UnionFind.equivalent x y) then if not (UnionFind.equivalent x y) then
let reprx, repry = UnionFind.find x, UnionFind.find y in let reprx, repry = UnionFind.get x, UnionFind.get y in
match reprx.structure, repry.structure with match reprx.structure, repry.structure with
None, Some _ -> occurs_check x y; UnionFind.union x y None, Some _ -> occurs_check x y; UnionFind.union x y
| Some _, None -> occurs_check y x; UnionFind.union y x | Some _, None -> occurs_check y x; UnionFind.union y x
......
...@@ -70,9 +70,9 @@ let rec repr point = ...@@ -70,9 +70,9 @@ let rec repr point =
| Info _ -> | Info _ ->
point point
(** [find point] returns the descriptor associated with [point]'s (** [get point] returns the descriptor associated with [point]'s
equivalence class. *) equivalence class. *)
let rec find point = let rec get point =
(* By not calling [repr] immediately, we optimize the common cases (* By not calling [repr] immediately, we optimize the common cases
where the path starting at [point] has length 0 or 1, at the where the path starting at [point] has length 0 or 1, at the
...@@ -83,7 +83,7 @@ let rec find point = ...@@ -83,7 +83,7 @@ let rec find point =
| Link { link = Info info } -> | Link { link = Info info } ->
info.descriptor info.descriptor
| Link { link = Link _ } -> | Link { link = Link _ } ->
find (repr point) get (repr point)
let rec set point v = let rec set point v =
match point.link with match point.link with
......
...@@ -25,9 +25,9 @@ type 'a point ...@@ -25,9 +25,9 @@ type 'a point
equivalence class of its own, whose descriptor is [desc]. *) equivalence class of its own, whose descriptor is [desc]. *)
val fresh: 'a -> 'a point val fresh: 'a -> 'a point
(** [find point] returns the descriptor associated with [point]'s (** [get point] returns the descriptor associated with [point]'s
equivalence class. *) equivalence class. *)
val find: 'a point -> 'a val get: 'a point -> 'a
(** [union point1 point2] merges the equivalence classes associated (** [union point1 point2] merges the equivalence classes associated
with [point1] and [point2] into a single class whose descriptor is with [point1] and [point2] into a single class whose descriptor is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment