// Returns a set of @this which depends on any state in @states. // In addition, @rest will contain the inverse set (i.e. everyting in // @this which did _not_ depend on any state in @states). public DependencyFilter DependsOn(IEnumerable <State> states) { DependencyFilter ret = (d_filter ? this : new DependencyFilter(d_graph, this)); ret.d_not = null; // Check for each state if it depends on a state in states. If so, it should // be in the result set, if not it should be in the rest set ret.RemoveWhere((s) => { bool doesdepend = false; foreach (State other in states) { if (d_graph.DependsOn(s, other.Object)) { doesdepend = true; break; } } if (!doesdepend) { if (ret.d_not == null) { ret.d_not = new DependencyFilter(d_graph); } ret.d_not.Add(s); } return(!doesdepend); }); return(ret); }
public DependencyFilter DependencyOf(IEnumerable <State> states) { DependencyFilter ret = (d_filter ? this : new DependencyFilter(d_graph, this)); ret.d_not = null; ret.RemoveWhere((s) => { bool doesdepend = false; foreach (State other in states) { if (d_graph.DependsOn(other, s.Object)) { doesdepend = true; break; } } if (!doesdepend) { if (ret.d_not == null) { ret.d_not = new DependencyFilter(d_graph); } ret.d_not.Add(s); } return(!doesdepend); }); return(ret); }