-- Copyright 1993-1998, by the Cecil Project -- Department of Computer Science and Engineering, University of Washington -- See the LICENSE file for license information. (--DOC `Dominant_union_find_set' is a subclass of `union_find_set' where its instances are known to always become the representative member of the equivalence class. --) abstract object dominant_union_find_set[T <= union_find_set[T]] isa union_find_set[T]; method link_set(x@:`T <= dominant_union_find_set[T], y@:`T <= union_find_set[T]):T { y.parent := x; merge_set(x, y); x } method link_set(x@:`T <= union_find_set[T], y@:`T <= dominant_union_find_set[T]):T { link_set(y, x) } method link_set(x@:dominant_union_find_set[`T], y@:dominant_union_find_set[`T]):T { error("shouldn't have two different dominant ecr's!"); }