[Mulgara-svn] r2031 - in trunk/src/jar: query/java/org/mulgara/query query/java/org/mulgara/query/rdf resolver-gis/java/org/mulgara/resolver/gis server-rmi/java/org/mulgara/server/rmi store-stringpool-memory/java/org/mulgara/store/stringpool/memory

pag at mulgara.org pag at mulgara.org
Fri Sep 16 13:35:31 UTC 2011


Author: pag
Date: 2011-09-16 13:35:31 +0000 (Fri, 16 Sep 2011)
New Revision: 2031

Modified:
   trunk/src/jar/query/java/org/mulgara/query/AnswerImpl.java
   trunk/src/jar/query/java/org/mulgara/query/BooleanAnswer.java
   trunk/src/jar/query/java/org/mulgara/query/UnconstrainedAnswer.java
   trunk/src/jar/query/java/org/mulgara/query/rdf/VariableNodeImpl.java
   trunk/src/jar/resolver-gis/java/org/mulgara/resolver/gis/GISDistanceStatements.java
   trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteAnswerWrapperAnswer.java
   trunk/src/jar/store-stringpool-memory/java/org/mulgara/store/stringpool/memory/MemoryStringPoolImpl.java
Log:
Updated clone methods, tests passing

Modified: trunk/src/jar/query/java/org/mulgara/query/AnswerImpl.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/AnswerImpl.java	2011-09-15 18:02:07 UTC (rev 2030)
+++ trunk/src/jar/query/java/org/mulgara/query/AnswerImpl.java	2011-09-16 13:35:31 UTC (rev 2031)
@@ -450,11 +450,11 @@
    */
   public Object clone() {
     try {
-      return new AnswerImpl(new TestResultSet(resultSet));
+      AnswerImpl a = (AnswerImpl)super.clone();
+      a.resultSet = new TestResultSet(resultSet);
+      return a;
     } catch (SQLException e) {
       throw new RuntimeException(e);
-    } catch (TuplesException e) {
-      throw new RuntimeException(e);
     }
   }
 

Modified: trunk/src/jar/query/java/org/mulgara/query/BooleanAnswer.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/BooleanAnswer.java	2011-09-15 18:02:07 UTC (rev 2030)
+++ trunk/src/jar/query/java/org/mulgara/query/BooleanAnswer.java	2011-09-16 13:35:31 UTC (rev 2031)
@@ -171,7 +171,7 @@
 
   /** @see java.lang.Object#clone() */
   public Object clone() {
-    return new BooleanAnswer(result);
+    return super.clone();
   }
 
 }

Modified: trunk/src/jar/query/java/org/mulgara/query/UnconstrainedAnswer.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/UnconstrainedAnswer.java	2011-09-15 18:02:07 UTC (rev 2030)
+++ trunk/src/jar/query/java/org/mulgara/query/UnconstrainedAnswer.java	2011-09-16 13:35:31 UTC (rev 2031)
@@ -222,9 +222,7 @@
    * @return {@inheritDoc}
    */
   public Object clone() {
-    UnconstrainedAnswer ans = (UnconstrainedAnswer)super.clone();
-    ans.row = row;
-    return ans;
+    return (UnconstrainedAnswer)super.clone();
   }
 
   /**

Modified: trunk/src/jar/query/java/org/mulgara/query/rdf/VariableNodeImpl.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/rdf/VariableNodeImpl.java	2011-09-15 18:02:07 UTC (rev 2030)
+++ trunk/src/jar/query/java/org/mulgara/query/rdf/VariableNodeImpl.java	2011-09-16 13:35:31 UTC (rev 2031)
@@ -99,7 +99,11 @@
    * @return a copy.
    */
   public Object clone() {
-    return this;
+    try {
+      return super.clone();
+    } catch (CloneNotSupportedException e) {
+      return this;
+    }
   }
 
   /**

Modified: trunk/src/jar/resolver-gis/java/org/mulgara/resolver/gis/GISDistanceStatements.java
===================================================================
--- trunk/src/jar/resolver-gis/java/org/mulgara/resolver/gis/GISDistanceStatements.java	2011-09-15 18:02:07 UTC (rev 2030)
+++ trunk/src/jar/resolver-gis/java/org/mulgara/resolver/gis/GISDistanceStatements.java	2011-09-16 13:35:31 UTC (rev 2031)
@@ -511,13 +511,12 @@
    */
   public Object clone() {
     try {
-      return new GISDistanceStatements((Tuples) points.clone(), calculator,
-          resolverSession);
+      GISDistanceStatements gds = (GISDistanceStatements)super.clone();
+      gds.points = (Tuples)points.clone();
+      return gds;
+    } catch (CloneNotSupportedException e) {
+      throw new RuntimeException("Failed to clone GISDistanceStatements.", e);
     }
-    catch (ResolverException resolverException) {
-      throw new RuntimeException("Failed to clone GISDistanceStatements.",
-          resolverException);
-    }
   }
 
 }

Modified: trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteAnswerWrapperAnswer.java
===================================================================
--- trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteAnswerWrapperAnswer.java	2011-09-15 18:02:07 UTC (rev 2030)
+++ trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteAnswerWrapperAnswer.java	2011-09-16 13:35:31 UTC (rev 2031)
@@ -147,8 +147,12 @@
     try {
       // protect the RMI threading model
       waitForPrefetchThread();
-      RemoteAnswer remoteAnswer = this.remoteAnswer.remoteClone();
-      return new RemoteAnswerWrapperAnswer(remoteAnswer);
+      RemoteAnswerWrapperAnswer a = (RemoteAnswerWrapperAnswer)super.clone();
+      a.remoteAnswer = this.remoteAnswer.remoteClone();
+      a.currentPage = null;
+      a.onFirstPage = false;
+      a.prefetchThread = null;
+      return a;
     } catch (RMITimeoutException rmie) {
       throw new RuntimeException("Timeout waiting on server", rmie);
     } catch (RemoteException rex) {

Modified: trunk/src/jar/store-stringpool-memory/java/org/mulgara/store/stringpool/memory/MemoryStringPoolImpl.java
===================================================================
--- trunk/src/jar/store-stringpool-memory/java/org/mulgara/store/stringpool/memory/MemoryStringPoolImpl.java	2011-09-15 18:02:07 UTC (rev 2030)
+++ trunk/src/jar/store-stringpool-memory/java/org/mulgara/store/stringpool/memory/MemoryStringPoolImpl.java	2011-09-16 13:35:31 UTC (rev 2031)
@@ -683,7 +683,14 @@
      * {@inheritDoc}
      */
     public Object clone() {
-      return new SetWrapperTuples(set);
+      try {
+        SetWrapperTuples s = (SetWrapperTuples)super.clone();
+        s.currentRow = null;
+        s.internalIterator = null;
+        return s;
+      } catch (CloneNotSupportedException e) {
+        throw new AssertionError("Unable to clone tuples");
+      }
     }
 
     /**



More information about the Mulgara-svn mailing list