clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [3/3] git commit: CLEREZZA-871: introduced WeakBidiMap fot the newly introduced BNodes
Date Wed, 29 Jan 2014 11:09:00 GMT
CLEREZZA-871: introduced WeakBidiMap fot the newly introduced BNodes


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

Branch: refs/heads/master
Commit: d3d5430f0976b00045e87c81cd18fb5cda16ee2b
Parents: 838df27
Author: retobg <reto@apache.org>
Authored: Wed Jan 29 12:08:26 2014 +0100
Committer: retobg <reto@apache.org>
Committed: Wed Jan 29 12:08:26 2014 +0100

----------------------------------------------------------------------
 .../org/apache/clerezza/rdf/jena/storage/JenaGraphAdaptor.java   | 2 +-
 .../java/org/apache/clerezza/rdf/jena/storage/WeakBidiMap.java   | 4 ++--
 .../java/org/apache/clerezza/rdf/jena/storage/RoundTripTest.java | 1 +
 3 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/clerezza/blob/d3d5430f/rdf.jena.storage/src/main/java/org/apache/clerezza/rdf/jena/storage/JenaGraphAdaptor.java
----------------------------------------------------------------------
diff --git a/rdf.jena.storage/src/main/java/org/apache/clerezza/rdf/jena/storage/JenaGraphAdaptor.java
b/rdf.jena.storage/src/main/java/org/apache/clerezza/rdf/jena/storage/JenaGraphAdaptor.java
index c42f983..0edbb6c 100644
--- a/rdf.jena.storage/src/main/java/org/apache/clerezza/rdf/jena/storage/JenaGraphAdaptor.java
+++ b/rdf.jena.storage/src/main/java/org/apache/clerezza/rdf/jena/storage/JenaGraphAdaptor.java
@@ -44,7 +44,7 @@ import org.wymiwyg.commons.util.collections.BidiMapImpl;
 public class JenaGraphAdaptor extends AbstractMGraph {
 
     private final Graph jenaGraph;
-    final BidiMap<BNode, Node> tria2JenaBNodes = new BidiMapImpl<BNode, Node>();
+    final BidiMap<BNode, Node> tria2JenaBNodes = new WeakBidiMap<BNode, Node>();
     final Jena2TriaUtil jena2TriaUtil =
             new Jena2TriaUtil(tria2JenaBNodes.inverse());
     final Tria2JenaUtil tria2JenaUtil =

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d3d5430f/rdf.jena.storage/src/main/java/org/apache/clerezza/rdf/jena/storage/WeakBidiMap.java
----------------------------------------------------------------------
diff --git a/rdf.jena.storage/src/main/java/org/apache/clerezza/rdf/jena/storage/WeakBidiMap.java
b/rdf.jena.storage/src/main/java/org/apache/clerezza/rdf/jena/storage/WeakBidiMap.java
index 3c7e9b5..277cd3a 100644
--- a/rdf.jena.storage/src/main/java/org/apache/clerezza/rdf/jena/storage/WeakBidiMap.java
+++ b/rdf.jena.storage/src/main/java/org/apache/clerezza/rdf/jena/storage/WeakBidiMap.java
@@ -33,8 +33,8 @@ import org.wymiwyg.commons.util.collections.BidiMap;
  */
 public class WeakBidiMap<K, V> implements BidiMap<K, V> {
 
-    private Map<K, V> forward = new WeakHashMap<K, V>();
-    private Map<V, WeakReference<K>> backward = new HashMap<V, WeakReference<K>>();
+    private final Map<K, V> forward = new WeakHashMap<K, V>();
+    private final Map<V, WeakReference<K>> backward = new HashMap<V, WeakReference<K>>();
 
     public WeakBidiMap() {
         super();

http://git-wip-us.apache.org/repos/asf/clerezza/blob/d3d5430f/rdf.jena.storage/src/test/java/org/apache/clerezza/rdf/jena/storage/RoundTripTest.java
----------------------------------------------------------------------
diff --git a/rdf.jena.storage/src/test/java/org/apache/clerezza/rdf/jena/storage/RoundTripTest.java
b/rdf.jena.storage/src/test/java/org/apache/clerezza/rdf/jena/storage/RoundTripTest.java
index b3e2f0d..ab42f55 100644
--- a/rdf.jena.storage/src/test/java/org/apache/clerezza/rdf/jena/storage/RoundTripTest.java
+++ b/rdf.jena.storage/src/test/java/org/apache/clerezza/rdf/jena/storage/RoundTripTest.java
@@ -51,6 +51,7 @@ public class RoundTripTest {
                 LiteralFactory.getInstance().createTypedLiteral("foo")));
         Assert.assertEquals(2, rewrappedMGraph.size());
         Assert.assertEquals(2, mGraph.size());
+        Assert.assertEquals(mGraph.getGraph(), rewrappedMGraph.getGraph());
         rewrappedMGraph.clear();
         Assert.assertEquals(0, rewrappedMGraph.size());
     }


Mime
View raw message