static private bool Update(IntDomain[] domArray, int index) { int val = domArray[index].Interval.Min; for (int idx = 0; idx < domArray.Length; ++idx) { IntDomain dom = domArray[idx]; if (idx != index && dom.Contains(val)) { dom = dom.Difference(val); if (dom.IsEmpty()) { return(true); } domArray[idx] = dom; if (dom.Interval.IsBound()) { if (Update(domArray, idx)) { return(true); } } } } return(false); }
private void Validate(IntDomain domain, int min, int max) { Assert.AreEqual(domain.Interval, new IntInterval(min, max)); for (int val = min; val <= max; ++val) { Assert.IsTrue(domain.Contains(val)); } }
private void Validate( IntDomain domain, int min, int max ) { Assert.AreEqual( domain.Interval, new IntInterval( min, max ) ); for( int val = min; val <= max; ++val ) { Assert.IsTrue( domain.Contains( val ) ); } }