use of org.bboxdb.commons.math.DoubleInterval in project bboxdb by jnidzwetzki.
the class TestDoubleInterval method testIntersection6.
/**
* Test intersection calculation
*/
@Test(timeout = 60000)
public void testIntersection6() {
final DoubleInterval floatInterval2 = new DoubleInterval(16, 20, true, true);
final DoubleInterval floatInterval1 = new DoubleInterval(1, 11, true, true);
Assert.assertTrue(floatInterval2.getIntersection(floatInterval1) == null);
Assert.assertTrue(floatInterval1.getIntersection(floatInterval2) == null);
}
use of org.bboxdb.commons.math.DoubleInterval in project bboxdb by jnidzwetzki.
the class TestDoubleInterval method coveredPoint2.
/**
* Test cover method
*/
@Test(timeout = 60000)
public void coveredPoint2() {
final DoubleInterval floatInterval = new DoubleInterval(1, 100, false, false);
Assert.assertFalse(floatInterval.isBeginIncluded());
Assert.assertFalse(floatInterval.isEndIncluded());
Assert.assertFalse(floatInterval.overlapsWith(floatInterval.getBegin(), true));
Assert.assertFalse(floatInterval.overlapsWith(floatInterval.getEnd(), true));
Assert.assertFalse(floatInterval.overlapsWith(floatInterval.getBegin(), false));
Assert.assertFalse(floatInterval.overlapsWith(floatInterval.getEnd(), false));
Assert.assertTrue(floatInterval.overlapsWith(50, true));
Assert.assertTrue(floatInterval.overlapsWith(50, false));
Assert.assertFalse(floatInterval.overlapsWith(-10, true));
Assert.assertFalse(floatInterval.overlapsWith(110, true));
}
use of org.bboxdb.commons.math.DoubleInterval in project bboxdb by jnidzwetzki.
the class TestDoubleInterval method intervalCovered2.
/**
* Test overlap method (open intervals)
*/
@Test(timeout = 60000)
public void intervalCovered2() {
final DoubleInterval floatInterval1 = new DoubleInterval(1, 100, false, false);
final DoubleInterval floatInterval2 = new DoubleInterval(50, 150, false, false);
final DoubleInterval floatInterval3 = new DoubleInterval(0, 101, false, false);
final DoubleInterval floatInterval4 = new DoubleInterval(100, 101, false, false);
Assert.assertTrue(floatInterval1.isOverlappingWith(floatInterval2));
Assert.assertTrue(floatInterval2.isOverlappingWith(floatInterval1));
Assert.assertFalse(floatInterval1.isOverlappingWith(floatInterval4));
Assert.assertTrue(floatInterval1.isOverlappingWith(floatInterval3));
Assert.assertTrue(floatInterval3.isOverlappingWith(floatInterval1));
Assert.assertTrue(floatInterval1.isOverlappingWith(floatInterval1));
Assert.assertTrue(floatInterval2.isOverlappingWith(floatInterval2));
Assert.assertTrue(floatInterval3.isOverlappingWith(floatInterval3));
Assert.assertTrue(floatInterval4.isOverlappingWith(floatInterval4));
}
use of org.bboxdb.commons.math.DoubleInterval in project bboxdb by jnidzwetzki.
the class TestDoubleInterval method testIsCovered1.
/**
* The the covering method
*/
@Test(timeout = 60000)
public void testIsCovered1() {
final DoubleInterval floatInterval1 = new DoubleInterval(1, 2, true, true);
final DoubleInterval floatInterval2 = new DoubleInterval(1.5, 3, true, true);
final DoubleInterval floatInterval3 = new DoubleInterval(0, 3, true, true);
Assert.assertFalse(floatInterval1.isCovering(floatInterval2));
Assert.assertFalse(floatInterval1.isCovering(floatInterval3));
Assert.assertTrue(floatInterval3.isCovering(floatInterval1));
Assert.assertTrue(floatInterval3.isCovering(floatInterval2));
}
use of org.bboxdb.commons.math.DoubleInterval in project bboxdb by jnidzwetzki.
the class TestDoubleInterval method testIntervalSplit6.
/**
* Test split at invalid position
*/
@Test(expected = IllegalArgumentException.class)
public void testIntervalSplit6() {
final DoubleInterval interval1 = new DoubleInterval(0, 100, false, false);
interval1.splitAndGetRightPart(-1, false);
}
Aggregations