[Mulgara-svn] r2085 - trunk/src/jar/tuples/java/org/mulgara/store/tuples

pag at mulgara.org pag at mulgara.org
Thu Jan 5 19:09:13 UTC 2012


Author: pag
Date: 2012-01-05 19:09:13 +0000 (Thu, 05 Jan 2012)
New Revision: 2085

Modified:
   trunk/src/jar/tuples/java/org/mulgara/store/tuples/MemoryTuples.java
Log:
Updated clone to use super.clone instead of a copy constructor

Modified: trunk/src/jar/tuples/java/org/mulgara/store/tuples/MemoryTuples.java
===================================================================
--- trunk/src/jar/tuples/java/org/mulgara/store/tuples/MemoryTuples.java	2012-01-05 19:08:24 UTC (rev 2084)
+++ trunk/src/jar/tuples/java/org/mulgara/store/tuples/MemoryTuples.java	2012-01-05 19:09:13 UTC (rev 2085)
@@ -166,27 +166,6 @@
   }
 
   /**
-   * Clone constructor.
-   *
-   * @param testTuples PARAMETER TO DO
-   */
-  private MemoryTuples(MemoryTuples testTuples) {
-
-    row = testTuples.row;
-    termList = testTuples.termList;
-    variableList = testTuples.variableList;
-
-    if (testTuples.getVariables() != null) {
-
-      setVariables(testTuples.getVariables());
-    }
-
-    rowMap = testTuples.rowMap;
-    lastMap = testTuples.lastMap;
-    this.tuples = null;
-  }
-
-  /**
    * Test tuples are always materialized as they represent in memory tuples.
    *
    * @return always true as test tuples are represented in memory.
@@ -368,8 +347,15 @@
    * @return RETURNED VALUE TO DO
    */
   public Object clone() {
+    MemoryTuples t = (MemoryTuples)super.clone();
+    // deep clone the variables
+    Variable[] vars = getVariables();
+    if (vars != null && vars.length > 0) {
+      t.setVariables(getVariables());
+    }
+    t.tuples = null;
 
-    return new MemoryTuples(this);
+    return t;
   }
 
   /**
@@ -382,16 +368,6 @@
   }
 
   /**
-   * METHOD TO DO
-   *
-   * @return RETURNED VALUE TO DO
-   */
-  public int hashCode() {
-
-    return termList.hashCode();
-  }
-
-  /**
    * Generate a new assignment and disjoin it as the new final term.
    *
    * @return RETURNED VALUE TO DO



More information about the Mulgara-svn mailing list