directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1695972 - in /directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree: ./ avl/
Date Fri, 14 Aug 2015 19:36:39 GMT
Author: seelmann
Date: Fri Aug 14 19:36:39 2015
New Revision: 1695972

URL: http://svn.apache.org/r1695972
Log:
Fix checkstyle issues

Modified:
    directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayTree.java
    directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTree.java
    directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeImpl.java
    directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapImpl.java
    directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/KeyTupleAvlCursor.java
    directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/avl/AvlNode.java
    directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/avl/AvlTreeIterator.java
    directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/avl/AvlTreeSet.java

Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayTree.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayTree.java?rev=1695972&r1=1695971&r2=1695972&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayTree.java
(original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayTree.java
Fri Aug 14 19:36:39 2015
@@ -418,10 +418,11 @@ public class ArrayTree<K>
                         }
 
                         return array[start];
+
+                    default:
+                        return null;
                 }
         }
-
-        return null;
     }
 
 
@@ -536,10 +537,11 @@ public class ArrayTree<K>
                         }
 
                         return array[start];
+
+                    default:
+                        return null;
                 }
         }
-
-        return null;
     }
 
 
@@ -674,10 +676,11 @@ public class ArrayTree<K>
                         {
                             return array[start + 1];
                         }
+
+                    default:
+                        return null;
                 }
         }
-
-        return null;
     }
 
 
@@ -827,10 +830,11 @@ public class ArrayTree<K>
                         {
                             return array[start + 1];
                         }
+
+                    default:
+                        return null;
                 }
         }
-
-        return null;
     }
 
 
@@ -927,10 +931,11 @@ public class ArrayTree<K>
                         {
                             return null;
                         }
+
+                    default:
+                        return null;
                 }
         }
-
-        return null;
     }
 
 
@@ -1027,10 +1032,11 @@ public class ArrayTree<K>
                         {
                             return -1;
                         }
+
+                    default:
+                        return -1;
                 }
         }
-
-        return -1;
     }
 
 
@@ -1136,10 +1142,11 @@ public class ArrayTree<K>
                         {
                             return -1;
                         }
+
+                    default:
+                        return -1;
                 }
         }
-
-        return -1;
     }
 
 
@@ -1245,10 +1252,11 @@ public class ArrayTree<K>
                         {
                             return -1;
                         }
+
+                    default:
+                        return -1;
                 }
         }
-
-        return -1;
     }
 
 

Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTree.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTree.java?rev=1695972&r1=1695971&r2=1695972&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTree.java
(original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTree.java
Fri Aug 14 19:36:39 2015
@@ -35,7 +35,7 @@ public interface AvlTree<K>
     /**
      * @return the comparator associated with this tree 
      */
-    abstract Comparator<K> getComparator();
+    Comparator<K> getComparator();
 
 
     /**
@@ -45,7 +45,7 @@ public interface AvlTree<K>
      * @return the replaced key if it already exists
      * Note: Ignores if a node with the given key already exists.
      */
-    abstract K insert( K key );
+    K insert( K key );
 
 
     /**
@@ -54,7 +54,7 @@ public interface AvlTree<K>
      * @param key the value of the node to be removed
      * @return the removed key, if any, or null if the key does not exist
      */
-    abstract K remove( K key );
+    K remove( K key );
 
 
     /**
@@ -62,7 +62,7 @@ public interface AvlTree<K>
      * 
      * @return true if the tree is empty, false otherwise
      */
-    abstract boolean isEmpty();
+    boolean isEmpty();
 
 
     /**
@@ -71,38 +71,38 @@ public interface AvlTree<K>
      * @return the number of nodes present in this tree
      */
     //NOTE: This method is internally used by AVLTreeMarshaller
-    abstract int getSize();
+    int getSize();
 
 
     /**
      * @return the root element of this tree (ie, not the first, but the
      * topmost element)
      */
-    abstract LinkedAvlNode<K> getRoot();
+    LinkedAvlNode<K> getRoot();
 
 
     /**
      * @return a list of the stored keys in this tree
      */
-    abstract List<K> getKeys();
+    List<K> getKeys();
 
 
     /**
      * Prints the contents of AVL tree in pretty format
      */
-    abstract void printTree();
+    void printTree();
 
 
     /**
      * @return The first element of this tree
      */
-    abstract LinkedAvlNode<K> getFirst();
+    LinkedAvlNode<K> getFirst();
 
 
     /**
      * @return The last element in this tree
      */
-    abstract LinkedAvlNode<K> getLast();
+    LinkedAvlNode<K> getLast();
 
 
     /**
@@ -112,7 +112,7 @@ public interface AvlTree<K>
      * @return the LinkedAvlNode<K> whose key is greater than the given key ,<br>
      *         null if there is no node with a higher key than the given key.
      */
-    abstract LinkedAvlNode<K> findGreater( K key );
+    LinkedAvlNode<K> findGreater( K key );
 
 
     /**
@@ -122,7 +122,7 @@ public interface AvlTree<K>
      * @return the LinkedAvlNode<K> whose key is greater than the given key ,<br>
      *         null if there is no node with a higher key than the given key.
      */
-    abstract LinkedAvlNode<K> findGreaterOrEqual( K key );
+    LinkedAvlNode<K> findGreaterOrEqual( K key );
 
 
     /**
@@ -132,7 +132,7 @@ public interface AvlTree<K>
      * @return the LinkedAvlNode<K> whose key is lower than the given key ,<br>
      *         null if there is no node with a lower key than the given key.
      */
-    abstract LinkedAvlNode<K> findLess( K key );
+    LinkedAvlNode<K> findLess( K key );
 
 
     /**
@@ -142,7 +142,7 @@ public interface AvlTree<K>
      * @return the LinkedAvlNode<K> whose key is lower than the given key ,<br>
      *         null if there is no node with a lower key than the given key.
      */
-    abstract LinkedAvlNode<K> findLessOrEqual( K key );
+    LinkedAvlNode<K> findLessOrEqual( K key );
 
 
     /**
@@ -152,5 +152,5 @@ public interface AvlTree<K>
      * @param key the key to find
      * @return the list of traversed LinkedAvlNode.
      */
-    abstract LinkedAvlNode<K> find( K key );
+    LinkedAvlNode<K> find( K key );
 }
