001/*
002 * Copyright 2010-2013 JetBrains s.r.o.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.jetbrains.jet.util.slicedmap;
018
019import org.jetbrains.annotations.NotNull;
020
021/**
022 * Do nothing but dispatching all invokes to internal writable slice.
023 */
024public class DelegatingSlice<K, V> implements WritableSlice<K, V> {
025    private final WritableSlice<K, V> delegate;
026
027    public DelegatingSlice(@NotNull WritableSlice<K, V> delegate) {
028        this.delegate = delegate;
029    }
030
031    @Override
032    public boolean isCollective() {
033        return delegate.isCollective();
034    }
035
036    @Override
037    public boolean check(K key, V value) {
038        return delegate.check(key, value);
039    }
040
041    @Override
042    public void afterPut(MutableSlicedMap map, K key, V value) {
043        delegate.afterPut(map, key, value);
044    }
045
046    @Override
047    public RewritePolicy getRewritePolicy() {
048        return delegate.getRewritePolicy();
049    }
050
051    @Override
052    public SlicedMapKey<K, V> makeKey(K key) {
053        return delegate.makeKey(key);
054    }
055
056    @Override
057    public V computeValue(SlicedMap map, K key, V value, boolean valueNotFound) {
058        return delegate.computeValue(map, key, value, valueNotFound);
059    }
060
061    @Override
062    public ReadOnlySlice<K, V> makeRawValueVersion() {
063        return delegate.makeRawValueVersion();
064    }
065}