Пример #1
0
            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);
            }
Пример #2
0
        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));
            }
        }
Пример #3
0
        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 ) );
            }
        }