Java types: implement hashCode() 14/17414/8
Clément DAVID [Thu, 29 Oct 2015 16:19:35 +0000 (17:19 +0100)]
Change-Id: I3ae1c697b004331929828da231fbd6b132000730

13 files changed:
scilab/modules/scicos/src/c/cli/scicos-cli.vcxproj
scilab/modules/scicos/src/c/cli/scicos-cli.vcxproj.filters
scilab/modules/scicos/src/c/scicos.vcxproj
scilab/modules/scicos/src/c/scicos.vcxproj.filters
scilab/modules/slint/slint.vcxproj
scilab/modules/slint/slint.vcxproj.filters
scilab/modules/types/src/java/org/scilab/modules/types/ScilabBoolean.java
scilab/modules/types/src/java/org/scilab/modules/types/ScilabBooleanSparse.java
scilab/modules/types/src/java/org/scilab/modules/types/ScilabDouble.java
scilab/modules/types/src/java/org/scilab/modules/types/ScilabInteger.java
scilab/modules/types/src/java/org/scilab/modules/types/ScilabPolynomial.java
scilab/modules/types/src/java/org/scilab/modules/types/ScilabSparse.java
scilab/modules/types/src/java/org/scilab/modules/types/ScilabString.java

index 40530aa..284b7b9 100644 (file)
@@ -312,7 +312,6 @@ lib /DEF:"$(ProjectDir)../differential_equations_f_Import.def" /SUBSYSTEM:WINDOW
     <ClInclude Include="..\..\cpp\controller_helpers.hxx" />
     <ClInclude Include="..\..\cpp\createblklist.hxx" />
     <ClInclude Include="..\..\cpp\extractblklist.hxx" />
-    <ClInclude Include="..\..\cpp\copyvarfromtlist.hxx" />
     <ClInclude Include="..\..\cpp\LoggerView.hxx" />
     <ClInclude Include="..\..\cpp\model\Annotation.hxx" />
     <ClInclude Include="..\..\cpp\model\Block.hxx" />
index 092fbe1..2b579cd 100644 (file)
     <ClInclude Include="..\..\cpp\LoggerView.hxx">
       <Filter>Header Files\MVC</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\cpp\copyvarfromtlist.hxx">
-      <Filter>Header Files\MVC</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\cpp\vec2var.hxx">
       <Filter>Header Files\MVC</Filter>
     </ClInclude>
index 507236e..c9c538a 100644 (file)
@@ -314,7 +314,6 @@ lib /DEF:"$(ProjectDir)Scicos_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platfo
     <ClInclude Include="..\..\includes\View.hxx" />
     <ClInclude Include="..\cpp\createblklist.hxx" />
     <ClInclude Include="..\cpp\extractblklist.hxx" />
-    <ClInclude Include="..\cpp\copyvarfromtlist.hxx" />
     <ClInclude Include="..\cpp\il_sim.hxx" />
     <ClInclude Include="..\cpp\il_state.hxx" />
     <ClInclude Include="..\cpp\LoggerView.hxx" />
index 99647ff..5ce1c44 100644 (file)
     <ClInclude Include="..\cpp\LoggerView.hxx">
       <Filter>Header Files\MVC</Filter>
     </ClInclude>
-    <ClInclude Include="..\cpp\copyvarfromtlist.hxx">
-      <Filter>Header Files\MVC</Filter>
-    </ClInclude>
     <ClInclude Include="..\cpp\var2vec.hxx">
       <Filter>Header Files\MVC</Filter>
     </ClInclude>
index a0c8dc2..5dd9112 100644 (file)
     <ClInclude Include="includes\config\XMLConfig.hxx" />
     <ClInclude Include="includes\dynlib_slint.h" />
     <ClInclude Include="includes\FileException.hxx" />
-    <ClInclude Include="includes\output\cnes\CNESResult.hxx" />
     <ClInclude Include="includes\output\SLintResult.hxx" />
     <ClInclude Include="includes\output\SLintScilabResult.hxx" />
     <ClInclude Include="includes\output\SLintXmlResult.hxx" />
index fb50902..321f7c2 100644 (file)
@@ -24,9 +24,6 @@
     <Filter Include="Header Files\output">
       <UniqueIdentifier>{9f137ccc-400e-45bc-9e0a-70108af226f1}</UniqueIdentifier>
     </Filter>
