directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1331895 - /directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Rdn.java
Date Sun, 29 Apr 2012 11:10:41 GMT
Author: elecharny
Date: Sun Apr 29 11:10:41 2012
New Revision: 1331895

URL: http://svn.apache.org/viewvc?rev=1331895&view=rev
Log:
Added a shortcut in RDN comparison : if the normalized name are equals, we can exit immediately.
This save a lot of processing when doing searches (around 10%).

Modified:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Rdn.java

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Rdn.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Rdn.java?rev=1331895&r1=1331894&r2=1331895&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Rdn.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Rdn.java
Sun Apr 29 11:10:41 2012
@@ -114,7 +114,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class Rdn implements Cloneable, Externalizable, Iterable<Ava>
+public class Rdn implements Cloneable, Externalizable, Iterable<Ava>, Comparable<Rdn>
 {
     /** The LoggerFactory used by this class */
     protected static final Logger LOG = LoggerFactory.getLogger( Rdn.class );
@@ -977,6 +977,12 @@ public class Rdn implements Cloneable, E
 
         Rdn rdn = ( Rdn ) that;
 
+        // Short cut : compare the normalized Rdn
+        if ( normName.equals( rdn.normName ) )
+        {
+            return true;
+        }
+
         if ( rdn.nbAvas != nbAvas )
         {
             // We don't have the same number of Avas. The Rdn which
@@ -1602,6 +1608,13 @@ public class Rdn implements Cloneable, E
     }
 
 
+    public int compareTo( Rdn arg0 )
+    {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+
     /**
      * @return a String representation of the Rdn. The caller will get back the user
      * provided Rdn



Mime
View raw message