You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2019/11/11 16:02:14 UTC

[incubator-datasketches-java] branch NewHllIterator created (now 38afc41)

This is an automated email from the ASF dual-hosted git repository.

leerho pushed a change to branch NewHllIterator
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-java.git.


      at 38afc41  Make Hll iterators an abstract hierarchy instead of interface.

This branch includes the following new commits:

     new 38afc41  Make Hll iterators an abstract hierarchy instead of interface.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[incubator-datasketches-java] 01/01: Make Hll iterators an abstract hierarchy instead of interface.

Posted by le...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leerho pushed a commit to branch NewHllIterator
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-java.git

commit 38afc41bbf94b022c6c8a97d4fb7c1f6b0fdee69
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Mon Nov 11 08:01:54 2019 -0800

    Make Hll iterators an abstract hierarchy instead of interface.
---
 .../org/apache/datasketches/hll/HllPairIterator.java |  4 +++-
 .../datasketches/hll/IntArrayPairIterator.java       |  2 +-
 .../datasketches/hll/IntMemoryPairIterator.java      |  2 +-
 .../org/apache/datasketches/hll/PairIterator.java    | 20 ++++++++++----------
 4 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/src/main/java/org/apache/datasketches/hll/HllPairIterator.java b/src/main/java/org/apache/datasketches/hll/HllPairIterator.java
index a19f2fc..b7d0c51 100644
--- a/src/main/java/org/apache/datasketches/hll/HllPairIterator.java
+++ b/src/main/java/org/apache/datasketches/hll/HllPairIterator.java
@@ -27,7 +27,7 @@ import static org.apache.datasketches.hll.HllUtil.pair;
  *
  * @author Lee Rhodes
  */
-abstract class HllPairIterator implements PairIterator {
+abstract class HllPairIterator extends PairIterator {
   final int lengthPairs;
   int index;
   int value;
@@ -96,4 +96,6 @@ abstract class HllPairIterator implements PairIterator {
 
   abstract int value();
 
+
+
 }
diff --git a/src/main/java/org/apache/datasketches/hll/IntArrayPairIterator.java b/src/main/java/org/apache/datasketches/hll/IntArrayPairIterator.java
index a932ca4..8bd0415 100644
--- a/src/main/java/org/apache/datasketches/hll/IntArrayPairIterator.java
+++ b/src/main/java/org/apache/datasketches/hll/IntArrayPairIterator.java
@@ -26,7 +26,7 @@ import static org.apache.datasketches.hll.HllUtil.EMPTY;
  *
  * @author Lee Rhodes
  */
-class IntArrayPairIterator implements PairIterator {
+class IntArrayPairIterator extends PairIterator {
   private final int[] array;
   private final int slotMask;
   private final int lengthPairs;
diff --git a/src/main/java/org/apache/datasketches/hll/IntMemoryPairIterator.java b/src/main/java/org/apache/datasketches/hll/IntMemoryPairIterator.java
index 4dd95ac..38b7ad8 100644
--- a/src/main/java/org/apache/datasketches/hll/IntMemoryPairIterator.java
+++ b/src/main/java/org/apache/datasketches/hll/IntMemoryPairIterator.java
@@ -28,7 +28,7 @@ import org.apache.datasketches.memory.Memory;
  *
  * @author Lee Rhodes
  */
-class IntMemoryPairIterator implements PairIterator {
+public class IntMemoryPairIterator extends PairIterator {
   final Memory mem;
   final long offsetBytes;
   final int lengthPairs;
diff --git a/src/main/java/org/apache/datasketches/hll/PairIterator.java b/src/main/java/org/apache/datasketches/hll/PairIterator.java
index cc4fa81..a567d95 100644
--- a/src/main/java/org/apache/datasketches/hll/PairIterator.java
+++ b/src/main/java/org/apache/datasketches/hll/PairIterator.java
@@ -22,13 +22,13 @@ package org.apache.datasketches.hll;
 /**
  * @author Lee Rhodes
  */
-interface PairIterator {
+abstract class PairIterator {
 
   /**
    * Gets the header string for a list of pairs
    * @return the header string for a list of pairs
    */
-  default String getHeader() {
+  String getHeader() {
     return String.format("%10s%10s%10s%6s", "Index", "Key", "Slot", "Value");
   }
 
@@ -36,20 +36,20 @@ interface PairIterator {
    * Gets the index into the array
    * @return the index into the array
    */
-  int getIndex();
+  abstract int getIndex();
 
   /**
    * Gets the key
    * @return the key
    */
-  int getKey();
+  abstract int getKey();
 
   /**
    * Gets the key, value pair as a single int where the key is the lower 26 bits
    * and the value is in the upper 6 bits.
    * @return the key, value pair.
    */
-  int getPair();
+  abstract int getPair();
 
   /**
    * Gets the target or actual HLL slot number, which is derived from the key.
@@ -57,13 +57,13 @@ interface PairIterator {
    * In HLL mode, this will be the actual slot number and equal to the key.
    * @return the target or actual HLL slot number.
    */
-  int getSlot();
+  abstract int getSlot();
 
   /**
    * Gets the current pair as a string
    * @return the current pair as a string
    */
-  default String getString() {
+  String getString() {
     final int index = getIndex();
     final int key = getKey();
     final int slot = getSlot();
@@ -75,20 +75,20 @@ interface PairIterator {
    * Gets the value
    * @return the value
    */
-  int getValue();
+  abstract int getValue();
 
   /**
    * Returns true at the next pair in sequence.
    * If false, the iteration is done.
    * @return true at the next pair in sequence.
    */
-  boolean nextAll();
+  abstract boolean nextAll();
 
   /**
    * Returns true at the next pair where getKey() and getValue() are valid.
    * If false, the iteration is done.
    * @return true at the next pair where getKey() and getValue() are valid.
    */
-  boolean nextValid();
+  abstract boolean nextValid();
 
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org