Ejemplo n.º 1
0
        /**
         * Test all of the interval operations on the given pair of intervals.
         * "expected_relation" is a sequence of "T" and "F" characters corresponding
         * to the expected results of contains(), interiorContains(), Intersects(),
         * and InteriorIntersects() respectively.
         */

        private void testIntervalOps(R1Interval x, R1Interval y, String expectedRelation)
        {
            JavaAssert.Equal(x.Contains(y), expectedRelation[0] == 'T');
            JavaAssert.Equal(x.InteriorContains(y), expectedRelation[1] == 'T');
            JavaAssert.Equal(x.Intersects(y), expectedRelation[2] == 'T');
            JavaAssert.Equal(x.InteriorIntersects(y), expectedRelation[3] == 'T');

            JavaAssert.Equal(x.Contains(y), x.Union(y).Equals(x));
            JavaAssert.Equal(x.Intersects(y), !x.Intersection(y).IsEmpty);
        }
        /**
  * Test all of the interval operations on the given pair of intervals.
  * "expected_relation" is a sequence of "T" and "F" characters corresponding
  * to the expected results of contains(), interiorContains(), Intersects(),
  * and InteriorIntersects() respectively.
  */

        private void testIntervalOps(R1Interval x, R1Interval y, String expectedRelation)
        {
            JavaAssert.Equal(x.Contains(y), expectedRelation[0] == 'T');
            JavaAssert.Equal(x.InteriorContains(y), expectedRelation[1] == 'T');
            JavaAssert.Equal(x.Intersects(y), expectedRelation[2] == 'T');
            JavaAssert.Equal(x.InteriorIntersects(y), expectedRelation[3] == 'T');

            JavaAssert.Equal(x.Contains(y), x.Union(y).Equals(x));
            JavaAssert.Equal(x.Intersects(y), !x.Intersection(y).IsEmpty);
        }
Ejemplo n.º 3
0
        private static void TestIntervalOps(R1Interval x, R1Interval y, string expected)
        {
            // Test all of the interval operations on the given pair of intervals.
            // "expected" is a sequence of "T" and "F" characters corresponding to
            // the expected results of Contains(), InteriorContains(), Intersects(),
            // and InteriorIntersects() respectively.

            Assert.Equal(expected[0] == 'T', x.Contains(y));
            Assert.Equal(expected[1] == 'T', x.InteriorContains(y));
            Assert.Equal(expected[2] == 'T', x.Intersects(y));
            Assert.Equal(expected[3] == 'T', x.InteriorIntersects(y));

            Assert.Equal(x.Contains(y), x.Union(y) == x);
            Assert.Equal(x.Intersects(y), !x.Intersection(y).IsEmpty());

            R1Interval z = x;

            z = R1Interval.AddInterval(z, y);
            Assert.Equal(x.Union(y), z);
        }