Search in sources :

Example 11 with DoubleInterval

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);
}
Also used : DoubleInterval(org.bboxdb.commons.math.DoubleInterval) Test(org.junit.Test)

Example 12 with DoubleInterval

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));
}
Also used : DoubleInterval(org.bboxdb.commons.math.DoubleInterval) Test(org.junit.Test)

Example 13 with DoubleInterval

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));
}
Also used : DoubleInterval(org.bboxdb.commons.math.DoubleInterval) Test(org.junit.Test)

Example 14 with DoubleInterval

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));
}
Also used : DoubleInterval(org.bboxdb.commons.math.DoubleInterval) Test(org.junit.Test)

Example 15 with DoubleInterval

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);
}
Also used : DoubleInterval(org.bboxdb.commons.math.DoubleInterval) Test(org.junit.Test)

Aggregations

DoubleInterval (org.bboxdb.commons.math.DoubleInterval)38 Test (org.junit.Test)29 BoundingBox (org.bboxdb.commons.math.BoundingBox)10 ArrayList (java.util.ArrayList)5 List (java.util.List)3 Color (java.awt.Color)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 BBoxDBInstance (org.bboxdb.distribution.membership.BBoxDBInstance)1 ZookeeperException (org.bboxdb.distribution.zookeeper.ZookeeperException)1 ZookeeperNotFoundException (org.bboxdb.distribution.zookeeper.ZookeeperNotFoundException)1 TupleListFuture (org.bboxdb.network.client.future.TupleListFuture)1