summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarvey Harrison <[email protected]>2012-10-13 14:44:40 -0700
committerHarvey Harrison <[email protected]>2012-10-13 14:44:40 -0700
commit89f0b7e392f57acfff0b6a195aeddd2225b2f2fe (patch)
treec812f92b2fdb8b84cf49b2886090d8c4879f49ae /src
parent898f62a51ff32bec12c7839593bb6ed3f737a022 (diff)
gluegen: break apart a complex conditional in Type.equals() for readability
- move the cheap integer compares earlier before the String comparisons Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/Type.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/java/com/jogamp/gluegen/cgram/types/Type.java b/src/java/com/jogamp/gluegen/cgram/types/Type.java
index bd41aec..169d962 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/Type.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/Type.java
@@ -194,8 +194,21 @@ public abstract class Type implements Cloneable {
return false;
}
Type t = (Type) arg;
- return (((name == null ? t.name == null : name.equals(t.name)) || (name != null && name.equals(t.name))) &&
- (size == t.size) && (cvAttributes == t.cvAttributes));
+ if (size != t.size)
+ return false;
+
+ if (cvAttributes != t.cvAttributes)
+ return false;
+
+ // Includes test for both names == null
+ if (name == t.name)
+ return true;
+
+ if (name != null)
+ return name.equals(t.name);
+
+ // If we got here, name is null, t.name is not, they cannot compare equal
+ return false;
}
/** Returns a string representation of this type. This string is not