Rename recursive INode methods 38/63338/2
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 20 Sep 2017 15:10:03 +0000 (17:10 +0200)
committerRobert Varga <nite@hq.sk>
Fri, 22 Sep 2017 22:13:08 +0000 (22:13 +0000)
Change names to conform to Java standards:
- rec_insert -> recInsert
- rec_insertif -> recInsertIf
- rec_lookup -> recLookup
- rec_remove -> recRemove

Change-Id: Ic11da9ac2ae96d8029d0bb08464033bfe027ee0b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/INode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/MutableTrieMap.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/TrieMap.java

index ebd6b7f3950f74cf65f3ec449bd75654c47b754c..a24584e2099490954e985874b5e45eb0c94683df 100644 (file)
@@ -126,12 +126,12 @@ final class INode<K, V> extends BasicNode {
      *
      * @return true if successful, false otherwise
      */
-    boolean rec_insert(final K key, final V value, final int hc, final int lev, final INode<K, V> parent,
+    boolean recInsert(final K key, final V value, final int hc, final int lev, final INode<K, V> parent,
             final TrieMap<K, V> ct) {
-        return rec_insert(key, value, hc, lev, parent, gen, ct);
+        return recInsert(key, value, hc, lev, parent, gen, ct);
     }
 
-    private boolean rec_insert(final K k, final V v, final int hc, final int lev, final INode<K, V> parent,
+    private boolean recInsert(final K k, final V v, final int hc, final int lev, final INode<K, V> parent,
             final Gen startgen, final TrieMap<K, V> ct) {
         while (true) {
             final MainNode<K, V> m = GCAS_READ(ct);
@@ -151,7 +151,7 @@ final class INode<K, V> extends BasicNode {
                     if (cnAtPos instanceof INode) {
                         final INode<K, V> in = (INode<K, V>) cnAtPos;
                         if (startgen == in.gen) {
-                            return in.rec_insert(k, v, hc, lev + LEVEL_BITS, this, startgen, ct);
+                            return in.recInsert(k, v, hc, lev + LEVEL_BITS, this, startgen, ct);
                         }
                         if (GCAS(cn, cn.renewed(startgen, ct), ct)) {
                             // Tail recursion: return rec_insert(k, v, hc, lev, parent, startgen, ct);
@@ -214,14 +214,14 @@ final class INode<K, V> extends BasicNode {
      * @return null if unsuccessful, Option[V] otherwise (indicating
      *         previous value bound to the key)
      */
-    Optional<V> rec_insertif(final K k, final V v, final int hc, final Object cond, final int lev,
+    Optional<V> recInsertIf(final K k, final V v, final int hc, final Object cond, final int lev,
             final INode<K, V> parent, final TrieMap<K, V> ct) {
-        return rec_insertif(k, v, hc, cond, lev, parent, gen, ct);
+        return recInsertIf(k, v, hc, cond, lev, parent, gen, ct);
     }
 
     @SuppressFBWarnings(value = "NP_OPTIONAL_RETURN_NULL",
             justification = "Returning null Optional indicates the need to restart.")
-    private Optional<V> rec_insertif(final K k, final V v, final int hc, final Object cond, final int lev,
+    private Optional<V> recInsertIf(final K k, final V v, final int hc, final Object cond, final int lev,
             final INode<K, V> parent, final Gen startgen, final TrieMap<K, V> ct) {
         while (true) {
             final MainNode<K, V> m = GCAS_READ(ct);
@@ -241,7 +241,7 @@ final class INode<K, V> extends BasicNode {
                     if (cnAtPos instanceof INode) {
                         final INode<K, V> in = (INode<K, V>) cnAtPos;
                         if (startgen == in.gen) {
-                            return in.rec_insertif(k, v, hc, cond, lev + LEVEL_BITS, this, startgen, ct);
+                            return in.recInsertIf(k, v, hc, cond, lev + LEVEL_BITS, this, startgen, ct);
                         }
 
                         if (GCAS(cn, cn.renewed(startgen, ct), ct)) {
@@ -355,11 +355,11 @@ final class INode<K, V> extends BasicNode {
      * @return null if no value has been found, RESTART if the operation
      *         wasn't successful, or any other value otherwise
      */
-    Object rec_lookup(final K k, final int hc, final int lev, final INode<K, V> parent, final TrieMap<K, V> ct) {
-        return rec_lookup(k, hc, lev, parent, gen, ct);
+    Object recLookup(final K k, final int hc, final int lev, final INode<K, V> parent, final TrieMap<K, V> ct) {
+        return recLookup(k, hc, lev, parent, gen, ct);
     }
 
-    private Object rec_lookup(final K k, final int hc, final int lev, final INode<K, V> parent, final Gen startgen,
+    private Object recLookup(final K k, final int hc, final int lev, final INode<K, V> parent, final Gen startgen,
             final TrieMap<K, V> ct) {
         while (true) {
             final MainNode<K, V> m = GCAS_READ(ct);
@@ -382,7 +382,7 @@ final class INode<K, V> extends BasicNode {
                 if (sub instanceof INode) {
                     final INode<K, V> in = (INode<K, V>) sub;
                     if (ct.isReadOnly() || (startgen == in.gen)) {
-                        return in.rec_lookup(k, hc, lev + LEVEL_BITS, this, startgen, ct);
+                        return in.recLookup(k, hc, lev + LEVEL_BITS, this, startgen, ct);
                     }
 
                     if (GCAS(cn, cn.renewed(startgen, ct), ct)) {
@@ -439,14 +439,14 @@ final class INode<K, V> extends BasicNode {
      * @return null if not successful, an Optional indicating the previous
      *         value otherwise
      */
-    Optional<V> rec_remove(final K k, final Object cond, final int hc, final int lev, final INode<K, V> parent,
+    Optional<V> recRemove(final K k, final Object cond, final int hc, final int lev, final INode<K, V> parent,
             final TrieMap<K, V> ct) {
-        return rec_remove(k, cond, hc, lev, parent, gen, ct);
+        return recRemove(k, cond, hc, lev, parent, gen, ct);
     }
 
     @SuppressFBWarnings(value = "NP_OPTIONAL_RETURN_NULL",
             justification = "Returning null Optional indicates the need to restart.")
-    private Optional<V> rec_remove(final K k, final Object cond, final int hc, final int lev, final INode<K, V> parent,
+    private Optional<V> recRemove(final K k, final Object cond, final int hc, final int lev, final INode<K, V> parent,
             final Gen startgen, final TrieMap<K, V> ct) {
         final MainNode<K, V> m = GCAS_READ(ct);
 
@@ -465,10 +465,10 @@ final class INode<K, V> extends BasicNode {
             if (sub instanceof INode) {
                 final INode<K, V> in = (INode<K, V>) sub;
                 if (startgen == in.gen) {
-                    res = in.rec_remove(k, cond, hc, lev + LEVEL_BITS, this, startgen, ct);
+                    res = in.recRemove(k, cond, hc, lev + LEVEL_BITS, this, startgen, ct);
                 } else {
                     if (GCAS(cn, cn.renewed(startgen, ct), ct)) {
-                        res = rec_remove(k, cond, hc, lev, parent, startgen, ct);
+                        res = recRemove(k, cond, hc, lev, parent, startgen, ct);
                     } else {
                         res = null;
                     }
index a93e3a11dc12d46695da0d561bf6f90175075438..adbf4997f0815436a8eb6703b4e52e5ce1314f94 100644 (file)
@@ -172,7 +172,7 @@ public final class MutableTrieMap<K, V> extends TrieMap<K, V> {
     private void inserthc(final K key, final int hc, final V value) {
         // TODO: this is called from serialization only, which means we should not be observing any races,
         //       hence we should not need to pass down the entire tree, just equality (I think).
-        final boolean success = RDCSS_READ_ROOT().rec_insert(key, value, hc, 0, null, this);
+        final boolean success = RDCSS_READ_ROOT().recInsert(key, value, hc, 0, null, this);
         Verify.verify(success, "Concurrent modification during serialization of map %s", this);
     }
 
@@ -180,7 +180,7 @@ public final class MutableTrieMap<K, V> extends TrieMap<K, V> {
         Optional<V> res;
         do {
             // Keep looping as long as we do not get a reply
-            res = RDCSS_READ_ROOT().rec_insertif(key, value, hc, cond, 0, null, this);
+            res = RDCSS_READ_ROOT().recInsertIf(key, value, hc, cond, 0, null, this);
         } while (res == null);
 
         return res;
@@ -190,7 +190,7 @@ public final class MutableTrieMap<K, V> extends TrieMap<K, V> {
         Optional<V> res;
         do {
             // Keep looping as long as we do not get a reply
-            res = RDCSS_READ_ROOT().rec_remove(key, cond, hc, 0, null, this);
+            res = RDCSS_READ_ROOT().recRemove(key, cond, hc, 0, null, this);
         } while (res == null);
 
         return res;
index eb23f3a36b5e344cac6cc0d4754d591183ce03e5..503572bd1dabd13fa7322cf793db1a232f41c875 100644 (file)
@@ -220,7 +220,7 @@ public abstract class TrieMap<K, V> extends AbstractMap<K, V> implements Concurr
         Object res;
         do {
             // Keep looping as long as RESTART is being indicated
-            res = RDCSS_READ_ROOT().rec_lookup(key, hc, 0, null, this);
+            res = RDCSS_READ_ROOT().recLookup(key, hc, 0, null, this);
         } while (res == RESTART);
 
         return (V) res;