From 6d241fc2a46413ee478985d676d2481c5a7ed119 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 23 Aug 2012 14:01:08 +0200 Subject: GLContext: Remove integer-key based attach/detach object - use String based (minor API change) The integer based attachement is currently not used and since it has no benefit over the String based hash map - remove it. --- src/jogl/classes/javax/media/opengl/GLContext.java | 32 ++++------------------ 1 file changed, 5 insertions(+), 27 deletions(-) (limited to 'src/jogl/classes') diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index a2ce619e7..c2f94b9af 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -52,7 +52,6 @@ import jogamp.opengl.Debug; import jogamp.opengl.GLContextImpl; import com.jogamp.common.os.Platform; -import com.jogamp.common.util.IntObjectHashMap; import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; import com.jogamp.opengl.GLExtensions; @@ -140,8 +139,7 @@ public abstract class GLContext { private static final ThreadLocal currentContext = new ThreadLocal(); - private final HashMap attachedObjectsByString = new HashMap(); - private final IntObjectHashMap attachedObjectsByInt = new IntObjectHashMap(); + private final HashMap attachedObjects = new HashMap(); // RecursiveLock maintains a queue of waiting Threads, ensuring the longest waiting thread will be notified at unlock. protected final RecursiveLock lock = LockFactory.createRecursiveLock(); @@ -168,8 +166,7 @@ public abstract class GLContext { ctxMinorVersion=-1; ctxOptions=0; ctxVersionString=null; - attachedObjectsByString.clear(); - attachedObjectsByInt.clear(); + attachedObjects.clear(); contextHandle=0; currentSwapInterval = -1; } @@ -422,30 +419,11 @@ public abstract class GLContext { return 0 != contextHandle; } - /** - * Returns the attached user object for the given name to this GLContext. - */ - public final Object getAttachedObject(int name) { - return attachedObjectsByInt.get(name); - } - /** * Returns the attached user object for the given name to this GLContext. */ public final Object getAttachedObject(String name) { - return attachedObjectsByString.get(name); - } - - /** - * Sets the attached user object for the given name to this GLContext. - * Returns the previously set object or null. - */ - public final Object attachObject(int name, Object obj) { - return attachedObjectsByInt.put(name, obj); - } - - public final Object detachObject(int name) { - return attachedObjectsByInt.remove(name); + return attachedObjects.get(name); } /** @@ -453,11 +431,11 @@ public abstract class GLContext { * Returns the previously set object or null. */ public final Object attachObject(String name, Object obj) { - return attachedObjectsByString.put(name, obj); + return attachedObjects.put(name, obj); } public final Object detachObject(String name) { - return attachedObjectsByString.remove(name); + return attachedObjects.remove(name); } /** -- cgit v1.2.3