// constraint.beh -- Constraint map checking. // $Id: constraint.beh,v 1.2 2002/01/04 17:01:40 dougo Exp $ SGEdge { /** Does class graph node w meet the constraint on this strategy edge, under name map N? */ boolean meetsConstraint(Object w, NameMapI N) {{ /* Vi = { ui, vi } U { wi | B(ei)(w) = TRUE } */ GlobSpec a = this.get_source(); GlobSpec b = this.get_target(); return a.match(w, N) || b.match(w, N) || checkConstraint_Node(w, N); }} /** Does class graph edge e meet the constraint on this strategy edge, under name map N? */ boolean meetsConstraint(EdgeI e, NameMapI N) {{ /* Ei = { wi -l-> yi | B(ei)(w -l-> y) = TRUE, and (B(ei)(w) = TRUE or w = u), and (B(ei)(y) = TRUE or y = v) } */ Object w = e.getSource(); Object y = e.getTarget(); GlobSpec a = this.get_source(); GlobSpec b = this.get_target(); return checkConstraint_Edge(e, N) && (a.match(w, N) || checkConstraint_Node(w, N)) && (b.match(y, N) || checkConstraint_Node(y, N)); }} // These two adaptive methods can't have the same name, because of a // bug in the visitor name generation. boolean checkConstraint_Node(Object v, NameMapI N) via Constraint to GlobSpec { init {{ return_val = true; }} before GlobSpec {{ return_val = host.match(v, N); }} after Bypassing {{ return_val = !return_val; }} } boolean checkConstraint_Edge(EdgeI e, NameMapI N) via Constraint to GlobSpec { init {{ return_val = true; }} before GlobSpec {{ return_val = host.match(e, N); }} after Bypassing {{ return_val = !return_val; }} } }