summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphil <[email protected]>2016-11-02 13:27:21 +1300
committerphil <[email protected]>2016-11-02 13:27:21 +1300
commit15b36a6c21fe069c232ae58be5c174b337b2611d (patch)
tree6a1fa28019233fc845639febd99334e1b401fb4e
parent43c673b70f1f55a7af7b08d705e4b7550ff6c6fa (diff)
Bug 1338 - IndexRow of GeometryInfo returns a terrible constant hash
-rw-r--r--src/main/java/org/jogamp/java3d/utils/geometry/GeometryInfo.java14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/main/java/org/jogamp/java3d/utils/geometry/GeometryInfo.java b/src/main/java/org/jogamp/java3d/utils/geometry/GeometryInfo.java
index 4bff8e9..3ee14bb 100644
--- a/src/main/java/org/jogamp/java3d/utils/geometry/GeometryInfo.java
+++ b/src/main/java/org/jogamp/java3d/utils/geometry/GeometryInfo.java
@@ -42,6 +42,7 @@ package org.jogamp.java3d.utils.geometry;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
+import java.util.Arrays;
import java.util.HashMap;
import org.jogamp.java3d.GeometryArray;
@@ -1564,25 +1565,18 @@ public class GeometryInfo {
private class IndexRow {
int[] val;
int size;
- private static final int HASHCONST = 0xBABEFACE;
+ //private static final int HASHCONST = 0xBABEFACE;
@Override
public int hashCode()
{
- int bits = 0;
- for (int i = 0 ; i < size ; i++) {
- bits ^= (bits * HASHCONST) << 2;
- }
- return bits;
+ return Arrays.hashCode(val);
} // End of IndexRow.hashCode
@Override
public boolean equals(Object obj)
{
- for (int i = 0 ; i < size ; i++) {
- if (((IndexRow)obj).get(i) != val[i]) return false;
- }
- return true;
+ return Arrays.equals(val, ((IndexRow) obj).val);
} // End of IndexRow.equals()
public int get(int index)