From 44f869b292f858cf9ad8c893ae30d39fadda1102 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Wed, 2 Dec 2009 00:14:46 +0100 Subject: continued with code cleanup in com.sun.gluegen.cgram and com.sun.gluegen.opengl packages. --- src/java/com/sun/gluegen/opengl/GLEmitter.java | 45 +++++++++++++------------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'src/java/com/sun/gluegen/opengl/GLEmitter.java') diff --git a/src/java/com/sun/gluegen/opengl/GLEmitter.java b/src/java/com/sun/gluegen/opengl/GLEmitter.java index 4ca2e698b..ff307c432 100644 --- a/src/java/com/sun/gluegen/opengl/GLEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLEmitter.java @@ -45,20 +45,20 @@ import java.util.*; import com.sun.gluegen.*; import com.sun.gluegen.cgram.types.*; import com.sun.gluegen.procaddress.*; -import com.sun.gluegen.runtime.*; import com.sun.gluegen.runtime.opengl.GLExtensionNames; /** * A subclass of ProcAddressEmitter with special OpenGL-specific * configuration abilities. */ -public class GLEmitter extends ProcAddressEmitter -{ +public class GLEmitter extends ProcAddressEmitter { + // Keeps track of which MethodBindings were created for handling // Buffer Object variants. Used as a Set rather than a Map. - private Map/**/ bufferObjectMethodBindings = new IdentityHashMap(); + private Map bufferObjectMethodBindings = new IdentityHashMap(); static class BufferObjectKind { + private BufferObjectKind() {} static final BufferObjectKind UNPACK_PIXEL = new BufferObjectKind(); @@ -67,8 +67,8 @@ public class GLEmitter extends ProcAddressEmitter static final BufferObjectKind ELEMENT = new BufferObjectKind(); } - public void beginEmission(GlueEmitterControls controls) throws IOException - { + @Override + public void beginEmission(GlueEmitterControls controls) throws IOException { getGLConfig().parseGLHeaders(controls); renameExtensionsIntoCore(); if (getGLConfig().getAutoUnifyExtensions()) { @@ -85,7 +85,7 @@ public class GLEmitter extends ProcAddressEmitter // renaming mechanisms that are built elsewhere. GLConfiguration config = getGLConfig(); - Set extensionsRenamedIntoCore = config.getExtensionsRenamedIntoCore(); + Set extensionsRenamedIntoCore = config.getExtensionsRenamedIntoCore(); BuildStaticGLInfo glInfo = config.getGLInfo(); if(null==glInfo) { if(extensionsRenamedIntoCore.size()>0) { @@ -93,9 +93,8 @@ public class GLEmitter extends ProcAddressEmitter } return; } - for (Iterator iter = extensionsRenamedIntoCore.iterator(); iter.hasNext(); ) { - String extension = (String) iter.next(); - Set/**/ declarations = glInfo.getDeclarations(extension); + for (String extension : extensionsRenamedIntoCore) { + Set declarations = glInfo.getDeclarations(extension); if (declarations != null) { for (Iterator i2 = declarations.iterator(); i2.hasNext(); ) { String decl = (String) i2.next(); @@ -116,21 +115,21 @@ public class GLEmitter extends ProcAddressEmitter } class ExtensionUnifier implements SymbolFilter { - private List/**/ constants; - private List/**/ functions; + private List constants; + private List functions; - public void filterSymbols(List/**/ constants, - List/**/ functions) { + public void filterSymbols(List constants, + List functions) { this.constants = constants; this.functions = functions; doWork(); } - public List/**/ getConstants() { + public List getConstants() { return constants; } - public List/**/ getFunctions() { + public List getFunctions() { return functions; } @@ -140,8 +139,8 @@ public class GLEmitter extends ProcAddressEmitter return; } // Try to retain a "good" ordering for these symbols - Map/**/ constantMap = new LinkedHashMap(); - Map/**/ functionMap = new LinkedHashMap(); + Map constantMap = new LinkedHashMap(); + Map functionMap = new LinkedHashMap(); for (Iterator iter = constants.iterator(); iter.hasNext(); ) { ConstantDefinition def = (ConstantDefinition) iter.next(); constantMap.put(def.getName(), def); @@ -158,10 +157,10 @@ public class GLEmitter extends ProcAddressEmitter // that doesn't support the core version of these APIs, the runtime // will take care of looking up the extension version of these entry // points. - Set/**/ extensionNames = glInfo.getExtensions(); + Set extensionNames = glInfo.getExtensions(); for (Iterator iter1 = extensionNames.iterator(); iter1.hasNext(); ) { String extension = (String) iter1.next(); - Set/**/ declarations = glInfo.getDeclarations(extension); + Set declarations = glInfo.getDeclarations(extension); boolean isExtension = true; boolean shouldUnify = true; String cause = null; @@ -253,14 +252,14 @@ public class GLEmitter extends ProcAddressEmitter (i.e., mutators for argument names). We also would need to inform the CMethodBindingEmitter that it is overloaded in this case (though we default to true currently). */ - protected List/**/ expandMethodBinding(MethodBinding binding) { - List/**/ bindings = super.expandMethodBinding(binding); + protected List expandMethodBinding(MethodBinding binding) { + List bindings = super.expandMethodBinding(binding); if (!getGLConfig().isBufferObjectFunction(binding.getName())) { return bindings; } - List/**/ newBindings = new ArrayList(); + List newBindings = new ArrayList(); newBindings.addAll(bindings); // Need to expand each one of the generated bindings to take a -- cgit v1.2.3