BUG-7464: Fix MainNode.cachedSize() 67/49867/6
authorRobert Varga <rovarga@cisco.com>
Fri, 30 Dec 2016 11:57:01 +0000 (12:57 +0100)
committerRobert Varga <rovarga@cisco.com>
Mon, 9 Jan 2017 14:17:12 +0000 (15:17 +0100)
These classes are not visible to the outside world, hence should
have package visibility. It should also take TrieMap as an argument,
thus eliminating the need for a cast in CNode's implementation.

Change-Id: I3995385fe8cb41bd0134ee1317c466cc1f2baaa9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/CNode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/FailedNode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/LNode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/MainNode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/TNode.java

index de389bb1b75699dfe6f62a5c11c59169da992cd2..4a650d3de1b8f169dea9d1d20386774391b8cfdf 100644 (file)
@@ -29,13 +29,13 @@ final class CNode<K, V> extends CNodeBase<K, V> {
 
     // this should only be called from within read-only snapshots
     @Override
-    public int cachedSize(final Object ct) {
+    int cachedSize(final TrieMap<K, V> ct) {
         final int currsz = READ_SIZE();
         if (currsz != -1) {
             return currsz;
         }
 
-        final int sz = computeSize((TrieMap<K, V>) ct);
+        final int sz = computeSize(ct);
         while (READ_SIZE () == -1) {
             CAS_SIZE (-1, sz);
         }
index e562c41859636d3a43718bd80bb814dc7dcb94fb..0bc06acbcfd63f18ccedd53a7f1bb23f0ca7eff8 100644 (file)
@@ -29,7 +29,7 @@ final class FailedNode<K, V> extends MainNode<K, V> {
     }
 
     @Override
-    public int cachedSize(final Object ct) {
+    int cachedSize(final TrieMap<K, V> ct) {
         throw new UnsupportedOperationException();
     }
 
index 3aad0d70c2e24224369302dcea2dc666024f8ea1..a0570f5e0294254b96183edcd5437ca140ba37aa 100644 (file)
@@ -52,7 +52,7 @@ final class LNode<K, V> extends MainNode<K, V> {
     }
 
     @Override
-    public int cachedSize(final Object ct) {
+    int cachedSize(final TrieMap<K, V> ct) {
         return listmap.size();
     }
 
index 0ae45ee7e5ca714712edab1673931a485d2e62ba..8d28b4f82efb4a61b99dfd8e1a8ff5970a28b3fd 100644 (file)
@@ -23,7 +23,7 @@ abstract class MainNode<K, V> extends BasicNode {
 
     public volatile MainNode<K, V> prev = null;
 
-    public abstract int cachedSize (Object ct);
+    abstract int cachedSize(TrieMap<K, V> ct);
 
     public boolean CAS_PREV (final MainNode<K, V> oldval, final MainNode<K, V> nval) {
         return updater.compareAndSet (this, oldval, nval);
index 28612dcfe6fe2d1f6212c8ac0332e54a7b1bb77c..27a925cc8ef094214b36c6fd6ce843e94c303d77 100644 (file)
@@ -47,7 +47,7 @@ final class TNode<K, V> extends MainNode<K, V> implements KVNode<K, V> {
     }
 
     @Override
-    public int cachedSize(final Object ct) {
+    int cachedSize(final TrieMap<K, V> ct) {
         return 1;
     }