From 89f0b7e392f57acfff0b6a195aeddd2225b2f2fe Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Sat, 13 Oct 2012 14:44:40 -0700 Subject: 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 --- src/java/com/jogamp/gluegen/cgram/types/Type.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/java/com/jogamp') 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 -- cgit v1.2.3