From 47bad30d1a3a96b962f651bf8baeee228387fcc5 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 5 Mar 2011 04:11:46 +0100 Subject: Fix MemoryObject: Remove unnecessary and slow hash collision action --- src/jogl/classes/jogamp/opengl/MemoryObject.java | 26 +++--------------------- 1 file changed, 3 insertions(+), 23 deletions(-) (limited to 'src/jogl') diff --git a/src/jogl/classes/jogamp/opengl/MemoryObject.java b/src/jogl/classes/jogamp/opengl/MemoryObject.java index 71a6b4908..8b2cf0c4c 100644 --- a/src/jogl/classes/jogamp/opengl/MemoryObject.java +++ b/src/jogl/classes/jogamp/opengl/MemoryObject.java @@ -106,35 +106,15 @@ public class MemoryObject { } /** - * Verifies the hash map operation, ie - * - * In case the above verification fails, a RuntimeException is thrown.
- * In such case the calculation of the hash value should either be tuned,
- * or we just cannot use hash mapping.
- * - * @param map the identity HashMap mapping MemoryObject to MemoryObject - * @param obj0 the MemoryObject to get or add in the map - * @return either the already mapped one where obj0 != return, - * or the added obj0 == return. - * @throws RuntimeException if hash collision occurs + * @param map the identity HashMap, MemoryObject to MemoryObject + * @param obj0 the MemoryObject + * @return either the already mapped MemoryObject - not changing the map, or the newly mapped one. */ public static MemoryObject getOrAddSafe(HashMap/**/ map, MemoryObject obj0) { MemoryObject obj1 = (MemoryObject) map.get(obj0); // get identity (fast) if(null == obj1) { - // verify hash collision (slow) - if( map.values().contains(obj0) ) { - throw new RuntimeException("Hash collision, hash !exist, but in values: "+obj0); - } map.put(obj0, obj0); obj1 = obj0; - } else { - // verify hash collision (ok) - if( !obj1.equals(obj0) ) { - throw new RuntimeException("Hash collision, hash equals, but objects not: query "+obj0+" != contained "+obj1); - } } return obj1; } -- cgit v1.2.3