revert last commit
diff --git a/src/test/java/org/apache/datasketches/theta/SingleItemSketchTest.java b/src/test/java/org/apache/datasketches/theta/SingleItemSketchTest.java
index 3e442d1..ba3c298 100644
--- a/src/test/java/org/apache/datasketches/theta/SingleItemSketchTest.java
+++ b/src/test/java/org/apache/datasketches/theta/SingleItemSketchTest.java
@@ -42,7 +42,7 @@
@Test
public void check1() {
- final Union union = Sketches.setOperationBuilder().buildUnion();
+ Union union = Sketches.setOperationBuilder().buildUnion();
union.update(SingleItemSketch.create(1));
union.update(SingleItemSketch.create(1.0));
union.update(SingleItemSketch.create(0.0));
@@ -54,35 +54,35 @@
union.update(SingleItemSketch.create(-0.0)); //duplicate
- final double est = union.getResult().getEstimate();
+ double est = union.getResult().getEstimate();
println(""+est);
assertEquals(est, 8.0, 0.0);
assertNull(SingleItemSketch.create(""));
- final String str = null;
+ String str = null;
assertNull(SingleItemSketch.create(str));//returns null
assertNull(SingleItemSketch.create(new byte[0]));//returns null
- final byte[] byteArr = null;
+ byte[] byteArr = null;
assertNull(SingleItemSketch.create(byteArr));//returns null
assertNull(SingleItemSketch.create(new char[0]));//returns null
- final char[] charArr = null;
+ char[] charArr = null;
assertNull(SingleItemSketch.create(charArr));//returns null
assertNull(SingleItemSketch.create(new int[0]));//returns null
- final int[] intArr = null;
+ int[] intArr = null;
assertNull(SingleItemSketch.create(intArr));//returns null
assertNull(SingleItemSketch.create(new long[0]));//returns null
- final long[] longArr = null;
+ long[] longArr = null;
assertNull(SingleItemSketch.create(longArr));//returns null
}
@Test
public void check2() {
- final long seed = DEFAULT_UPDATE_SEED;
- final Union union = Sketches.setOperationBuilder().buildUnion();
+ long seed = DEFAULT_UPDATE_SEED;
+ Union union = Sketches.setOperationBuilder().buildUnion();
union.update(SingleItemSketch.create(1, seed));
union.update(SingleItemSketch.create(1.0, seed));
union.update(SingleItemSketch.create(0.0, seed));
@@ -94,34 +94,34 @@
union.update(SingleItemSketch.create(-0.0, seed)); //duplicate
- final double est = union.getResult().getEstimate();
+ double est = union.getResult().getEstimate();
println(""+est);
assertEquals(est, 8.0, 0.0);
assertNull(SingleItemSketch.create("", seed));
- final String str = null;
+ String str = null;
assertNull(SingleItemSketch.create(str, seed));//returns null
assertNull(SingleItemSketch.create(new byte[0], seed));//returns null
- final byte[] byteArr = null;
+ byte[] byteArr = null;
assertNull(SingleItemSketch.create(byteArr, seed));//returns null
assertNull(SingleItemSketch.create(new char[0], seed));//returns null
- final char[] charArr = null;
+ char[] charArr = null;
assertNull(SingleItemSketch.create(charArr, seed));//returns null
assertNull(SingleItemSketch.create(new int[0], seed));//returns null
- final int[] intArr = null;
+ int[] intArr = null;
assertNull(SingleItemSketch.create(intArr, seed));//returns null
assertNull(SingleItemSketch.create(new long[0], seed));//returns null
- final long[] longArr = null;
+ long[] longArr = null;
assertNull(SingleItemSketch.create(longArr, seed));//returns null
}
@Test
public void checkSketchInterface() {
- final SingleItemSketch sis = SingleItemSketch.create(1);
+ SingleItemSketch sis = SingleItemSketch.create(1);
assertEquals(sis.getCompactBytes(), 16);
assertEquals(sis.getEstimate(), 1.0);
assertEquals(sis.getLowerBound(1), 1.0);
@@ -136,27 +136,27 @@
@Test
public void checkLessThanThetaLong() {
for (int i = 0; i < 10; i++) {
- final long[] data = { i };
- final long h = hash(data, DEFAULT_UPDATE_SEED)[0] >>> 1;
- final SingleItemSketch sis = SingleItemSketch.create(i);
- final long halfMax = Long.MAX_VALUE >> 1;
- final int count = sis.getCountLessThanThetaLong(halfMax);
- assertEquals(count, h < halfMax ? 1 : 0);
+ long[] data = { i };
+ long h = hash(data, DEFAULT_UPDATE_SEED)[0] >>> 1;
+ SingleItemSketch sis = SingleItemSketch.create(i);
+ long halfMax = Long.MAX_VALUE >> 1;
+ int count = sis.getCountLessThanThetaLong(halfMax);
+ assertEquals(count, (h < halfMax) ? 1 : 0);
}
}
@Test
public void checkSerDe() {
- final SingleItemSketch sis = SingleItemSketch.create(1);
- final byte[] byteArr = sis.toByteArray();
- final Memory mem = Memory.wrap(byteArr);
- final SingleItemSketch sis2 = SingleItemSketch.heapify(mem);
+ SingleItemSketch sis = SingleItemSketch.create(1);
+ byte[] byteArr = sis.toByteArray();
+ Memory mem = Memory.wrap(byteArr);
+ SingleItemSketch sis2 = SingleItemSketch.heapify(mem);
assertEquals(sis2.getEstimate(), 1.0);
- final SingleItemSketch sis3 = SingleItemSketch.heapify(mem, DEFAULT_UPDATE_SEED);
+ SingleItemSketch sis3 = SingleItemSketch.heapify(mem, DEFAULT_UPDATE_SEED);
assertEquals(sis2.getEstimate(), 1.0);
- final Union union = Sketches.setOperationBuilder().buildUnion();
+ Union union = Sketches.setOperationBuilder().buildUnion();
union.update(sis);
union.update(sis2);
union.update(sis3);
@@ -165,16 +165,16 @@
@Test
public void checkRestricted() {
- final SingleItemSketch sis = SingleItemSketch.create(1);
+ SingleItemSketch sis = SingleItemSketch.create(1);
assertNull(sis.getMemory());
assertEquals(sis.getCompactPreambleLongs(), 1);
}
@Test
public void unionWrapped() {
- final Sketch sketch = SingleItemSketch.create(1);
- final Union union = Sketches.setOperationBuilder().buildUnion();
- final Memory mem = Memory.wrap(sketch.toByteArray());
+ Sketch sketch = SingleItemSketch.create(1);
+ Union union = Sketches.setOperationBuilder().buildUnion();
+ Memory mem = Memory.wrap(sketch.toByteArray());
union.update(mem);
assertEquals(union.getResult().getEstimate(), 1, 0);
}
@@ -229,7 +229,7 @@
//Intersection off-heap
bytes = Sketches.getMaxIntersectionBytes(32);
- final WritableMemory wmem = WritableMemory.wrap(new byte[bytes]);
+ WritableMemory wmem = WritableMemory.wrap(new byte[bytes]);
inter = Sketches.setOperationBuilder().buildIntersection(wmem);
inter.intersect(sk1);
inter.intersect(sk2);
@@ -257,7 +257,7 @@
//Union off-heap
bytes = Sketches.getMaxUnionBytes(32);
- final WritableMemory wmem = WritableMemory.wrap(new byte[bytes]);
+ WritableMemory wmem = WritableMemory.wrap(new byte[bytes]);
union = Sketches.setOperationBuilder().buildUnion(wmem);
union.update(sk1);
union.update(sk2);
@@ -276,7 +276,7 @@
sk2 = Sketches.updateSketchBuilder().setNominalEntries(32).build();
sk1.update(1);
sk2.update(2);
- final AnotB aNotB = Sketches.setOperationBuilder().buildANotB();
+ AnotB aNotB = Sketches.setOperationBuilder().buildANotB();
aNotB.update(sk1, sk2);
csk = aNotB.getResult(true, null);
assertTrue(csk instanceof SingleItemSketch);
@@ -285,32 +285,32 @@
@Test
public void checkHeapifyInstance() {
- final UpdateSketch sk1 = new UpdateSketchBuilder().build();
+ UpdateSketch sk1 = new UpdateSketchBuilder().build();
sk1.update(1);
- final UpdateSketch sk2 = new UpdateSketchBuilder().build();
+ UpdateSketch sk2 = new UpdateSketchBuilder().build();
sk2.update(1);
- final Intersection inter = Sketches.setOperationBuilder().buildIntersection();
+ Intersection inter = Sketches.setOperationBuilder().buildIntersection();
inter.intersect(sk1);
inter.intersect(sk2);
- final WritableMemory wmem = WritableMemory.wrap(new byte[16]);
- final CompactSketch csk = inter.getResult(false, wmem);
+ WritableMemory wmem = WritableMemory.wrap(new byte[16]);
+ CompactSketch csk = inter.getResult(false, wmem);
assertTrue(csk.isOrdered());
- final Sketch csk2 = Sketches.heapifySketch(wmem);
+ Sketch csk2 = Sketches.heapifySketch(wmem);
assertTrue(csk2 instanceof SingleItemSketch);
println(csk2.toString(true, true, 1, true));
}
@Test
public void checkSingleItemBadFlags() {
- final UpdateSketch sk1 = new UpdateSketchBuilder().build();
+ UpdateSketch sk1 = new UpdateSketchBuilder().build();
sk1.update(1);
- final WritableMemory wmem = WritableMemory.allocate(16);
+ WritableMemory wmem = WritableMemory.allocate(16);
sk1.compact(true, wmem);
wmem.putByte(5, (byte) 0); //corrupt flags
try {
SingleItemSketch.heapify(wmem);
fail();
- } catch (final SketchesArgumentException e) { }
+ } catch (SketchesArgumentException e) { }
}
@Test
@@ -325,13 +325,13 @@
@Test
public void checkSingleItemCompact() {
- final UpdateSketch sk1 = new UpdateSketchBuilder().build();
+ UpdateSketch sk1 = new UpdateSketchBuilder().build();
sk1.update(1);
- final CompactSketch csk = sk1.compact();
+ CompactSketch csk = sk1.compact();
assertTrue(csk instanceof SingleItemSketch);
- final CompactSketch csk2 = csk.compact();
+ CompactSketch csk2 = csk.compact();
assertEquals(csk, csk2);
- final CompactSketch csk3 = csk.compact(true, WritableMemory.allocate(16));
+ CompactSketch csk3 = csk.compact(true, WritableMemory.allocate(16));
assertTrue(csk3 instanceof DirectCompactSketch);
assertEquals(csk2.getCurrentPreambleLongs(), 1);
assertEquals(csk3.getCurrentPreambleLongs(), 1);
@@ -343,33 +343,22 @@
static final long Hash = 0x05a186bdcb7df915L;
static Memory siSkWithSiFlag24Bytes() {
- final int cap = 24; //8 extra bytes
- final WritableMemory wmem = WritableMemory.allocate(cap);
+ int cap = 24; //8 extra bytes
+ WritableMemory wmem = WritableMemory.allocate(cap);
wmem.putLong(0, SiSkPre0WithSiFlag);
wmem.putLong(8, Hash);
return wmem;
}
static Memory siSkWoutSiFlag24Bytes() {
- final int cap = 24; //8 extra bytes
- final WritableMemory wmem = WritableMemory.allocate(cap);
+ int cap = 24; //8 extra bytes
+ WritableMemory wmem = WritableMemory.allocate(cap);
wmem.putLong(0, SiSkPre0WoutSiFlag);
wmem.putLong(8, Hash);
return wmem;
}
@Test
- public void checkDruidJira_ADDDRUID_856() {
- final byte[] bytes = { 0x01, 0x03, 0x03, 0x00, 0x00, 0x3A, (byte) 0xCC, (byte) 0x93,
- (byte) 0xB0, (byte) 0xD9, 0x39, 0x5C, 0x25, 0x3E, (byte) 0xD0, 0x29,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
- final Sketch s = Sketches.wrapSketch(Memory.wrap(bytes));
- final Union u = SetOperation.builder().buildUnion();
- u.union(s); //should not throw
- }
-
-
- @Test
public void printlnTest() {
println("PRINTING: "+this.getClass().getName());
}
@@ -377,7 +366,7 @@
/**
* @param s value to print
*/
- static void println(final String s) {
+ static void println(String s) {
//System.out.println(s); //disable here
}