\ No newline at end of file

Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeImpl.java?rev=1695972&r1=1695971&r2=1695972&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeImpl.java
(original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeImpl.java
Fri Aug 14 19:36:39 2015
@@ -116,7 +116,8 @@ public class AvlTreeImpl<K> implements A
             }
         }
 
-        if ( ( c = comparator.compare( key, parent.getKey() ) ) < 0 )
+        c = comparator.compare( key, parent.getKey() );
+        if ( c < 0 )
         {
             parent.setLeft( node );
         }
@@ -139,7 +140,8 @@ public class AvlTreeImpl<K> implements A
     {
         if ( node.next == null && node.previous == null ) // should happen in case
of tree having single node
         {
-            first = last = null;
+            first = null;
+            last = null;
         }
         else if ( node.next == null ) // last node
         {

Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapImpl.java?rev=1695972&r1=1695971&r2=1695972&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapImpl.java
(original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapImpl.java
Fri Aug 14 19:36:39 2015
@@ -157,7 +157,8 @@ public class AvlTreeMapImpl<K, V> implem
             }
         }
 
-        if ( ( c = keyComparator.compare( key, parent.getKey() ) ) < 0 )
+        c = keyComparator.compare( key, parent.getKey() );
+        if ( c < 0 )
         {
             parent.setLeft( node );
         }
@@ -209,7 +210,8 @@ public class AvlTreeMapImpl<K, V> implem
     {
         if ( node.next == null && node.previous == null ) // should happen in case
of tree having single node
         {
-            first = last = null;
+            first = null;
+            last = null;
         }
         else if ( node.next == null ) // last node
         {

Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/KeyTupleAvlCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/KeyTupleAvlCursor.java?rev=1695972&r1=1695971&r2=1695972&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/KeyTupleAvlCursor.java
(original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/KeyTupleAvlCursor.java
Fri Aug 14 19:36:39 2015
@@ -201,7 +201,8 @@ public class KeyTupleAvlCursor<K, V> ext
         {
             returnedTuple.setKey( key );
             returnedTuple.setValue( wrapped.get() );
-            return valueAvailable = true;
+            valueAvailable = true;
+            return true;
         }
         else
         {
@@ -222,7 +223,8 @@ public class KeyTupleAvlCursor<K, V> ext
         {
             returnedTuple.setKey( key );
             returnedTuple.setValue( wrapped.get() );
-            return valueAvailable = true;
+            valueAvailable = true;
+            return true;
         }
         else
         {

Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/avl/AvlNode.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/avl/AvlNode.java?rev=1695972&r1=1695971&r2=1695972&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/avl/AvlNode.java
(original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/avl/AvlNode.java
Fri Aug 14 19:36:39 2015
@@ -28,13 +28,13 @@ package org.apache.directory.server.core
  */
 final class AvlNode<T extends Comparable<T>>
 {
-    public AvlNode<T> parent = null;
-    public AvlNode<T> left = null;
-    public AvlNode<T> right = null;
+    AvlNode<T> parent = null;
+    AvlNode<T> left = null;
+    AvlNode<T> right = null;
 
-    public int height = 0;
-    public int balance = 0;
-    public T value = null;
+    int height = 0;
+    int balance = 0;
+    T value = null;
 
 
     public AvlNode( AvlNode<T> parent, T value )

Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/avl/AvlTreeIterator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/avl/AvlTreeIterator.java?rev=1695972&r1=1695971&r2=1695972&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/avl/AvlTreeIterator.java
(original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/avl/AvlTreeIterator.java
Fri Aug 14 19:36:39 2015
@@ -39,7 +39,7 @@ final class AvlTreeIterator<T extends Co
     public AvlTreeIterator( AvlNode<T> root )
     {
         this.root = root;
-        find_next();
+        findNext();
     }
 
 
@@ -54,12 +54,12 @@ final class AvlTreeIterator<T extends Co
     public T next()
     {
         T value = next == null ? null : next.value;
-        find_next();
+        findNext();
         return value;
     }
 
 
-    public void find_next()
+    public void findNext()
     {
         if ( next == null )
         {

Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/avl/AvlTreeSet.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/avl/AvlTreeSet.java?rev=1695972&r1=1695971&r2=1695972&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/avl/AvlTreeSet.java
(original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/avl/AvlTreeSet.java
Fri Aug 14 19:36:39 2015
@@ -131,7 +131,7 @@ public class AvlTreeSet<T extends Compar
     }
 
 
-    private final AvlNode<T> newNode( AvlNode<T> parent, T value )
+    private AvlNode<T> newNode( AvlNode<T> parent, T value )
     {
         if ( !useFreeList || freeList.isEmpty() )
         {
@@ -146,7 +146,7 @@ public class AvlTreeSet<T extends Compar
     }
 
 
-    private final void recycleNode( AvlNode<T> node )
+    private void recycleNode( AvlNode<T> node )
     {
         if ( !useFreeList )
         {
@@ -222,32 +222,32 @@ public class AvlTreeSet<T extends Compar
         }
 
         // find a replacement node (if needed)
-        final int LEFT = -1;
-        final int RIGHT = 1;
-        final int NONE = 0;
-        int replaceFrom = NONE;
+        final int left = -1;
+        final int right = 1;
+        final int none = 0;
+        int replaceFrom = none;
 
         if ( node.left != null && node.right == null )
         {
-            replaceFrom = LEFT;
+            replaceFrom = left;
         }
         else if ( node.right != null && node.left == null )
         {
-            replaceFrom = RIGHT;
+            replaceFrom = right;
         }
         else if ( node.right != null && node.left != null )
         {
             if ( node.balance < 0 )
             {
-                replaceFrom = LEFT;
+                replaceFrom = left;
             }
             else if ( node.balance > 0 )
             {
-                replaceFrom = RIGHT;
+                replaceFrom = right;
             }
             else
             {
-                replaceFrom = LEFT; // TODO: asymmetry
+                replaceFrom = left; // TODO: asymmetry
             }
         }
         else
@@ -276,15 +276,15 @@ public class AvlTreeSet<T extends Compar
                 // update heights/rebalance from node's parents up (the bottom of this method)
                 node = node.parent;
                 recycleNode( dead );
-                replaceFrom = NONE;
+                replaceFrom = none;
             }
         }
 
-        if ( replaceFrom != NONE )
+        if ( replaceFrom != none )
         {
             AvlNode<T> leaf = null;
 
-            if ( replaceFrom == LEFT )
+            if ( replaceFrom == left )
             {
                 leaf = node.left;
 
@@ -301,7 +301,7 @@ public class AvlTreeSet<T extends Compar
                     }
                 }
             }
-            else if ( replaceFrom == RIGHT )
+            else if ( replaceFrom == right )
             {
                 leaf = node.right;
 
@@ -381,7 +381,7 @@ public class AvlTreeSet<T extends Compar
     }
 
 
-    private static final <T extends Comparable<T>> void updateHeight( AvlNode<T>
node )
+    private static <T extends Comparable<T>> void updateHeight( AvlNode<T>
node )
     {
         int leftHeight = ( node.left == null ) ? -1 : node.left.height;
         int rightHeight = ( node.right == null ) ? -1 : node.right.height;
@@ -390,7 +390,7 @@ public class AvlTreeSet<T extends Compar
     }
 
 
-    private static final <T extends Comparable<T>> AvlNode<T> smallLeftRotation(
AvlNode<T> node )
+    private static <T extends Comparable<T>> AvlNode<T> smallLeftRotation(
AvlNode<T> node )
     {
         assert node.balance > 0 : "null right child in smallLeft";
 
@@ -428,7 +428,7 @@ public class AvlTreeSet<T extends Compar
     }
 
 
-    private static final <T extends Comparable<T>> AvlNode<T> smallRightRotation(
AvlNode<T> node )
+    private static <T extends Comparable<T>> AvlNode<T> smallRightRotation(
AvlNode<T> node )
     {
         assert node.balance < 0 : "null left child in smallRight";
 
@@ -466,7 +466,7 @@ public class AvlTreeSet<T extends Compar
     }
 
 
-    private static final <T extends Comparable<T>> AvlNode<T> bigLeftRotation(
AvlNode<T> node )
+    private static <T extends Comparable<T>> AvlNode<T> bigLeftRotation(
AvlNode<T> node )
     {
         assert node.right != null : "null right child in bigLeft";
 
@@ -481,7 +481,7 @@ public class AvlTreeSet<T extends Compar
     }
 
 
-    private static final <T extends Comparable<T>> AvlNode<T> bigRightRotation(
AvlNode<T> node )
+    private static <T extends Comparable<T>> AvlNode<T> bigRightRotation(
AvlNode<T> node )
     {
         assert node.left != null : "null right child in bigRight";
 



Mime
View raw message