diff options
author | Sven Gothel <[email protected]> | 2014-04-01 16:34:41 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-04-01 16:34:41 +0200 |
commit | 6bee2a236e4ca4e1fac5d6f975e32b5942e1edf6 (patch) | |
tree | 720e8c9d525606a6b27df6b87ebc481e1cf955d9 | |
parent | 07d1c5a272e528d130daf37b9aa7077aac8d748e (diff) |
Cleanup *GraphicsDevice: Use 'final' for ctor parameter; DefaultGraphicsDevice.getUniqueID(..) shall perform 'intern()' only once.
6 files changed, 15 insertions, 16 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java index a7fa53577..d72eabb02 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java @@ -48,9 +48,9 @@ import javax.media.nativewindow.AbstractGraphicsDevice; /** A wrapper for an AWT GraphicsDevice allowing it to be handled in a toolkit-independent manner. */ public class AWTGraphicsDevice extends DefaultGraphicsDevice implements Cloneable { - private GraphicsDevice device; + private final GraphicsDevice device; - public AWTGraphicsDevice(GraphicsDevice device, int unitID) { + public AWTGraphicsDevice(final GraphicsDevice device, final int unitID) { super(NativeWindowFactory.TYPE_AWT, device.getIDstring(), unitID); this.device = device; } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java index 6dc52a702..ffcbb8626 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java @@ -73,7 +73,7 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl this.eglLifecycleCallback = null; } - public EGLGraphicsDevice(long nativeDisplayID, long eglDisplay, String connection, int unitID, EGLDisplayLifecycleCallback eglLifecycleCallback) { + public EGLGraphicsDevice(final long nativeDisplayID, final long eglDisplay, final String connection, final int unitID, final EGLDisplayLifecycleCallback eglLifecycleCallback) { super(NativeWindowFactory.TYPE_EGL, connection, unitID, eglDisplay); this.nativeDisplayID[0] = nativeDisplayID; this.eglLifecycleCallback = eglLifecycleCallback; diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/macosx/MacOSXGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/macosx/MacOSXGraphicsDevice.java index 99ca006fa..ff149447e 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/macosx/MacOSXGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/macosx/MacOSXGraphicsDevice.java @@ -39,7 +39,7 @@ import javax.media.nativewindow.*; public class MacOSXGraphicsDevice extends DefaultGraphicsDevice implements Cloneable { /** Constructs a new MacOSXGraphicsDevice */ - public MacOSXGraphicsDevice(int unitID) { + public MacOSXGraphicsDevice(final int unitID) { super(NativeWindowFactory.TYPE_MACOSX, AbstractGraphicsDevice.DEFAULT_CONNECTION, unitID); } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java index 643982715..ef0cbddd7 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java @@ -39,11 +39,11 @@ import javax.media.nativewindow.*; */ public class WindowsGraphicsDevice extends DefaultGraphicsDevice implements Cloneable { /** Constructs a new WindowsGraphicsDevice */ - public WindowsGraphicsDevice(int unitID) { + public WindowsGraphicsDevice(final int unitID) { this(AbstractGraphicsDevice.DEFAULT_CONNECTION, unitID); } - public WindowsGraphicsDevice(String connection, int unitID) { + public WindowsGraphicsDevice(final String connection, final int unitID) { super(NativeWindowFactory.TYPE_WINDOWS, connection, unitID); } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java index 863e53bde..633b9eaf0 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java @@ -54,7 +54,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl * This constructor exist to setup a default device connection. * @see DefaultGraphicsDevice#DefaultGraphicsDevice(String, String, int) */ - public X11GraphicsDevice(String connection, int unitID) { + public X11GraphicsDevice(final String connection, final int unitID) { super(NativeWindowFactory.TYPE_X11, connection, unitID); handleOwner = false; isXineramaEnabled = false; @@ -64,7 +64,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl * {@link javax.media.nativewindow.ToolkitLock} via {@link NativeWindowFactory#getDefaultToolkitLock(String, long)}. * @see DefaultGraphicsDevice#DefaultGraphicsDevice(String, String, int, long) */ - public X11GraphicsDevice(long display, int unitID, boolean owner) { + public X11GraphicsDevice(final long display, final int unitID, final boolean owner) { this(display, unitID, NativeWindowFactory.getDefaultToolkitLock(NativeWindowFactory.TYPE_X11, display), owner); } @@ -73,7 +73,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl * @param locker custom {@link javax.media.nativewindow.ToolkitLock}, eg to force null locking w/ private connection * @see DefaultGraphicsDevice#DefaultGraphicsDevice(String, String, int, long, ToolkitLock) */ - public X11GraphicsDevice(long display, int unitID, ToolkitLock locker, boolean owner) { + public X11GraphicsDevice(final long display, final int unitID, final ToolkitLock locker, final boolean owner) { super(NativeWindowFactory.TYPE_X11, X11Lib.XDisplayString(display), unitID, display, locker); if(0==display) { throw new NativeWindowException("null display"); @@ -91,7 +91,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl * @param locker custom {@link javax.media.nativewindow.ToolkitLock}, eg to force null locking w/ private connection * @see DefaultGraphicsDevice#DefaultGraphicsDevice(String, String, int, long, ToolkitLock) */ - public X11GraphicsDevice(String displayConnection, int unitID, ToolkitLock locker) { + public X11GraphicsDevice(final String displayConnection, final int unitID, final ToolkitLock locker) { super(NativeWindowFactory.TYPE_X11, displayConnection, unitID, 0, locker); handleOwner = true; open(); diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java index 15ff2b1ac..f733f91de 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java +++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java @@ -49,7 +49,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice * gathered via {@link NativeWindowFactory#getDefaultToolkitLock(String)}. * @param type */ - public DefaultGraphicsDevice(String type, String connection, int unitID) { + public DefaultGraphicsDevice(final String type, final String connection, final int unitID) { this(type, connection, unitID, 0, NativeWindowFactory.getDefaultToolkitLock(type)); } @@ -59,7 +59,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice * @param type * @param handle */ - public DefaultGraphicsDevice(String type, String connection, int unitID, long handle) { + public DefaultGraphicsDevice(final String type, final String connection, final int unitID, final long handle) { this(type, connection, unitID, handle, NativeWindowFactory.getDefaultToolkitLock(type, handle)); } @@ -69,7 +69,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice * @param handle * @param locker if null, a non blocking <i>null</i> lock is used. */ - public DefaultGraphicsDevice(String type, String connection, int unitID, long handle, ToolkitLock locker) { + public DefaultGraphicsDevice(final String type, final String connection, final int unitID, final long handle, final ToolkitLock locker) { this.type = type; this.connection = connection; this.unitID = unitID; @@ -247,8 +247,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice * Returns a unique String object using {@link String#intern()} for the given arguments, * which object reference itself can be used as a key. */ - private static String getUniqueID(String type, String connection, int unitID) { - final String r = (type + separator + connection + separator + unitID).intern(); - return r.intern(); + private static String getUniqueID(final String type, final String connection, final int unitID) { + return (type + separator + connection + separator + unitID).intern(); } } |