directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r517453 - in /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap: filter/AssertionNode.java filter/BranchNode.java util/LongComparator.java
Date Mon, 12 Mar 2007 23:12:38 GMT
Author: elecharny
Date: Mon Mar 12 16:12:37 2007
New Revision: 517453

URL: http://svn.apache.org/viewvc?view=rev&rev=517453
Log:
Changed BigInteger to Long, to improve the server performance.


Added:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LongComparator.java
Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AssertionNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AssertionNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AssertionNode.java?view=diff&rev=517453&r1=517452&r2=517453
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AssertionNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AssertionNode.java
Mon Mar 12 16:12:37 2007
@@ -20,9 +20,6 @@
 package org.apache.directory.shared.ldap.filter;
 
 
-import java.math.BigInteger;
-
-
 /**
  * Node used for the application of arbitrary predicates on return candidates.
  * Applies dynamic and programatic criteria for the selection of candidates for
@@ -36,7 +33,7 @@
 public class AssertionNode extends AbstractExprNode
 {
     /** Setting scan count to max */
-    private static final BigInteger MAX = BigInteger.valueOf( Integer.MAX_VALUE );
+    private static final Long MAX = Long.MAX_VALUE;
 
     /** Setting display string to [MAX] */
     private static final String MAX_STR = "[" + MAX.toString() + "]";

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java?view=diff&rev=517453&r1=517452&r2=517453
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java
Mon Mar 12 16:12:37 2007
@@ -24,7 +24,6 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-import java.math.BigInteger;
 
 /**
  * Node representing branches within the expression tree corresponding to
@@ -266,7 +265,7 @@
         if ( ( null != getAnnotations() ) && getAnnotations().containsKey( "count"
) )
         {
             buf.append( '[' );
-            buf.append( ( ( BigInteger ) getAnnotations().get( "count" ) ).toString() );
+            buf.append( ( ( Long ) getAnnotations().get( "count" ) ).toString() );
             buf.append( "] " );
         }
         else
@@ -368,7 +367,7 @@
         if ( ( null != getAnnotations() ) && getAnnotations().containsKey( "count"
) )
         {
             buf.append( '[' );
-            buf.append( ( ( BigInteger ) getAnnotations().get( "count" ) ).toString() );
+            buf.append( ( ( Long ) getAnnotations().get( "count" ) ).toString() );
             buf.append( "] " );
         }
         else

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LongComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LongComparator.java?view=auto&rev=517453
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LongComparator.java
(added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LongComparator.java
Mon Mar 12 16:12:37 2007
@@ -0,0 +1,66 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.util;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+
+/**
+ * Compares Long keys and values within a table.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Revision: 437007 $
+ */
+public class LongComparator implements Comparator<Object>, Serializable
+{
+    /** A instance of this comparator */
+    public static final LongComparator INSTANCE = new LongComparator();
+
+    /**
+     * Version id for serialization.
+     */
+    static final long serialVersionUID = 1L;
+
+
+    /**
+     * Compare two objects.
+     * 
+     * @param obj1 First object
+     * @param obj2 Second object
+     * @return 1 if obj1 > obj2, 0 if obj1 == obj2, -1 if obj1 < obj2
+     */
+    public int compare( Object obj1, Object obj2 )
+    {
+        if ( obj1 == null )
+        {
+            throw new IllegalArgumentException( "Argument 'obj1' is null" );
+        }
+
+        if ( obj2 == null )
+        {
+            throw new IllegalArgumentException( "Argument 'obj2' is null" );
+        }
+
+        Long long1 = (Long)obj1;
+        Long long2 = (Long)obj2;
+        return long1.compareTo( long2 );
+    }
+}



Mime
View raw message