001 /* 002 * Copyright 2010-2015 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 017 package org.jetbrains.kotlin.util.slicedMap; 018 019 import org.jetbrains.annotations.NotNull; 020 021 /** 022 * Do nothing but dispatching all invokes to internal writable slice. 023 */ 024 public 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 @NotNull 053 public KeyWithSlice<K, V, WritableSlice<K, V>> getKey() { 054 return delegate.getKey(); 055 } 056 057 @Override 058 public V computeValue(SlicedMap map, K key, V value, boolean valueNotFound) { 059 return delegate.computeValue(map, key, value, valueNotFound); 060 } 061 062 @Override 063 public ReadOnlySlice<K, V> makeRawValueVersion() { 064 return delegate.makeRawValueVersion(); 065 } 066 }