From ecba417f4bd0d81d73adb5038b24ef220aaebf90 Mon Sep 17 00:00:00 2001
From: cramakri <cramakri>
Date: Tue, 22 Jun 2010 09:27:00 +0000
Subject: [PATCH] LMS-1584 Added methods for working with MDDoubleArrays on the
 feature values dto.

SVN: 16653
---
 .../dss/etl/dataaccess/FeatureVectorDAOTest.java     |  6 ++----
 .../etl/featurevector/FeatureVectorUploaderTest.java | 12 ++++--------
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/FeatureVectorDAOTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/FeatureVectorDAOTest.java
index 34c9b7ddc86..d436277100c 100644
--- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/FeatureVectorDAOTest.java
+++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/FeatureVectorDAOTest.java
@@ -24,7 +24,6 @@ import java.util.List;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import ch.systemsx.cisd.base.convert.NativeTaggedArray;
 import ch.systemsx.cisd.base.mdarray.MDDoubleArray;
 
 /**
@@ -107,7 +106,7 @@ public class FeatureVectorDAOTest extends AbstractDBTest
         assertEquals(0.0, featureValues.getT());
         assertEquals(0.0, featureValues.getZ());
 
-        MDDoubleArray spreadsheet = NativeTaggedArray.tryToDoubleArray(featureValues.getValues());
+        MDDoubleArray spreadsheet = featureValues.getValuesDoubleArray();
         int[] dims =
             { 2, 3 };
         assertEquals(spreadsheet.dimensions().length, dims.length);
@@ -135,9 +134,8 @@ public class FeatureVectorDAOTest extends AbstractDBTest
                 array.set(i + j, i, j);
             }
         }
-        byte[] values = NativeTaggedArray.toByteArray(array);
         ImgFeatureValuesDTO featureValues =
-                new ImgFeatureValuesDTO(0.0, 0.0, values, featureDef.getId());
+                new ImgFeatureValuesDTO(0.0, 0.0, array, featureDef.getId());
         return dao.addFeatureValues(featureValues);
     }
 
diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/FeatureVectorUploaderTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/FeatureVectorUploaderTest.java
index 9e0d0ac247b..29d73a330bd 100644
--- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/FeatureVectorUploaderTest.java
+++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/featurevector/FeatureVectorUploaderTest.java
@@ -26,7 +26,6 @@ import java.util.List;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import ch.systemsx.cisd.base.convert.NativeTaggedArray;
 import ch.systemsx.cisd.base.mdarray.MDDoubleArray;
 import ch.systemsx.cisd.openbis.dss.etl.ScreeningContainerDatasetInfo;
 import ch.systemsx.cisd.openbis.dss.etl.dataaccess.AbstractDBTest;
@@ -34,8 +33,6 @@ import ch.systemsx.cisd.openbis.dss.etl.dataaccess.DBUtils;
 import ch.systemsx.cisd.openbis.dss.etl.dataaccess.IImagingUploadDAO;
 import ch.systemsx.cisd.openbis.dss.etl.dataaccess.ImgFeatureDefDTO;
 import ch.systemsx.cisd.openbis.dss.etl.dataaccess.ImgFeatureValuesDTO;
-import ch.systemsx.cisd.openbis.dss.etl.featurevector.CanonicalFeatureVector;
-import ch.systemsx.cisd.openbis.dss.etl.featurevector.FeatureVectorUploader;
 
 /**
  * @author Chandrasekhar Ramakrishnan
@@ -124,8 +121,7 @@ public class FeatureVectorUploaderTest extends AbstractDBTest
             assertEquals(0.0, featureValues.getT());
             assertEquals(0.0, featureValues.getZ());
 
-            MDDoubleArray spreadsheet =
-                    NativeTaggedArray.tryToDoubleArray(featureValues.getValues());
+            MDDoubleArray spreadsheet = featureValues.getValuesDoubleArray();
             int[] dims =
                 { 3, 5 };
             int[] spreadsheetDims = spreadsheet.dimensions();
@@ -167,7 +163,7 @@ public class FeatureVectorUploaderTest extends AbstractDBTest
             String featureDesc = featureName + " desc";
             ImgFeatureDefDTO featureDef = new ImgFeatureDefDTO(featureName, featureDesc, 0);
             fvec.setFeatureDef(featureDef);
-            byte[] values = createValues(rowCount, columnCount);
+            MDDoubleArray values = createValues(rowCount, columnCount);
             ImgFeatureValuesDTO featureValues = new ImgFeatureValuesDTO(0.0, 0.0, values, 0);
 
             fvec.setValues(Collections.singletonList(featureValues));
@@ -175,7 +171,7 @@ public class FeatureVectorUploaderTest extends AbstractDBTest
             return fvec;
         }
 
-        private byte[] createValues(int rowCount, int columnCount)
+        private MDDoubleArray createValues(int rowCount, int columnCount)
         {
             int[] dims =
                 { rowCount, columnCount };
@@ -187,7 +183,7 @@ public class FeatureVectorUploaderTest extends AbstractDBTest
                     array.set(i + j, i, j);
                 }
             }
-            return NativeTaggedArray.toByteArray(array);
+            return array;
         }
     }
 }
-- 
GitLab