diff options
author | Sven Gothel <[email protected]> | 2011-03-05 04:11:46 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-03-05 04:11:46 +0100 |
commit | 47bad30d1a3a96b962f651bf8baeee228387fcc5 (patch) | |
tree | d13e525e68af9353a3e658c9d86b1c7554231aae /src/jogl/classes/jogamp/opengl/MemoryObject.java | |
parent | b663dd3d22c5d0462e34ec4227630b3470abfdff (diff) |
Fix MemoryObject: Remove unnecessary and slow hash collision action
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/MemoryObject.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/MemoryObject.java | 26 |
1 files changed, 3 insertions, 23 deletions
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 - * <ul> - * <li>slow add: if !map.contains(obj0), the values are verified (slow)</li> - * <li>fast get: if map.contains(obj0), the mapped value is compared with equals (fast) </li> - * </ul> - * In case the above verification fails, a RuntimeException is thrown.<br> - * In such case the calculation of the hash value should either be tuned,<br> - * or we just cannot use hash mapping.<br> - * - * @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 <code>obj0</code> != <code>return</code>, - * or the added <code>obj0</code> == <code>return</code>. - * @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/*<MemoryObject,MemoryObject>*/ 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; } |