use of org.bboxdb.commons.math.DoubleInterval in project bboxdb by jnidzwetzki.
the class TestDoubleInterval method testIntervalSplit4.
/**
* Test split at invalid position
*/
@Test(expected = IllegalArgumentException.class)
public void testIntervalSplit4() {
final DoubleInterval interval1 = new DoubleInterval(0, 100, false, false);
interval1.splitAndGetLeftPart(0, false);
}
use of org.bboxdb.commons.math.DoubleInterval in project bboxdb by jnidzwetzki.
the class TestDoubleInterval method testRoundedString.
/**
* Test the rounded string method
*/
@Test(timeout = 60000)
public void testRoundedString() {
final DoubleInterval doubleInterval1 = new DoubleInterval(0.4543534d, 0.9423444d, true, true);
final String toStringValue1 = doubleInterval1.toString();
final String roundedValue1 = doubleInterval1.getRoundedString(4);
System.out.println(toStringValue1 + " / " + roundedValue1);
Assert.assertTrue(toStringValue1.length() > roundedValue1.length());
final DoubleInterval doubleInterval2 = new DoubleInterval(1.2d, 4.2d, true, true);
final String toStringValue2 = doubleInterval2.toString();
final String roundedValue2 = doubleInterval2.getRoundedString(4);
System.out.println(toStringValue2 + " / " + roundedValue2);
Assert.assertTrue(toStringValue2.length() >= roundedValue2.length());
}
use of org.bboxdb.commons.math.DoubleInterval in project bboxdb by jnidzwetzki.
the class TestBoundingBoxQuery method executeQueries.
/**
* Execute the bounding box queries
* @param maxDimensionSize
* @param boundingBox
* @param bboxDBConnection
* @throws BBoxDBException
* @throws InterruptedException
* @throws RejectedException
*/
protected void executeQueries(final double maxDimensionSize, final BoundingBox boundingBox, final BBoxDB bboxDBConnection) throws BBoxDBException, InterruptedException, RejectedException {
for (int i = 0; i < QUERIES; i++) {
final List<DoubleInterval> bboxIntervals = new ArrayList<>();
// Determine query bounding box
for (int dimension = 0; dimension < boundingBox.getDimension(); dimension++) {
final double dataExtent = boundingBox.getExtent(dimension);
final double bboxOffset = (random.nextDouble() % 1) * dataExtent;
final double coordinateLow = boundingBox.getCoordinateLow(dimension);
final double coordinateHigh = boundingBox.getCoordinateHigh(dimension);
final double bboxStartPos = coordinateLow + bboxOffset;
final double bboxEndPos = Math.min(bboxStartPos + dataExtent * maxDimensionSize, coordinateHigh);
final DoubleInterval doubleInterval = new DoubleInterval(bboxStartPos, bboxEndPos);
bboxIntervals.add(doubleInterval);
}
final BoundingBox queryBox = new BoundingBox(bboxIntervals);
final TupleListFuture future = bboxDBConnection.queryBoundingBox(tablename, queryBox);
pendingFutures.put(future);
}
pendingFutures.waitForCompletion();
}
use of org.bboxdb.commons.math.DoubleInterval in project bboxdb by jnidzwetzki.
the class TestBoundingBox method testSize.
/**
* Test the size
*/
@Test(timeout = 60000)
public void testSize() {
final BoundingBox boundingBox = new BoundingBox(Arrays.asList(new DoubleInterval(1, 2, true, false)));
Assert.assertTrue(boundingBox.getSize() > 0);
}
use of org.bboxdb.commons.math.DoubleInterval in project bboxdb by jnidzwetzki.
the class TestBoundingBox method testToString.
/**
* Test the to string method
*/
@Test(timeout = 60000)
public void testToString() {
final BoundingBox boundingBox = new BoundingBox(Arrays.asList(new DoubleInterval(1, 2, true, false)));
Assert.assertTrue(boundingBox.toString().length() > 10);
boundingBox.hashCode();
}
Aggregations