Mark deprecated methods with a comment version # so we know when to
delete them.
diff --git a/src/main/java/org/apache/datasketches/kll/KllFloatsSketch.java b/src/main/java/org/apache/datasketches/kll/KllFloatsSketch.java
index cc364e4..6249c12 100644
--- a/src/main/java/org/apache/datasketches/kll/KllFloatsSketch.java
+++ b/src/main/java/org/apache/datasketches/kll/KllFloatsSketch.java
@@ -486,7 +486,7 @@
* sketch normalized as a fraction between zero and one.
*
* @return the rank error normalized as a fraction between zero and one.
- * @deprecated replaced by {@link #getNormalizedRankError(boolean)}
+ * @deprecated v2.0.0. Replaced by {@link #getNormalizedRankError(boolean)}
* @see KllFloatsSketch
*/
@Deprecated
@@ -512,7 +512,7 @@
* @param k the configuration parameter
* @return the normalized "double-sided" rank error as a function of <em>k</em>.
* @see KllFloatsSketch
- * @deprecated replaced by {@link #getNormalizedRankError(int, boolean)}
+ * @deprecated v2.0.0. Replaced by {@link #getNormalizedRankError(int, boolean)}
*/
@Deprecated
public static double getNormalizedRankError(final int k) {
diff --git a/src/main/java/org/apache/datasketches/quantiles/DoublesSketch.java b/src/main/java/org/apache/datasketches/quantiles/DoublesSketch.java
index 7d6e2cf..ec6df57 100644
--- a/src/main/java/org/apache/datasketches/quantiles/DoublesSketch.java
+++ b/src/main/java/org/apache/datasketches/quantiles/DoublesSketch.java
@@ -444,7 +444,7 @@
* returned quantile values.
*
* @return the rank error normalized as a fraction between zero and one.
- * @deprecated replaced by {@link #getNormalizedRankError(boolean)}
+ * @deprecated v2.0.0. Replaced by {@link #getNormalizedRankError(boolean)}
*/
@Deprecated
public double getNormalizedRankError() {
@@ -466,7 +466,7 @@
* Static method version of {@link #getNormalizedRankError()}
* @param k the configuration parameter of a DoublesSketch
* @return the rank error normalized as a fraction between zero and one.
- * @deprecated replaced by {@link #getNormalizedRankError(int, boolean)}
+ * @deprecated v2.0.0. Replaced by {@link #getNormalizedRankError(int, boolean)}
*/
@Deprecated
public static double getNormalizedRankError(final int k) {
diff --git a/src/main/java/org/apache/datasketches/quantiles/DoublesUnionBuilder.java b/src/main/java/org/apache/datasketches/quantiles/DoublesUnionBuilder.java
index 66fdff6..fa8f7db 100644
--- a/src/main/java/org/apache/datasketches/quantiles/DoublesUnionBuilder.java
+++ b/src/main/java/org/apache/datasketches/quantiles/DoublesUnionBuilder.java
@@ -84,7 +84,7 @@
* Returns a Heap Union object that has been initialized with the data from the given sketch.
* @param sketch A DoublesSketch to be used as a source of data only and will not be modified.
* @return a DoublesUnion object
- * @deprecated moved to DoublesUnion
+ * @deprecated v2.0.0. Moved to DoublesUnion
*/
@Deprecated
public static DoublesUnion heapify(final DoublesSketch sketch) {
@@ -98,7 +98,7 @@
* @param srcMem A memory image of a DoublesSketch to be used as a source of data,
* but will not be modified.
* @return a Union object
- * @deprecated moved to DoublesUnion
+ * @deprecated v2.0.0. Moved to DoublesUnion
*/
@Deprecated
public static DoublesUnion heapify(final Memory srcMem) {
@@ -112,7 +112,7 @@
* @param mem A memory region to be used as the data structure for the sketch
* and will be modified.
* @return a Union object
- * @deprecated moved to DoublesUnion
+ * @deprecated v2.0.0. Moved to DoublesUnion
*/
@Deprecated
public static DoublesUnion wrap(final Memory mem) {
@@ -126,7 +126,7 @@
* @param mem A memory region to be used as the data structure for the sketch
* and will be modified.
* @return a Union object
- * @deprecated moved to DoublesUnion
+ * @deprecated v2.0.0. Moved to DoublesUnion
*/
@Deprecated
public static DoublesUnion wrap(final WritableMemory mem) {
diff --git a/src/main/java/org/apache/datasketches/quantiles/ItemsSketch.java b/src/main/java/org/apache/datasketches/quantiles/ItemsSketch.java
index db4ffc7..bf72bf6 100644
--- a/src/main/java/org/apache/datasketches/quantiles/ItemsSketch.java
+++ b/src/main/java/org/apache/datasketches/quantiles/ItemsSketch.java
@@ -185,7 +185,7 @@
ItemsUtil.checkItemsSerVer(serVer);
- if ((serVer == 3) && ((flags & COMPACT_FLAG_MASK) == 0)) {
+ if (serVer == 3 && (flags & COMPACT_FLAG_MASK) == 0) {
throw new SketchesArgumentException("Non-compact Memory images are not supported.");
}
@@ -244,15 +244,15 @@
// this method only uses the base buffer part of the combined buffer
if (dataItem == null) { return; }
- if ((maxValue_ == null) || (comparator_.compare(dataItem, maxValue_) > 0)) { maxValue_ = dataItem; }
- if ((minValue_ == null) || (comparator_.compare(dataItem, minValue_) < 0)) { minValue_ = dataItem; }
+ if (maxValue_ == null || comparator_.compare(dataItem, maxValue_) > 0) { maxValue_ = dataItem; }
+ if (minValue_ == null || comparator_.compare(dataItem, minValue_) < 0) { minValue_ = dataItem; }
- if ((baseBufferCount_ + 1) > combinedBufferItemCapacity_) {
+ if (baseBufferCount_ + 1 > combinedBufferItemCapacity_) {
ItemsSketch.growBaseBuffer(this);
}
combinedBuffer_[baseBufferCount_++] = dataItem;
n_++;
- if (baseBufferCount_ == (2 * k_)) {
+ if (baseBufferCount_ == 2 * k_) {
ItemsUtil.processFullBaseBuffer(this);
}
}
@@ -274,7 +274,7 @@
* @return the approximation to the value at the above fraction
*/
public T getQuantile(final double fraction) {
- if ((fraction < 0.0) || (fraction > 1.0)) {
+ if (fraction < 0.0 || fraction > 1.0) {
throw new SketchesArgumentException("Fraction cannot be less than zero or greater than 1.0");
}
if (fraction == 0.0) { return minValue_; }
@@ -503,7 +503,7 @@
* returned quantile values.
*
* @return the rank error normalized as a fraction between zero and one.
- * @deprecated replaced by {@link #getNormalizedRankError(boolean)}
+ * @deprecated v2.0.0. Replaced by {@link #getNormalizedRankError(boolean)}
*/
@Deprecated
public double getNormalizedRankError() {
@@ -525,7 +525,7 @@
* Static method version of {@link #getNormalizedRankError()}
* @param k the configuration parameter of a ItemsSketch
* @return the rank error normalized as a fraction between zero and one.
- * @deprecated replaced by {@link #getNormalizedRankError(int, boolean)}
+ * @deprecated v2.0.0. Replaced by {@link #getNormalizedRankError(int, boolean)}
*/
@Deprecated
public static double getNormalizedRankError(final int k) {
@@ -578,7 +578,7 @@
* @return true if in estimation mode
*/
public boolean isEstimationMode() {
- return getN() >= (2L * k_);
+ return getN() >= 2L * k_;
}
/**
@@ -775,7 +775,7 @@
final Object[] baseBuffer = sketch.getCombinedBuffer();
final int oldSize = sketch.getCombinedBufferAllocatedCount();
final int k = sketch.getK();
- assert oldSize < (2 * k);
+ assert oldSize < 2 * k;
final int newSize = Math.max(Math.min(2 * k, 2 * oldSize), 1);
sketch.combinedBufferItemCapacity_ = newSize;
sketch.combinedBuffer_ = Arrays.copyOf(baseBuffer, newSize);
diff --git a/src/main/java/org/apache/datasketches/theta/AnotB.java b/src/main/java/org/apache/datasketches/theta/AnotB.java
index 949e304..c194cd6 100644
--- a/src/main/java/org/apache/datasketches/theta/AnotB.java
+++ b/src/main/java/org/apache/datasketches/theta/AnotB.java
@@ -202,7 +202,7 @@
*
* @param skA The incoming sketch for the first argument
* @param skB The incoming sketch for the second argument
- * @deprecated Instead use {@link #aNotB(Sketch, Sketch)}.
+ * @deprecated v2.0.0. Instead use {@link #aNotB(Sketch, Sketch)}.
*/
@Deprecated
public abstract void update(Sketch skA, Sketch skB);
@@ -212,7 +212,7 @@
* as an ordered CompactSketch on the Java heap.
* This clears the state of this operator after the result is returned.
* @return the result of the stateful operations as an ordered CompactSketch on the Java heap.
- * @deprecated Instead use {@link #getResult(boolean)} or
+ * @deprecated v2.0.0. Instead use {@link #getResult(boolean)} or
* {@link #getResult(boolean, WritableMemory, boolean)}.
*/
@Deprecated
@@ -230,7 +230,7 @@
* <a href="{@docRoot}/resources/dictionary.html#dstMem">See Destination Memory</a>.
*
* @return the result of this set operation as a CompactSketch of the chosen form.
- * @deprecated Instead use {@link #getResult(boolean)} or
+ * @deprecated v2.0.0. Instead use {@link #getResult(boolean)} or
* {@link #getResult(boolean, WritableMemory, boolean)}.
*/
@Deprecated
diff --git a/src/main/java/org/apache/datasketches/theta/AnotBimpl.java b/src/main/java/org/apache/datasketches/theta/AnotBimpl.java
index ca6f03d..8d5f9e6 100644
--- a/src/main/java/org/apache/datasketches/theta/AnotBimpl.java
+++ b/src/main/java/org/apache/datasketches/theta/AnotBimpl.java
@@ -85,7 +85,7 @@
@Override
public void notB(final Sketch skB) {
- if (empty_ || (skB == null) || skB.isEmpty()) { return; }
+ if (empty_ || skB == null || skB.isEmpty()) { return; }
//local and skB is not empty
checkSeedHashes(seedHash_, skB.getSeedHash());
@@ -94,7 +94,7 @@
//process B
hashArr_ = getResultHashArr(thetaLong_, curCount_, hashArr_, skB);
curCount_ = hashArr_.length;
- empty_ = (curCount_ == 0) && (thetaLong_ == Long.MAX_VALUE);
+ empty_ = curCount_ == 0 && thetaLong_ == Long.MAX_VALUE;
}
@Override
@@ -114,7 +114,7 @@
@Override
public CompactSketch aNotB(final Sketch skA, final Sketch skB, final boolean dstOrdered,
final WritableMemory dstMem) {
- if ((skA == null) || (skB == null)) {
+ if (skA == null || skB == null) {
throw new SketchesArgumentException("Neither argument may be null");
}
//Both skA & skB are not null
@@ -134,7 +134,7 @@
//process B
final long[] hashArrOut = getResultHashArr(minThetaLong, countA, hashArrA, skB); //out is clone
final int countOut = hashArrOut.length;
- final boolean empty = ((countOut == 0) && (minThetaLong == Long.MAX_VALUE));
+ final boolean empty = countOut == 0 && minThetaLong == Long.MAX_VALUE;
final CompactSketch result = CompactOperations.componentsToCompact(
minThetaLong, countOut, seedHash_, empty, true, false, dstOrdered, dstMem, hashArrOut);
@@ -184,7 +184,7 @@
int nonMatches = 0;
for (int i = 0; i < countA; i++) {
final long hash = hashArrA[i];
- if ((hash != 0) && (hash < minThetaLong)) { //only allows hashes of A < minTheta
+ if (hash != 0 && hash < minThetaLong) { //only allows hashes of A < minTheta
final int index = hashSearch(hashTableB, lgHTBLen, hash);
if (index == -1) {
tmpHashArrA[nonMatches] = hash;
@@ -224,7 +224,7 @@
//Deprecated methods
- @Deprecated
+ @Deprecated //v2.0.0.
@Override
public void update(final Sketch skA, final Sketch skB) {
//duplicate old behavior
diff --git a/src/main/java/org/apache/datasketches/theta/Intersection.java b/src/main/java/org/apache/datasketches/theta/Intersection.java
index c7394ed..9c7e16a 100644
--- a/src/main/java/org/apache/datasketches/theta/Intersection.java
+++ b/src/main/java/org/apache/datasketches/theta/Intersection.java
@@ -106,7 +106,7 @@
* If the given sketch is null the internal state becomes the empty sketch.
* Theta will become the minimum of thetas seen so far.
* @param sketchIn the given sketch
- * @deprecated Use {@link #intersect(Sketch)} instead.
+ * @deprecated v2.0.0. Use {@link #intersect(Sketch)} instead.
*/
@Deprecated
public void update(final Sketch sketchIn) {
@@ -190,7 +190,7 @@
int j = 0;
for (int i = 0; i < len; i++) {
final long v = srcCache[i];
- if ((v <= 0L) || (v >= thetaLong) ) { continue; }
+ if (v <= 0L || v >= thetaLong ) { continue; }
cacheOut[j++] = v;
}
assert curCount == j;
diff --git a/src/main/java/org/apache/datasketches/theta/PairwiseSetOperations.java b/src/main/java/org/apache/datasketches/theta/PairwiseSetOperations.java
index fc24f53..d1dc972 100644
--- a/src/main/java/org/apache/datasketches/theta/PairwiseSetOperations.java
+++ b/src/main/java/org/apache/datasketches/theta/PairwiseSetOperations.java
@@ -29,7 +29,7 @@
* Heap-based or Direct.
*
* @author Lee Rhodes
- * @deprecated This class has been deprecated as equivalent functionality has been added to the
+ * @deprecated v2.0.0. This class has been deprecated as equivalent functionality has been added to the
* SetOperation classes: {@link Union}, {@link Intersection} and {@link AnotB}.
*/
@Deprecated
@@ -43,7 +43,7 @@
* @param skA The first Sketch argument.
* @param skB The second Sketch argument.
* @return the result as an ordered CompactSketch on the heap.
- * @deprecated Use {@link Intersection#intersect(Sketch, Sketch)} instead, which has more
+ * @deprecated v2.0.0. Use {@link Intersection#intersect(Sketch, Sketch)} instead, which has more
* complete seed handling.
*/
@Deprecated
@@ -60,7 +60,7 @@
* @param skA The first Sketch argument.
* @param skB The second Sketch argument.
* @return the result as an ordered CompactSketch on the heap.
- * @deprecated Use {@link AnotB#aNotB(Sketch, Sketch)} instead, which has more
+ * @deprecated v2.0.0. Use {@link AnotB#aNotB(Sketch, Sketch)} instead, which has more
* complete seed handling.
*/
@Deprecated
@@ -80,7 +80,7 @@
* @param skA The first ordered, CompactSketch argument.
* @param skB The second ordered, CompactSketch argument
* @return the result as an ordered CompactSketch.
- * @deprecated Please use {@link Union#union(Sketch, Sketch)} instead, which has more
+ * @deprecated v2.0.0. Please use {@link Union#union(Sketch, Sketch)} instead, which has more
* complete seed handling.
*/
@Deprecated
@@ -101,7 +101,7 @@
* @param skB The second ordered, CompactSketch argument
* @param k The upper bound of the number of entries to be retained by the sketch
* @return the result as an ordered CompactSketch.
- * @deprecated Please use {@link Union#union(Sketch, Sketch)} instead, which has more
+ * @deprecated v2.0.0. Please use {@link Union#union(Sketch, Sketch)} instead, which has more
* complete seed handling.
*/
@Deprecated
diff --git a/src/main/java/org/apache/datasketches/theta/Sketch.java b/src/main/java/org/apache/datasketches/theta/Sketch.java
index 9ea8f7b..12541df 100644
--- a/src/main/java/org/apache/datasketches/theta/Sketch.java
+++ b/src/main/java/org/apache/datasketches/theta/Sketch.java
@@ -135,7 +135,7 @@
final Family family = Family.idToFamily(familyID);
switch (family) {
case QUICKSELECT: { //Hash Table structure
- if ((serVer == 3) && (preLongs == 3)) {
+ if (serVer == 3 && preLongs == 3) {
return DirectQuickSelectSketchR.readOnlyWrap(srcMem, seed);
} else {
throw new SketchesArgumentException(
@@ -233,7 +233,7 @@
* Gets the number of hash values less than the given theta.
* @param theta the given theta as a double between zero and one.
* @return the number of hash values less than the given theta.
- * @deprecated Use {@link #getCountLessThanThetaLong(long)}. It is more accurate.
+ * @deprecated v2.0.0. Use {@link #getCountLessThanThetaLong(long)}. It is more accurate.
*/
@Deprecated
public int getCountLessThanTheta(final double theta) {
@@ -255,7 +255,7 @@
* @param compact if true, returns the bytes required for compact form.
* If this sketch is already in compact form this parameter is ignored.
* @return the number of storage bytes required for this sketch
- * @deprecated use either {@link #getCompactBytes()} or {@link #getCurrentBytes()}.
+ * @deprecated v2.0.0. use either {@link #getCompactBytes()} or {@link #getCurrentBytes()}.
*/
@Deprecated
public int getCurrentBytes(final boolean compact) {
@@ -290,7 +290,7 @@
* @return the lower bound.
*/
public double getLowerBound(final int numStdDev) {
- return (isEstimationMode())
+ return isEstimationMode()
? lowerBound(getRetainedEntries(true), getThetaLong(), numStdDev, isEmpty())
: getRetainedEntries(true);
}
@@ -372,7 +372,7 @@
* @return the upper bound.
*/
public double getUpperBound(final int numStdDev) {
- return (isEstimationMode())
+ return isEstimationMode()
? upperBound(getRetainedEntries(true), getThetaLong(), numStdDev, isEmpty())
: getRetainedEntries(true);
}
@@ -475,7 +475,7 @@
int arrLongs = cache.length;
float p = 0;
int rf = 0;
- final boolean updateSketch = (this instanceof UpdateSketch);
+ final boolean updateSketch = this instanceof UpdateSketch;
final long thetaLong = getThetaLong();
final int curCount = this.getRetainedEntries(true);
@@ -489,17 +489,17 @@
}
if (dataDetail) {
- final int w = (width > 0) ? width : 8; // default is 8 wide
+ final int w = width > 0 ? width : 8; // default is 8 wide
if (curCount > 0) {
sb.append("### SKETCH DATA DETAIL");
for (int i = 0, j = 0; i < arrLongs; i++ ) {
final long h;
h = cache[i];
- if ((h <= 0) || (h >= thetaLong)) {
+ if (h <= 0 || h >= thetaLong) {
continue;
}
- if ((j % w) == 0) {
- sb.append(LS).append(String.format(" %6d", (j + 1)));
+ if (j % w == 0) {
+ sb.append(LS).append(String.format(" %6d", j + 1));
}
if (hexMode) {
sb.append(" " + zeroPad(Long.toHexString(h), 16) + ",");
@@ -612,9 +612,9 @@
* @return true if given Family id is one of the theta sketches
*/
static final boolean isValidSketchID(final int id) {
- return (id == Family.ALPHA.getID())
- || (id == Family.QUICKSELECT.getID())
- || (id == Family.COMPACT.getID());
+ return id == Family.ALPHA.getID()
+ || id == Family.QUICKSELECT.getID()
+ || id == Family.COMPACT.getID();
}
/**
@@ -625,11 +625,11 @@
final Memory mem = sketch.getMemory();
if (mem == null) { return; }
final int flags = PreambleUtil.extractFlags(mem);
- if (((flags & COMPACT_FLAG_MASK) > 0) ^ sketch.isCompact()) {
+ if ((flags & COMPACT_FLAG_MASK) > 0 ^ sketch.isCompact()) {
throw new SketchesArgumentException("Possible corruption: "
+ "Memory Compact Flag inconsistent with Sketch");
}
- if (((flags & ORDERED_FLAG_MASK) > 0) ^ sketch.isOrdered()) {
+ if ((flags & ORDERED_FLAG_MASK) > 0 ^ sketch.isOrdered()) {
throw new SketchesArgumentException("Possible corruption: "
+ "Memory Ordered Flag inconsistent with Sketch");
}
@@ -652,7 +652,7 @@
}
private static final boolean estMode(final long thetaLong, final boolean empty) {
- return (thetaLong < Long.MAX_VALUE) && !empty;
+ return thetaLong < Long.MAX_VALUE && !empty;
}
/**
diff --git a/src/main/java/org/apache/datasketches/tuple/AnotB.java b/src/main/java/org/apache/datasketches/tuple/AnotB.java
index 0292315..10202be 100644
--- a/src/main/java/org/apache/datasketches/tuple/AnotB.java
+++ b/src/main/java/org/apache/datasketches/tuple/AnotB.java
@@ -144,7 +144,7 @@
* @param skB The incoming Tuple sketch for the second (or following) argument <i>B</i>.
*/
public void notB(final Sketch<S> skB) {
- if (empty_ || (skB == null) || skB.isEmpty() || (hashArr_ == null)) { return; }
+ if (empty_ || skB == null || skB.isEmpty() || hashArr_ == null) { return; }
//skB is not empty
final long thetaLongB = skB.getThetaLong();
thetaLong_ = Math.min(thetaLong_, thetaLongB);
@@ -155,7 +155,7 @@
summaryArr_ = daB.summaryArr;
curCount_ = hashArr_.length;
- empty_ = (curCount_ == 0) && (thetaLong_ == Long.MAX_VALUE);
+ empty_ = curCount_ == 0 && thetaLong_ == Long.MAX_VALUE;
}
/**
@@ -178,7 +178,7 @@
* @param skB The incoming Theta sketch for the second (or following) argument <i>B</i>.
*/
public void notB(final org.apache.datasketches.theta.Sketch skB) {
- if (empty_ || (skB == null) || skB.isEmpty()) { return; }
+ if (empty_ || skB == null || skB.isEmpty()) { return; }
//skB is not empty
final long thetaLongB = skB.getThetaLong();
thetaLong_ = Math.min(thetaLong_, thetaLongB);
@@ -189,7 +189,7 @@
summaryArr_ = daB.summaryArr;
curCount_ = hashArr_.length;
- empty_ = (curCount_ == 0) && (thetaLong_ == Long.MAX_VALUE);
+ empty_ = curCount_ == 0 && thetaLong_ == Long.MAX_VALUE;
}
/**
@@ -237,7 +237,7 @@
*/
public static <S extends Summary>
CompactSketch<S> aNotB(final Sketch<S> skA, final Sketch<S> skB) {
- if ((skA == null) || (skB == null)) {
+ if (skA == null || skB == null) {
throw new SketchesArgumentException("Neither argument may be null");
}
if (skA.isEmpty()) { return skA.compact(); }
@@ -257,7 +257,7 @@
final long[] hashArr = daB.hashArr;
final S[] summaryArr = daB.summaryArr;
final int curCountOut = hashArr.length;
- final boolean empty = ((curCountOut == 0) && (minThetaLong == Long.MAX_VALUE));
+ final boolean empty = curCountOut == 0 && minThetaLong == Long.MAX_VALUE;
final CompactSketch<S> result = new CompactSketch<>(hashArr, summaryArr, minThetaLong, empty);
return result;
@@ -289,7 +289,7 @@
*/
public static <S extends Summary>
CompactSketch<S> aNotB(final Sketch<S> skA, final org.apache.datasketches.theta.Sketch skB) {
- if ((skA == null) || (skB == null)) {
+ if (skA == null || skB == null) {
throw new SketchesArgumentException("Neither argument may be null");
}
//Both skA & skB are not null
@@ -311,7 +311,7 @@
final long[] hashArr = daB.hashArr;
final S[] summaryArr = daB.summaryArr;
final int countOut = hashArr.length;
- final boolean empty = (countOut == 0) && (minThetaLong == Long.MAX_VALUE);
+ final boolean empty = countOut == 0 && minThetaLong == Long.MAX_VALUE;
final CompactSketch<S> result = new CompactSketch<>(hashArr, summaryArr, minThetaLong, empty);
return result;
@@ -370,7 +370,7 @@
int nonMatches = 0;
for (int i = 0; i < countA; i++) {
final long hash = hashArrA[i];
- if ((hash != 0) && (hash < minThetaLong)) { //skips hashes of A >= minTheta
+ if (hash != 0 && hash < minThetaLong) { //skips hashes of A >= minTheta
final int index = hashSearch(hashTableB, lgHTBLen, hash);
if (index == -1) {
tmpHashArrA[nonMatches] = hash;
@@ -418,7 +418,7 @@
int nonMatches = 0;
for (int i = 0; i < countA; i++) {
final long hash = hashArrA[i];
- if ((hash != 0) && (hash < minThetaLong)) { //skips hashes of A >= minTheta
+ if (hash != 0 && hash < minThetaLong) { //skips hashes of A >= minTheta
final int index = hashSearch(hashTableB, lgHTBLen, hash);
if (index == -1) {
tmpHashArrA[nonMatches] = hash;
@@ -455,7 +455,7 @@
*
* @param skA The incoming sketch for the first argument
* @param skB The incoming sketch for the second argument
- * @deprecated Instead please use {@link #aNotB(Sketch, Sketch)}.
+ * @deprecated v2.0.0. Instead please use {@link #aNotB(Sketch, Sketch)}.
*/
@Deprecated
public void update(final Sketch<S> skA, final Sketch<S> skB) {
@@ -471,7 +471,7 @@
* Gets the result of this operation. This clears the state of this operator after the result is
* returned.
* @return the result of this operation as a CompactSketch
- * @deprecated Instead use {@link #getResult(boolean)}.
+ * @deprecated v2.0.0. Instead use {@link #getResult(boolean)}.
*/
@Deprecated
public CompactSketch<S> getResult() {
diff --git a/src/main/java/org/apache/datasketches/tuple/SketchIterator.java b/src/main/java/org/apache/datasketches/tuple/SketchIterator.java
index 43ef64f..7453dd8 100644
--- a/src/main/java/org/apache/datasketches/tuple/SketchIterator.java
+++ b/src/main/java/org/apache/datasketches/tuple/SketchIterator.java
@@ -25,8 +25,8 @@
*/
public class SketchIterator<S extends Summary> {
- private long[] hashArrTbl_; //could be either hashArr or hashTable
- private S[] summaryArrTbl_; //could be either summaryArr or summaryTable
+ private final long[] hashArrTbl_; //could be either hashArr or hashTable
+ private final S[] summaryArrTbl_; //could be either summaryArr or summaryTable
private int i_;
SketchIterator(final long[] hashes, final S[] summaries) {
@@ -57,7 +57,7 @@
* retained. Don't call this before calling next() for the first time
* or after getting false from next().
* @return hash from the current entry
- * @deprecated Please use {@link #getHash()}
+ * @deprecated v2.0.0. Please use {@link #getHash()}
*/
@Deprecated
public long getKey() {
diff --git a/src/test/java/org/apache/datasketches/kll/DeprecatedAndMiscTest.java b/src/test/java/org/apache/datasketches/kll/DeprecatedAndMiscTest.java
index 938b23f..14ab96c 100644
--- a/src/test/java/org/apache/datasketches/kll/DeprecatedAndMiscTest.java
+++ b/src/test/java/org/apache/datasketches/kll/DeprecatedAndMiscTest.java
@@ -34,8 +34,8 @@
public void checkDeprecatedRankError() {
final KllFloatsSketch sketch = new KllFloatsSketch();
final int k = KllFloatsSketch.DEFAULT_K;
- final double eps1 = sketch.getNormalizedRankError();
- final double eps2 = KllFloatsSketch.getNormalizedRankError(k);
+ final double eps1 = sketch.getNormalizedRankError(); //v2.0.0.
+ final double eps2 = KllFloatsSketch.getNormalizedRankError(k); //v2.0.0.
final double expectEps = KllFloatsSketch.getNormalizedRankError(k, true);
assertEquals(eps1, expectEps);
assertEquals(eps2, expectEps);
diff --git a/src/test/java/org/apache/datasketches/quantiles/DeprecatedAndMiscTest.java b/src/test/java/org/apache/datasketches/quantiles/DeprecatedAndMiscTest.java
index 8a9b88d..a92abb7 100644
--- a/src/test/java/org/apache/datasketches/quantiles/DeprecatedAndMiscTest.java
+++ b/src/test/java/org/apache/datasketches/quantiles/DeprecatedAndMiscTest.java
@@ -23,10 +23,9 @@
import java.util.Comparator;
-import org.testng.annotations.Test;
-
import org.apache.datasketches.memory.Memory;
import org.apache.datasketches.memory.WritableMemory;
+import org.testng.annotations.Test;
/**
* @author Lee Rhodes
@@ -37,22 +36,22 @@
@SuppressWarnings({ "deprecation", "unused" })
@Test
public void checkDeprecatedRankError() {
- DoublesSketch ds = buildAndLoadQS(64, 64);
- double err = ds.getNormalizedRankError();
- err = DoublesSketch.getNormalizedRankError(64);
- DoublesUnion du1 = DoublesUnionBuilder.heapify(ds);
+ final DoublesSketch ds = buildAndLoadQS(64, 64);
+ double err = ds.getNormalizedRankError(); //v2.0.0.
+ err = DoublesSketch.getNormalizedRankError(64); //v2.0.0.
+ final DoublesUnion du1 = DoublesUnionBuilder.heapify(ds); //v2.0.0.
- Memory mem = Memory.wrap(ds.toByteArray());
- DoublesUnion du2 = DoublesUnionBuilder.heapify(mem);
+ final Memory mem = Memory.wrap(ds.toByteArray());
+ final DoublesUnion du2 = DoublesUnionBuilder.heapify(mem); //v2.0.0.
- DoublesUnion du3 = DoublesUnionBuilder.wrap(mem);
+ final DoublesUnion du3 = DoublesUnionBuilder.wrap(mem); //v2.0.0.
- WritableMemory wmem = WritableMemory.wrap(ds.toByteArray());
- DoublesUnion du4 = DoublesUnionBuilder.wrap(wmem);
+ final WritableMemory wmem = WritableMemory.wrap(ds.toByteArray());
+ final DoublesUnion du4 = DoublesUnionBuilder.wrap(wmem); //v2.0.0.
- ItemsSketch<String> is = ItemsSketch.getInstance(64, Comparator.naturalOrder());
- err = is.getNormalizedRankError();
- err = ItemsSketch.getNormalizedRankError(64);
+ final ItemsSketch<String> is = ItemsSketch.getInstance(64, Comparator.naturalOrder());
+ err = is.getNormalizedRankError(); //v2.0.0.
+ err = ItemsSketch.getNormalizedRankError(64); //v2.0.0.
}
}
diff --git a/src/test/java/org/apache/datasketches/theta/HeapIntersectionTest.java b/src/test/java/org/apache/datasketches/theta/HeapIntersectionTest.java
index 2a63c7d..736b1e5 100644
--- a/src/test/java/org/apache/datasketches/theta/HeapIntersectionTest.java
+++ b/src/test/java/org/apache/datasketches/theta/HeapIntersectionTest.java
@@ -60,7 +60,7 @@
final Intersection inter = SetOperation.builder().buildIntersection();
inter.intersect(usk1);
- inter.update(usk2); //check deprecated
+ inter.update(usk2); //check deprecated v2.0.0.
CompactSketch rsk1;
final boolean ordered = true;
diff --git a/src/test/java/org/apache/datasketches/tuple/adouble/AdoubleAnotBTest.java b/src/test/java/org/apache/datasketches/tuple/adouble/AdoubleAnotBTest.java
index 4ca8518..a2eae9d 100644
--- a/src/test/java/org/apache/datasketches/tuple/adouble/AdoubleAnotBTest.java
+++ b/src/test/java/org/apache/datasketches/tuple/adouble/AdoubleAnotBTest.java
@@ -54,14 +54,14 @@
{
CompactSketch<DoubleSummary> result;
- //Deprecated, Stateless, A = Tuple, B = Tuple
+ //Deprecated v2.0.0., Stateless, A = Tuple, B = Tuple
//Old behavior is tolerant of nulls
aNotB.update(skA, skB);
result = aNotB.getResult();
results.check(result);
//Stateless A = Tuple, B = Tuple
- if ((skA == null) || (skB == null)) {
+ if (skA == null || skB == null) {
try {
result = AnotB.aNotB(skA, skB);
fail();
@@ -73,7 +73,7 @@
}
//Stateless A = Tuple, B = Theta
- if ((skA == null) || (skThetaB == null)) {
+ if (skA == null || skThetaB == null) {
try { result = AnotB.aNotB(skA, skThetaB); fail(); }
catch (final SketchesArgumentException e) { }
} else {
@@ -129,7 +129,7 @@
assertEquals(result.getRetainedEntries(), retEnt);
assertEquals(result.isEmpty(), empty);
if (result.getTheta() < 1.0) {
- double est = result.getEstimate();
+ final double est = result.getEstimate();
assertEquals(est, expect, expect * tol);
assertTrue(result.getUpperBound(1) > est);
assertTrue(result.getLowerBound(1) <= est);
@@ -138,7 +138,7 @@
assertEquals(result.getUpperBound(1), expect, 0.0);
assertEquals(result.getLowerBound(1), expect, 0.0);
}
- SketchIterator<DoubleSummary> it = result.iterator();
+ final SketchIterator<DoubleSummary> it = result.iterator();
while (it.next()) {
Assert.assertEquals(it.getSummary().getValue(), sum);
}
@@ -158,13 +158,13 @@
@SuppressWarnings("deprecation")
@Test
public void aNotBNullEmptyCombinations() {
- AnotB<DoubleSummary> aNotB = new AnotB<>();
+ final AnotB<DoubleSummary> aNotB = new AnotB<>();
// calling getResult() before calling update() should yield an empty set
- CompactSketch<DoubleSummary> result = aNotB.getResult();
+ final CompactSketch<DoubleSummary> result = aNotB.getResult();
results.set(0, true, 0.0, 0.0, 0.0).check(result);
- UpdatableSketch<Double, DoubleSummary> sketch = buildUpdatableTuple();
- UpdateSketch skTheta = buildUpdateTheta();
+ final UpdatableSketch<Double, DoubleSummary> sketch = buildUpdatableTuple();
+ final UpdateSketch skTheta = buildUpdateTheta();
threeMethodsWithTheta(aNotB, null, null, null, results);
threeMethodsWithTheta(aNotB, sketch, null, null, results);
@@ -178,11 +178,11 @@
@Test
public void aNotBCheckDoubleSetAs() {
- UpdatableSketch<Double, DoubleSummary> skA = buildUpdatableTuple();
+ final UpdatableSketch<Double, DoubleSummary> skA = buildUpdatableTuple();
skA.update(1, 1.0);
skA.update(2, 1.0);
- UpdatableSketch<Double, DoubleSummary> skA2 = buildUpdatableTuple();
- AnotB<DoubleSummary> aNotB = new AnotB<>();
+ final UpdatableSketch<Double, DoubleSummary> skA2 = buildUpdatableTuple();
+ final AnotB<DoubleSummary> aNotB = new AnotB<>();
aNotB.setA(skA);
assertEquals(aNotB.getResult(false).isEmpty(), false);
aNotB.setA(skA2);
@@ -191,28 +191,28 @@
@Test
public void aNotBEmptyExact() {
- UpdatableSketch<Double, DoubleSummary> sketchA = buildUpdatableTuple();
- UpdatableSketch<Double, DoubleSummary> sketchB = buildUpdatableTuple();
+ final UpdatableSketch<Double, DoubleSummary> sketchA = buildUpdatableTuple();
+ final UpdatableSketch<Double, DoubleSummary> sketchB = buildUpdatableTuple();
sketchB.update(1, 1.0);
sketchB.update(2, 1.0);
- UpdateSketch skThetaB = buildUpdateTheta();
+ final UpdateSketch skThetaB = buildUpdateTheta();
skThetaB.update(1);
skThetaB.update(2);
- AnotB<DoubleSummary> aNotB = new AnotB<>();
+ final AnotB<DoubleSummary> aNotB = new AnotB<>();
results.set(0, true, 0.0, 0.0, 0.0);
threeMethodsWithTheta(aNotB, sketchA, sketchB, skThetaB, results);
}
@Test
public void aNotBExactEmpty() {
- UpdatableSketch<Double, DoubleSummary> sketchA = buildUpdatableTuple();
+ final UpdatableSketch<Double, DoubleSummary> sketchA = buildUpdatableTuple();
sketchA.update(1, 1.0);
sketchA.update(2, 1.0);
- UpdatableSketch<Double, DoubleSummary> sketchB = buildUpdatableTuple();
- UpdateSketch skThetaB = buildUpdateTheta();
+ final UpdatableSketch<Double, DoubleSummary> sketchB = buildUpdatableTuple();
+ final UpdateSketch skThetaB = buildUpdateTheta();
- AnotB<DoubleSummary> aNotB = new AnotB<>();
+ final AnotB<DoubleSummary> aNotB = new AnotB<>();
results.set(2, false, 2.0, 0.0, 1.0);
threeMethodsWithTheta(aNotB, sketchA, sketchB, skThetaB, results);
@@ -222,45 +222,45 @@
@Test
public void aNotBExactOverlap() {
- UpdatableSketch<Double, DoubleSummary> sketchA = buildUpdatableTuple();
+ final UpdatableSketch<Double, DoubleSummary> sketchA = buildUpdatableTuple();
sketchA.update(1, 1.0);
sketchA.update(1, 1.0);
sketchA.update(2, 1.0);
sketchA.update(2, 1.0);
- UpdatableSketch<Double, DoubleSummary> sketchB = buildUpdatableTuple();
+ final UpdatableSketch<Double, DoubleSummary> sketchB = buildUpdatableTuple();
sketchB.update(2, 1.0);
sketchB.update(2, 1.0);
sketchB.update(3, 1.0);
sketchB.update(3, 1.0);
- UpdateSketch skThetaB = buildUpdateTheta();
+ final UpdateSketch skThetaB = buildUpdateTheta();
skThetaB.update(2);
skThetaB.update(3);
- AnotB<DoubleSummary> aNotB = new AnotB<>();
+ final AnotB<DoubleSummary> aNotB = new AnotB<>();
results.set(1, false, 1.0, 0.0, 2.0);
threeMethodsWithTheta(aNotB, sketchA, sketchB, skThetaB, results);
}
@Test
public void aNotBEstimationOverlap() {
- UpdatableSketch<Double, DoubleSummary> sketchA = buildUpdatableTuple();
+ final UpdatableSketch<Double, DoubleSummary> sketchA = buildUpdatableTuple();
for (int i = 0; i < 8192; i++) {
sketchA.update(i, 1.0);
}
- UpdatableSketch<Double, DoubleSummary> sketchB = buildUpdatableTuple();
+ final UpdatableSketch<Double, DoubleSummary> sketchB = buildUpdatableTuple();
for (int i = 0; i < 4096; i++) {
sketchB.update(i, 1.0);
}
- UpdateSketch skThetaB = buildUpdateTheta();
+ final UpdateSketch skThetaB = buildUpdateTheta();
for (int i = 0; i < 4096; i++) {
skThetaB.update(i);
}
- AnotB<DoubleSummary> aNotB = new AnotB<>();
+ final AnotB<DoubleSummary> aNotB = new AnotB<>();
results.set(2123, false, 4096.0, 0.03, 1.0);
threeMethodsWithTheta(aNotB, sketchA, sketchB, skThetaB, results);
@@ -270,23 +270,23 @@
@Test
public void aNotBEstimationOverlapLargeB() {
- UpdatableSketch<Double, DoubleSummary> sketchA = buildUpdatableTuple();
+ final UpdatableSketch<Double, DoubleSummary> sketchA = buildUpdatableTuple();
for (int i = 0; i < 10_000; i++) {
sketchA.update(i, 1.0);
}
- UpdatableSketch<Double, DoubleSummary> sketchB = buildUpdatableTuple();
+ final UpdatableSketch<Double, DoubleSummary> sketchB = buildUpdatableTuple();
for (int i = 0; i < 100_000; i++) {
sketchB.update(i + 8000, 1.0);
}
- UpdateSketch skThetaB = buildUpdateTheta();
+ final UpdateSketch skThetaB = buildUpdateTheta();
for (int i = 0; i < 100_000; i++) {
skThetaB.update(i + 8000);
}
final int expected = 8_000;
- AnotB<DoubleSummary> aNotB = new AnotB<>();
+ final AnotB<DoubleSummary> aNotB = new AnotB<>();
results.set(376, false, expected, 0.1, 1.0);
threeMethodsWithTheta(aNotB, sketchA, sketchB, skThetaB, results);