jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [4/9] jena git commit: Using static factory methods instead of constructors
Date Sat, 30 Jan 2016 21:41:43 GMT
Using static factory methods instead of constructors


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/78fb03fd
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/78fb03fd
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/78fb03fd

Branch: refs/heads/master
Commit: 78fb03fdbe8be7430bc4fe570fe4c5ca1630cc11
Parents: b951c77
Author: ajs6f <ajs6f@virginia.edu>
Authored: Fri Jan 8 09:51:42 2016 -0500
Committer: ajs6f <ajs6f@virginia.edu>
Committed: Sun Jan 17 15:40:27 2016 -0500

----------------------------------------------------------------------
 .../jena/sparql/core/mem/PMapQuadTable.java     | 18 ++++++++---------
 .../jena/sparql/core/mem/PMapTripleTable.java   | 21 ++++++++++----------
 .../apache/jena/atlas/lib/tuple/TupleMap.java   |  5 +++--
 3 files changed, 23 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/78fb03fd/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapQuadTable.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapQuadTable.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapQuadTable.java
index cd82f48..47a6eed 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapQuadTable.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapQuadTable.java
@@ -41,19 +41,19 @@ import org.slf4j.Logger;
  */
 public class PMapQuadTable extends PMapTupleTable<FourTupleMap, Quad, Consumer4<Node>>implements
QuadTable {
 
-
-    private static class QuadTupleMap extends TupleMap {
-
-        private QuadTupleMap(final String mappedOrder) {
-            super(mappedOrder, compileMapping("GSPO", mappedOrder));
-        }
+    /**
+     * @param order an internal order for this table
+     */
+    public PMapQuadTable(final String order) {
+        this("GSPO", order);
     }
 
     /**
-     * @param order a name and order for this table
+     * @param canonical the canonical order outside this table
+     * @param order the internal order for this table
      */
-    public PMapQuadTable(final String order) {
-        this(order, new QuadTupleMap(order));
+    public PMapQuadTable(final String canonical, final String order) {
+        this(canonical + "->" + order, TupleMap.create(canonical, order));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/jena/blob/78fb03fd/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapTripleTable.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapTripleTable.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapTripleTable.java
index cbf9a31..8737378 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapTripleTable.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapTripleTable.java
@@ -39,21 +39,22 @@ import org.slf4j.Logger;
  *
  */
 public class PMapTripleTable extends PMapTupleTable<ThreeTupleMap, Triple, Consumer3<Node>>implements
TripleTable {
-
-    private static class TripleTupleMap extends TupleMap {
-
-        private TripleTupleMap(final String mappedOrder) {
-            super(mappedOrder, compileMapping("SPO", mappedOrder));
-        }
-    }
     
     /**
-     * @param order a name and order for this table
+     * @param order an internal order for this table
      */
     public PMapTripleTable(final String order) {
-        this(order, new TripleTupleMap(order));
+        this("SPO", order);
     }
-    
+
+    /**
+     * @param canonical the canonical order outside this table
+     * @param order the internal order for this table
+     */
+    public PMapTripleTable(final String canonical, final String order) {
+        this(canonical + "->" + order, TupleMap.create(canonical, order));
+    }
+
     /**
      * @param tableName a name for this table
      * @param order the order of elements in this table

http://git-wip-us.apache.org/repos/asf/jena/blob/78fb03fd/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/TupleMap.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/TupleMap.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/TupleMap.java
index 94ba8d2..bc4f69e 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/TupleMap.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/TupleMap.java
@@ -46,6 +46,7 @@ import org.apache.jena.atlas.lib.StrUtils ;
  * {@code 0<-1, 1<-2, 2<-0} 
  * and the "putTransform" is where to place the items: {@code 0->2, 1->0, 2->1}.
  */
+final
 public class TupleMap {
     /*
      * Naming.  getTransform (from src), putTransform(into dst)
@@ -116,7 +117,7 @@ public class TupleMap {
      * P->0, O->1) and not 1,2,0 (which is the extraction mapping). The label is
      * just a label and is not interpretted here.
      */
-    protected TupleMap(String label, int... elements) {
+    private TupleMap(String label, int... elements) {
         this.len = elements.length ; 
         this.label = label;
 
@@ -315,7 +316,7 @@ public class TupleMap {
     }
 
     /** Compile a mapping encoded as single charcaters e.g. "SPO", "POS" */
-    protected static int[] compileMapping(String domain, String range) {
+    private static int[] compileMapping(String domain, String range) {
         List<Character> input = StrUtils.toCharList(domain);
         List<Character> output = StrUtils.toCharList(range);
         return compileMapping(input, output);


Mime
View raw message