-    <Filter Include="Header Files\output\cnes">
-      <UniqueIdentifier>{d303f476-858e-41e1-99e9-be17e9d2903e}</UniqueIdentifier>
-    </Filter>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="slint.rc">
     <ClInclude Include="includes\XMLtools.hxx">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="includes\output\cnes\CNESResult.hxx">
-      <Filter>Header Files\output\cnes</Filter>
-    </ClInclude>
     <ClInclude Include="includes\checkers\CommentRatioChecker.hxx">
       <Filter>Header Files\checkers</Filter>
     </ClInclude>
index 06078d9..a283767 100644 (file)
@@ -17,6 +17,7 @@ package org.scilab.modules.types;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
+import java.util.Arrays;
 
 /**
  * This class provides a representation on the Scilab boolean datatype<br>
@@ -199,6 +200,11 @@ public class ScilabBoolean implements ScilabType {
         return data == null;
     }
 
+    @Override
+    public int hashCode() {
+        return Arrays.deepHashCode(data);
+    }
+
     /**
      * @see org.scilab.modules.types.ScilabType#equals(Object)
      */
index 6f469f6..8c11f60 100644 (file)
@@ -320,6 +320,21 @@ public class ScilabBooleanSparse implements ScilabType {
         return cols;
     }
 
+
+
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + Arrays.hashCode(colPos);
+        result = prime * result + cols;
+        result = prime * result + nbItem;
+        result = prime * result + Arrays.hashCode(nbItemRow);
+        result = prime * result + rows;
+        return result;
+    }
+
     /**
      * @see org.scilab.modules.types.ScilabType#equals(Object)
      */
index e1f01f4..c730cc2 100644 (file)
@@ -17,6 +17,7 @@ package org.scilab.modules.types;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
+import java.util.Arrays;
 
 /**
  * This class provides a representation on the Scilab Double datatype<br>
@@ -354,6 +355,15 @@ public class ScilabDouble implements ScilabType {
         return realPart[0].length;
     }
 
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + Arrays.deepHashCode(imaginaryPart);
+        result = prime * result + Arrays.deepHashCode(realPart);
+        return result;
+    }
+
     /**
      * @see org.scilab.modules.types.ScilabType#equals(Object)
      */
index ee916f6..f96ff1a 100644 (file)
@@ -16,6 +16,7 @@ package org.scilab.modules.types;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
+import java.util.Arrays;
 
 /**
  * This class provides a representation on the Scilab Integer datatype<br>
@@ -731,6 +732,18 @@ public class ScilabInteger implements ScilabType {
         }
     }
 
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + Arrays.deepHashCode(byteData);
+        result = prime * result + Arrays.deepHashCode(intData);
+        result = prime * result + Arrays.deepHashCode(longData);
+        result = prime * result + ((precision == null) ? 0 : precision.hashCode());
+        result = prime * result + Arrays.deepHashCode(shortData);
+        return result;
+    }
+
     /**
      * @see org.scilab.modules.types.ScilabType#equals(Object)
      */
index 52a114a..dea54a8 100644 (file)
@@ -307,6 +307,17 @@ public class ScilabPolynomial implements ScilabType {
         return realPart[0].length;
     }
 
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + Arrays.deepHashCode(imaginaryPart);
+        result = prime * result + ((polyVarName == null) ? 0 : polyVarName.hashCode());
+        result = prime * result + Arrays.deepHashCode(realPart);
+        return result;
+    }
+
     /**
      * @see org.scilab.modules.types.ScilabType#equals(Object)
      */
index c090ef1..08b723d 100644 (file)
@@ -828,6 +828,20 @@ public class ScilabSparse implements ScilabType {
         return cols;
     }
 
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + Arrays.hashCode(colPos);
+        result = prime * result + cols;
+        result = prime * result + Arrays.hashCode(imaginaryPart);
+        result = prime * result + nbItem;
+        result = prime * result + Arrays.hashCode(nbItemRow);
+        result = prime * result + Arrays.hashCode(realPart);
+        result = prime * result + rows;
+        return result;
+    }
+
     /**
      * @see org.scilab.modules.types.ScilabType#equals(Object)
      */
index 83cd415..08a21ce 100644 (file)
@@ -187,6 +187,14 @@ public class ScilabString implements ScilabType {
         return (data == null);
     }
 
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + Arrays.deepHashCode(data);
+        return result;
+    }
+
     /**
      * @see org.scilab.modules.types.ScilabType#equals(Object)
      */