Migrate to tech.pantheon.TrieMap
[yangtools.git] / third-party / triemap / src / main / java / org / opendaylight / yangtools / triemap / ImmutableTrieMap.java
index ae0a75438980d912a94c3355313349f00d016ba1..fb267037cca3a7177fa2b358499803be35f13708 100644 (file)
  */
 package org.opendaylight.yangtools.triemap;
 
-import static java.util.Objects.requireNonNull;
-
-import com.google.common.annotations.Beta;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import java.util.Map;
-import java.util.function.BiFunction;
-import java.util.function.Function;
-
 /**
  * An immutable TrieMap.
  *
@@ -30,121 +22,23 @@ import java.util.function.Function;
  *
  * @param <K> the type of keys maintained by this map
  * @param <V> the type of mapped values
+ * @deprecated use {@link tech.pantheon.triemap.ImmutableTrieMap} instead.
  */
-@Beta
+@Deprecated
 public final class ImmutableTrieMap<K, V> extends TrieMap<K, V> {
     private static final long serialVersionUID = 1L;
 
-    @SuppressFBWarnings(value = "SE_BAD_FIELD", justification = "Handled by SerializationProxy")
-    private final INode<K, V> root;
-
-    ImmutableTrieMap(final INode<K, V> root, final Equivalence<? super K> equiv) {
-        super(equiv);
-        this.root = requireNonNull(root);
-    }
-
-    @Override
-    public void clear() {
-        throw unsupported();
-    }
-
-    @Override
-    public V compute(final K key, final BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
-        throw unsupported();
-    }
-
-    @Override
-    public V computeIfAbsent(final K key, final Function<? super K, ? extends V> mappingFunction) {
-        throw unsupported();
-    }
-
-    @Override
-    public V computeIfPresent(final K key, final BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
-        throw unsupported();
-    }
-
-    @Override
-    public V merge(final K key, final V value, final BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
-        throw unsupported();
-    }
-
-    @Override
-    public V put(final K key, final V value) {
-        throw unsupported();
-    }
-
-    @Override
-    @SuppressWarnings("checkstyle:parameterName")
-    public void putAll(final Map<? extends K, ? extends V> m) {
-        throw unsupported();
-    }
-
-    @Override
-    public V putIfAbsent(final K key, final V value) {
-        throw unsupported();
-    }
-
-    @Override
-    public V remove(final Object key) {
-        throw unsupported();
-    }
-
-    @Override
-    public boolean remove(final Object key, final Object value) {
-        throw unsupported();
-    }
-
-    @Override
-    public boolean replace(final K key, final V oldValue, final V newValue) {
-        throw unsupported();
-    }
-
-    @Override
-    public V replace(final K key, final V value) {
-        throw unsupported();
-    }
-
-    @Override
-    public int size() {
-        return root.size(this);
+    ImmutableTrieMap(final tech.pantheon.triemap.ImmutableTrieMap<K, V> delegate) {
+        super(delegate);
     }
 
     @Override
     public TrieMap<K, V> mutableSnapshot() {
-        return new MutableTrieMap<>(equiv(), new INode<>(new Gen(), root.gcasRead(this)));
+        return new MutableTrieMap<>(delegate().mutableSnapshot());
     }
 
     @Override
     public ImmutableTrieMap<K, V> immutableSnapshot() {
         return this;
     }
-
-    @Override
-    ImmutableEntrySet<K, V> createEntrySet() {
-        return new ImmutableEntrySet<>(this);
-    }
-
-    @Override
-    ImmutableKeySet<K> createKeySet() {
-        return new ImmutableKeySet<>(this);
-    }
-
-    @Override
-    boolean isReadOnly() {
-        return true;
-    }
-
-    @Override
-    ImmutableIterator<K, V> iterator() {
-        return immutableIterator();
-    }
-
-    @Override
-    INode<K, V> RDCSS_READ_ROOT(final boolean abort) {
-        return root;
-    }
-
-    static UnsupportedOperationException unsupported() {
-        return new UnsupportedOperationException("Attempted to modify a read-only view");
-    }
 }