Scarab commit: svn commit: r11350 - branches/scarab_11079_legacy_with_ant_maven1/src/java/org/tigris/scarab/om/AttributeOption.java

[email protected] Thu, 8 Jan 2015 09:06:39 -0800 (PST)
Newsgroups gmane.comp.java.scarab.cvs
Message-ID <[email protected]>
Author: dabbous
Date: 2015-01-08 09:06:38-0800
New Revision: 11350

Modified:
   branches/scarab_11079_legacy_with_ant_maven1/src/java/org/tigris/scarab/om/AttributeOption.java

Log:
Simplified comparator. Also result was wrong when obj1.name < obj2.name

Modified: branches/scarab_11079_legacy_with_ant_maven1/src/java/org/tigris/scarab/om/AttributeOption.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/scarab_11079_legacy_with_ant_maven1/src/java/org/tigris/scarab/om/AttributeOption.java?view=diff&pathrev=11350&r1=11349&r2=11350
==============================================================================
--- branches/scarab_11079_legacy_with_ant_maven1/src/java/org/tigris/scarab/om/AttributeOption.java	(original)
+++ branches/scarab_11079_legacy_with_ant_maven1/src/java/org/tigris/scarab/om/AttributeOption.java	2015-01-08 09:06:38-0800
@@ -100,18 +100,21 @@
         {
             public int compare(Object obj1, Object obj2)
             {
-                int result = 1;
-                AttributeOption opt1 = (AttributeOption)obj1; 
-                AttributeOption opt2 = (AttributeOption)obj2;
-                if (opt1.getName().equals(opt2.getName()))
-                {
-                    result = 0;
-                }
-                else
-                {
-                    result = -1;
-                }
-                return result;
+                //int result = 1;
+                //AttributeOption opt1 = (AttributeOption)obj1; 
+                //AttributeOption opt2 = (AttributeOption)obj2;
+                String name1 = ((AttributeOption)obj1).getName();
+                String name2 = ((AttributeOption)obj2).getName();
+                return name1.compareTo(name2);
+                //if (opt1.getName().equals(opt2.getName()))
+                //{
+                //    result = 0;
+                //}
+                //else
+                //{
+                //    result = -1;
+                //}
+                //return result;
             }
         };

------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3577&dsMessageId=3093891