public static void Check <T>(T value, IConstraint condition, string message = null) { if (!condition.Check(value)) { throw new ConditionException(message); } }
public void ApplyConstraint(IConstraint c) { List <Candidate> tmp = new List <Candidate>(); for (int i = 0; i < this.candidates.Count; i++) { if (c.Check(this.candidates[i])) { tmp.Add(this.candidates[i]); } } // reduce list of possible candidates this.candidates = tmp; }