use of org.bboxdb.commons.math.DoubleInterval in project bboxdb by jnidzwetzki.
the class TestDoubleInterval method testMidpoint1.
/**
* Test midpoint calculation
*/
@Test(timeout = 60000)
public void testMidpoint1() {
final DoubleInterval interval1 = new DoubleInterval(DoubleInterval.MIN_VALUE, DoubleInterval.MAX_VALUE);
Assert.assertEquals(0, interval1.getMidpoint(), 0.0001f);
}
use of org.bboxdb.commons.math.DoubleInterval in project bboxdb by jnidzwetzki.
the class TestDoubleInterval method testIntersection5.
/**
* Test intersection calculation
*/
@Test(timeout = 60000)
public void testIntersection5() {
final DoubleInterval floatInterval2 = new DoubleInterval(5, 10, true, true);
final DoubleInterval floatInterval1 = new DoubleInterval(1, 11, true, true);
Assert.assertTrue(floatInterval2.getIntersection(floatInterval1) != null);
Assert.assertEquals(floatInterval2, floatInterval2.getIntersection(floatInterval1));
Assert.assertTrue(floatInterval1.getIntersection(floatInterval2) != null);
Assert.assertEquals(floatInterval2, floatInterval1.getIntersection(floatInterval2));
}
use of org.bboxdb.commons.math.DoubleInterval in project bboxdb by jnidzwetzki.
the class DistributionRegionComponent method getToolTipText.
/**
* Get the tooltip text
* @return
*/
public String getToolTipText() {
final StringBuilder sb = new StringBuilder("<html>");
try {
final Map<BBoxDBInstance, Map<String, Long>> statistics = addStatisticsToTooltip(sb);
final BoundingBox boundingBox = distributionRegion.getConveringBox();
for (int i = 0; i < boundingBox.getDimension(); i++) {
final DoubleInterval floatInterval = boundingBox.getIntervalForDimension(i);
sb.append("Dimension: " + i + " ");
sb.append(floatInterval.toString());
sb.append("<br>");
}
final Collection<BBoxDBInstance> systems = distributionRegion.getSystems();
for (final BBoxDBInstance instance : systems) {
if (!statistics.keySet().contains(instance)) {
sb.append("System: ");
sb.append(instance.toGUIString(guiModel.isScreenshotMode()));
sb.append(" <br>");
}
}
final boolean mergeableByZookeeper = RegionMergeHelper.isMergingByZookeeperAllowed(distributionRegion);
final boolean mergeableBySpacePartitioner = RegionMergeHelper.isMergingBySpacePartitionerAllowed(distributionRegion);
sb.append("Merge supported by configuration <i>" + mergeableByZookeeper + "</i>, by space partitioner <i>" + mergeableBySpacePartitioner + "</i><br>");
final boolean isSplitSupported = RegionSplitHelper.isSplittingSupported(distributionRegion);
sb.append("Split supported by space partitioner <i>" + isSplitSupported + "</i><br>");
} catch (Exception e) {
logger.error("Got an exception while reading statistics for distribution group", e);
}
sb.append("</html>");
return sb.toString();
}
use of org.bboxdb.commons.math.DoubleInterval in project bboxdb by jnidzwetzki.
the class TestDoubleInterval method testIntersection3.
/**
* Test intersection calculation
*/
@Test(timeout = 60000)
public void testIntersection3() {
final DoubleInterval floatInterval1 = new DoubleInterval(1, 2, true, true);
final DoubleInterval floatInterval2 = new DoubleInterval(2, 3, true, true);
Assert.assertTrue(floatInterval1.getIntersection(floatInterval2) != null);
Assert.assertTrue(floatInterval2.getIntersection(floatInterval1) != null);
final DoubleInterval floatIntervalResult = new DoubleInterval(2, 2, true, true);
Assert.assertEquals(floatIntervalResult, floatInterval1.getIntersection(floatInterval2));
Assert.assertEquals(floatIntervalResult, floatInterval2.getIntersection(floatInterval1));
}
use of org.bboxdb.commons.math.DoubleInterval in project bboxdb by jnidzwetzki.
the class TestDoubleInterval method testIntersection4.
/**
* Test intersection calculation
*/
@Test(timeout = 60000)
public void testIntersection4() {
final DoubleInterval floatInterval1 = new DoubleInterval(5, 10, true, true);
final DoubleInterval floatInterval2 = new DoubleInterval(1, 11, true, true);
Assert.assertTrue(floatInterval1.getIntersection(floatInterval2) != null);
Assert.assertEquals(floatInterval1, floatInterval1.getIntersection(floatInterval2));
Assert.assertTrue(floatInterval2.getIntersection(floatInterval1) != null);
Assert.assertEquals(floatInterval1, floatInterval2.getIntersection(floatInterval1));
}
Aggregations