fluo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject [1/3] incubator-fluo git commit: Made some methods in API private
Date Tue, 09 Aug 2016 20:22:49 GMT
Repository: incubator-fluo
Updated Branches:
  refs/heads/master 0ba6eda18 -> 6cec1483d


Made some methods in API private


Project: http://git-wip-us.apache.org/repos/asf/incubator-fluo/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-fluo/commit/22ea79e6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-fluo/tree/22ea79e6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-fluo/diff/22ea79e6

Branch: refs/heads/master
Commit: 22ea79e6049083e5a1d5fe86940c8271269182ec
Parents: 0ba6eda
Author: Keith Turner <kturner@apache.org>
Authored: Tue Aug 9 13:28:57 2016 -0400
Committer: Keith Turner <kturner@apache.org>
Committed: Tue Aug 9 13:28:57 2016 -0400

----------------------------------------------------------------------
 .../java/org/apache/fluo/api/data/Column.java   |  2 +-
 .../java/org/apache/fluo/api/data/Span.java     | 13 +--
 .../java/org/apache/fluo/api/data/SpanTest.java | 83 +++++++++-----------
 3 files changed, 48 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-fluo/blob/22ea79e6/modules/api/src/main/java/org/apache/fluo/api/data/Column.java
----------------------------------------------------------------------
diff --git a/modules/api/src/main/java/org/apache/fluo/api/data/Column.java b/modules/api/src/main/java/org/apache/fluo/api/data/Column.java
index c1af3bb..fe0c6f0 100644
--- a/modules/api/src/main/java/org/apache/fluo/api/data/Column.java
+++ b/modules/api/src/main/java/org/apache/fluo/api/data/Column.java
@@ -28,7 +28,7 @@ import java.util.Objects;
 public final class Column implements Comparable<Column>, Serializable {
 
   private static final long serialVersionUID = 1L;
-  public static final Bytes UNSET = Bytes.of(new byte[0]);
+  private static final Bytes UNSET = Bytes.of(new byte[0]);
 
   private Bytes family = UNSET;
   private Bytes qualifier = UNSET;

http://git-wip-us.apache.org/repos/asf/incubator-fluo/blob/22ea79e6/modules/api/src/main/java/org/apache/fluo/api/data/Span.java
----------------------------------------------------------------------
diff --git a/modules/api/src/main/java/org/apache/fluo/api/data/Span.java b/modules/api/src/main/java/org/apache/fluo/api/data/Span.java
index a5a9f94..5d668bb 100644
--- a/modules/api/src/main/java/org/apache/fluo/api/data/Span.java
+++ b/modules/api/src/main/java/org/apache/fluo/api/data/Span.java
@@ -42,7 +42,7 @@ public final class Span implements Serializable {
    *
    * @param builder Builder object
    */
-  public Span(Builder builder) {
+  private Span(Builder builder) {
     this.startInclusive = builder.start.inclusive;
     if (!builder.start.infinite) {
       start = buildRowColumn(builder.start);
@@ -323,10 +323,7 @@ public final class Span implements Serializable {
     return prefix(Bytes.of(row), colPrefix);
   }
 
-  /**
-   * @since 1.0.0
-   */
-  public static class KeyBuilder {
+  private static class KeyBuilder {
     protected Bytes row = Bytes.EMPTY;
     protected Bytes cf = Bytes.EMPTY;
     protected Bytes cq = Bytes.EMPTY;
@@ -335,6 +332,10 @@ public final class Span implements Serializable {
     protected boolean infinite = true;
   }
 
+  public static Builder newBuilder() {
+    return new Builder();
+  }
+
   /**
    * @since 1.0.0
    */
@@ -343,6 +344,8 @@ public final class Span implements Serializable {
     private KeyBuilder start = new KeyBuilder();
     private KeyBuilder end = new KeyBuilder();
 
+    private Builder() {}
+
     /**
      * Build start of Span starting with row
      */

http://git-wip-us.apache.org/repos/asf/incubator-fluo/blob/22ea79e6/modules/api/src/test/java/org/apache/fluo/api/data/SpanTest.java
----------------------------------------------------------------------
diff --git a/modules/api/src/test/java/org/apache/fluo/api/data/SpanTest.java b/modules/api/src/test/java/org/apache/fluo/api/data/SpanTest.java
index 7a2b7f5..305b3ba 100644
--- a/modules/api/src/test/java/org/apache/fluo/api/data/SpanTest.java
+++ b/modules/api/src/test/java/org/apache/fluo/api/data/SpanTest.java
@@ -49,23 +49,23 @@ public class SpanTest {
   @Test
   public void testRowRange() {
     // Test with Bytes input
-    Assert.assertEquals(new Span(rw1b, true, rw2b, false), new Span.Builder().startRow(rw1b)
-        .endRow(rw2b).exclusive().build());
-    Assert.assertEquals(new Span(rw1b, false, rw2b, false), new Span.Builder().startRow(rw1b)
+    Assert.assertEquals(new Span(rw1b, true, rw2b, false),
+        Span.newBuilder().startRow(rw1b).endRow(rw2b).exclusive().build());
+    Assert.assertEquals(new Span(rw1b, false, rw2b, false), Span.newBuilder().startRow(rw1b)
         .exclusive().endRow(rw2b).exclusive().build());
     Assert.assertEquals(new Span(rw1b, true, rw2b, true),
-        new Span.Builder().startRow(rw1b).endRow(rw2b).build());
-    Assert.assertEquals(new Span(rw1b, false, rw2b, true), new Span.Builder().startRow(rw1b)
+        Span.newBuilder().startRow(rw1b).endRow(rw2b).build());
+    Assert.assertEquals(new Span(rw1b, false, rw2b, true), Span.newBuilder().startRow(rw1b)
         .exclusive().endRow(rw2b).build());
 
     // Test with String input
-    Assert.assertEquals(new Span(rw1b, true, rw2b, false), new Span.Builder().startRow(rw1s)
-        .endRow(rw2s).exclusive().build());
-    Assert.assertEquals(new Span(rw1b, false, rw2b, false), new Span.Builder().startRow(rw1s)
+    Assert.assertEquals(new Span(rw1b, true, rw2b, false),
+        Span.newBuilder().startRow(rw1s).endRow(rw2s).exclusive().build());
+    Assert.assertEquals(new Span(rw1b, false, rw2b, false), Span.newBuilder().startRow(rw1s)
         .exclusive().endRow(rw2s).exclusive().build());
     Assert.assertEquals(new Span(rw1b, true, rw2b, true),
-        new Span.Builder().startRow(rw1s).endRow(rw2s).build());
-    Assert.assertEquals(new Span(rw1b, false, rw2b, true), new Span.Builder().startRow(rw1s)
+        Span.newBuilder().startRow(rw1s).endRow(rw2s).build());
+    Assert.assertEquals(new Span(rw1b, false, rw2b, true), Span.newBuilder().startRow(rw1s)
         .exclusive().endRow(rw2s).build());
   }
 
@@ -76,14 +76,14 @@ public class SpanTest {
     RowColumn rc2 = new RowColumn(rw2b, new Column(cf2b));
     RowColumn frc2 = rc2.following();
 
-    Assert.assertEquals(new Span(RowColumn.EMPTY, true, frc2, false),
-        new Span.Builder().endRow(rw2b).fam(cf2b).build());
-    Assert.assertEquals(new Span(RowColumn.EMPTY, true, rc2, false), new Span.Builder()
-        .endRow(rw2b).fam(cf2b).exclusive().build());
-    Assert.assertEquals(new Span(rc1, true, RowColumn.EMPTY, true),
-        new Span.Builder().startRow(rw1b).fam(cf1b).build());
+    Assert.assertEquals(new Span(RowColumn.EMPTY, true, frc2, false), Span.newBuilder()
+        .endRow(rw2b).fam(cf2b).build());
+    Assert.assertEquals(new Span(RowColumn.EMPTY, true, rc2, false), Span.newBuilder().endRow(rw2b)
+        .fam(cf2b).exclusive().build());
+    Assert.assertEquals(new Span(rc1, true, RowColumn.EMPTY, true), Span.newBuilder()
+        .startRow(rw1b).fam(cf1b).build());
     Assert.assertEquals(new Span(frc1, true, RowColumn.EMPTY, true),
-        new Span.Builder().startRow(rw1b).fam(cf1b).exclusive().build());
+        Span.newBuilder().startRow(rw1b).fam(cf1b).exclusive().build());
   }
 
   @Test
@@ -93,15 +93,14 @@ public class SpanTest {
     RowColumn rc2 = new RowColumn(rw2b, new Column(cf2b));
     RowColumn frc2 = rc2.following();
 
-    Assert.assertEquals(new Span(rc1, true, frc2, false),
-        new Span.Builder().startRow(rw1b).fam(cf1b).endRow(rw2b).fam(cf2b).build());
-    Assert.assertEquals(new Span(rc1, true, rc2, false), new Span.Builder().startRow(rw1b)
-        .fam(cf1b).endRow(rw2b).fam(cf2b).exclusive().build());
+    Assert.assertEquals(new Span(rc1, true, frc2, false), Span.newBuilder().startRow(rw1b)
+        .fam(cf1b).endRow(rw2b).fam(cf2b).build());
+    Assert.assertEquals(new Span(rc1, true, rc2, false), Span.newBuilder().startRow(rw1b).fam(cf1b)
+        .endRow(rw2b).fam(cf2b).exclusive().build());
     Assert.assertEquals(new Span(frc1, true, frc2, false),
-        new Span.Builder().startRow(rw1b).fam(cf1b).exclusive().endRow(rw2b).fam(cf2b).build());
-    Assert.assertEquals(new Span(frc1, true, rc2, false),
-        new Span.Builder().startRow(rw1b).fam(cf1b).exclusive().endRow(rw2b).fam(cf2b).exclusive()
-            .build());
+        Span.newBuilder().startRow(rw1b).fam(cf1b).exclusive().endRow(rw2b).fam(cf2b).build());
+    Assert.assertEquals(new Span(frc1, true, rc2, false), Span.newBuilder().startRow(rw1b)
+        .fam(cf1b).exclusive().endRow(rw2b).fam(cf2b).exclusive().build());
   }
 
   @Test
@@ -111,17 +110,15 @@ public class SpanTest {
     RowColumn rc2 = new RowColumn(rw2b, new Column(cf2b, cq2b));
     RowColumn frc2 = rc2.following();
 
-    Assert.assertEquals(new Span(rc1, true, frc2, false),
-        new Span.Builder().startRow(rw1b).fam(cf1b).qual(cq1b).endRow(rw2b).fam(cf2b).qual(cq2b)
-            .build());
-    Assert.assertEquals(new Span(rc1, true, rc2, false), new Span.Builder().startRow(rw1b)
-        .fam(cf1b).qual(cq1b).endRow(rw2b).fam(cf2b).qual(cq2b).exclusive().build());
+    Assert.assertEquals(new Span(rc1, true, frc2, false), Span.newBuilder().startRow(rw1b)
+        .fam(cf1b).qual(cq1b).endRow(rw2b).fam(cf2b).qual(cq2b).build());
+    Assert.assertEquals(new Span(rc1, true, rc2, false), Span.newBuilder().startRow(rw1b).fam(cf1b)
+        .qual(cq1b).endRow(rw2b).fam(cf2b).qual(cq2b).exclusive().build());
     Assert.assertEquals(new Span(frc1, true, frc2, false),
-        new Span.Builder().startRow(rw1b).fam(cf1b).qual(cq1b).exclusive().endRow(rw2b).fam(cf2b)
+        Span.newBuilder().startRow(rw1b).fam(cf1b).qual(cq1b).exclusive().endRow(rw2b).fam(cf2b)
             .qual(cq2b).build());
-    Assert.assertEquals(new Span(frc1, true, rc2, false),
-        new Span.Builder().startRow(rw1b).fam(cf1b).qual(cq1b).exclusive().endRow(rw2b).fam(cf2b)
-            .qual(cq2b).exclusive().build());
+    Assert.assertEquals(new Span(frc1, true, rc2, false), Span.newBuilder().startRow(rw1b)
+        .fam(cf1b).qual(cq1b).exclusive().endRow(rw2b).fam(cf2b).qual(cq2b).exclusive().build());
   }
 
   @Test
@@ -131,18 +128,16 @@ public class SpanTest {
     RowColumn rc2 = new RowColumn(rw2b, new Column(cf2b, cq2b, Bytes.of(cv2s)));
     RowColumn frc2 = rc2.following();
 
-    Assert.assertEquals(new Span(rc1, true, frc2, false),
-        new Span.Builder().startRow(rw1b).fam(cf1b).qual(cq1b).vis(cv1b).endRow(rw2b).fam(cf2b)
-            .qual(cq2b).vis(cv2b).build());
-    Assert.assertEquals(new Span(rc1, true, rc2, false), new Span.Builder().startRow(rw1b)
-        .fam(cf1b).qual(cq1b).vis(cv1b).endRow(rw2b).fam(cf2b).qual(cq2b).vis(cv2b).exclusive()
-        .build());
+    Assert.assertEquals(new Span(rc1, true, frc2, false), Span.newBuilder().startRow(rw1b)
+        .fam(cf1b).qual(cq1b).vis(cv1b).endRow(rw2b).fam(cf2b).qual(cq2b).vis(cv2b).build());
+    Assert.assertEquals(new Span(rc1, true, rc2, false), Span.newBuilder().startRow(rw1b).fam(cf1b)
+        .qual(cq1b).vis(cv1b).endRow(rw2b).fam(cf2b).qual(cq2b).vis(cv2b).exclusive().build());
     Assert.assertEquals(new Span(frc1, true, frc2, false),
-        new Span.Builder().startRow(rw1b).fam(cf1b).qual(cq1b).vis(cv1b).exclusive().endRow(rw2b)
+        Span.newBuilder().startRow(rw1b).fam(cf1b).qual(cq1b).vis(cv1b).exclusive().endRow(rw2b)
             .fam(cf2b).qual(cq2b).vis(cv2b).build());
-    Assert.assertEquals(new Span(frc1, true, rc2, false),
-        new Span.Builder().startRow(rw1b).fam(cf1b).qual(cq1b).vis(cv1b).exclusive().endRow(rw2b)
-            .fam(cf2b).qual(cq2b).vis(cv2b).exclusive().build());
+    Assert.assertEquals(new Span(frc1, true, rc2, false), Span.newBuilder().startRow(rw1b)
+        .fam(cf1b).qual(cq1b).vis(cv1b).exclusive().endRow(rw2b).fam(cf2b).qual(cq2b).vis(cv2b)
+        .exclusive().build());
   }
 
   @Test


Mime
View raw message