diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:06:47 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:06:47 +0200 |
commit | df9ff7f340a5ab4e07efc613f5f264eeae63d4c7 (patch) | |
tree | 239ae276b82024b140428e6c0fe5d739fdd686a4 /src/java/com/jogamp/gluegen/cgram/CSymbolTable.java | |
parent | eb47aaba63e3b1bf55f274a0f338f1010a017ae4 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
Diffstat (limited to 'src/java/com/jogamp/gluegen/cgram/CSymbolTable.java')
-rw-r--r-- | src/java/com/jogamp/gluegen/cgram/CSymbolTable.java | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java b/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java index ec2f979..6e00a72 100644 --- a/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java +++ b/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java @@ -8,10 +8,10 @@ import java.util.Enumeration; public class CSymbolTable { /** holds list of scopes */ - private Vector<String> scopeStack; + private final Vector<String> scopeStack; /** table where all defined names are mapped to TNode tree nodes */ - private Hashtable<String, TNode> symTable; + private final Hashtable<String, TNode> symTable; public CSymbolTable() { scopeStack = new Vector<String>(10); @@ -21,7 +21,7 @@ public class CSymbolTable { /** push a new scope onto the scope stack. */ - public void pushScope(String s) { + public void pushScope(final String s) { //System.out.println("push scope:" + s); scopeStack.addElement(s); } @@ -30,7 +30,7 @@ public class CSymbolTable { */ public void popScope() { //System.out.println("pop scope"); - int size = scopeStack.size(); + final int size = scopeStack.size(); if(size > 0) scopeStack.removeElementAt(size - 1); } @@ -38,9 +38,9 @@ public class CSymbolTable { /** return the current scope as a string */ public String currentScopeAsString() { - StringBuilder buf = new StringBuilder(100); + final StringBuilder buf = new StringBuilder(100); boolean first = true; - Enumeration<String> e = scopeStack.elements(); + final Enumeration<String> e = scopeStack.elements(); while(e.hasMoreElements()) { if(first) first = false; @@ -54,15 +54,15 @@ public class CSymbolTable { /** given a name for a type, append it with the current scope. */ - public String addCurrentScopeToName(String name) { - String currScope = currentScopeAsString(); + public String addCurrentScopeToName(final String name) { + final String currScope = currentScopeAsString(); return addScopeToName(currScope, name); } /** given a name for a type, append it with the given scope. MBZ */ - public String addScopeToName(String scope, String name) { + public String addScopeToName(final String scope, final String name) { if(scope == null || scope.length() > 0) return scope + "::" + name; else @@ -70,8 +70,8 @@ public class CSymbolTable { } /** remove one level of scope from name MBZ*/ - public String removeOneLevelScope(String scopeName) { - int index = scopeName.lastIndexOf("::"); + public String removeOneLevelScope(final String scopeName) { + final int index = scopeName.lastIndexOf("::"); if (index > 0) { return scopeName.substring(0,index); } @@ -83,13 +83,13 @@ public class CSymbolTable { /** add a node to the table with it's key as the current scope and the name */ - public TNode add(String name, TNode node) { + public TNode add(final String name, final TNode node) { return symTable.put(addCurrentScopeToName(name),node); } /** lookup a fully scoped name in the symbol table */ - public TNode lookupScopedName(String scopedName) { + public TNode lookupScopedName(final String scopedName) { return symTable.get(scopedName); } @@ -97,7 +97,7 @@ public class CSymbolTable { the current scope. MBZ -- if not found, pop scopes and look again */ - public TNode lookupNameInCurrentScope(String name) { + public TNode lookupNameInCurrentScope(final String name) { String scope = currentScopeAsString(); String scopedName; TNode tnode = null; @@ -116,11 +116,11 @@ public class CSymbolTable { /** convert this table to a string */ @Override public String toString() { - StringBuilder buff = new StringBuilder(300); + final StringBuilder buff = new StringBuilder(300); buff.append("CSymbolTable { \nCurrentScope: " + currentScopeAsString() + "\nDefinedSymbols:\n"); - Enumeration<String> ke = symTable.keys(); - Enumeration<TNode> ve = symTable.elements(); + final Enumeration<String> ke = symTable.keys(); + final Enumeration<TNode> ve = symTable.elements(); while(ke.hasMoreElements()) { buff.append(ke.nextElement().toString()); buff.append(" (").append(TNode.getNameForType(ve.nextElement().getType())).append(")\n"); |