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.lang.resolve.scopes;
018
019import org.jetbrains.annotations.NotNull;
020import org.jetbrains.jet.lang.descriptors.*;
021import org.jetbrains.jet.lang.resolve.name.LabelName;
022import org.jetbrains.jet.lang.resolve.name.Name;
023
024import java.util.Collection;
025import java.util.List;
026
027/**
028 * Introduces a simple wrapper for internal scope.
029 */
030public abstract class AbstractScopeAdapter implements JetScope {
031    @NotNull
032    protected abstract JetScope getWorkerScope();
033
034    @NotNull
035    @Override
036    public List<ReceiverParameterDescriptor> getImplicitReceiversHierarchy() {
037        return getWorkerScope().getImplicitReceiversHierarchy();
038    }
039
040    @NotNull
041    @Override
042    public Collection<FunctionDescriptor> getFunctions(@NotNull Name name) {
043        return getWorkerScope().getFunctions(name);
044    }
045
046    @Override
047    public NamespaceDescriptor getNamespace(@NotNull Name name) {
048        return getWorkerScope().getNamespace(name);
049    }
050
051    @Override
052    public ClassifierDescriptor getClassifier(@NotNull Name name) {
053        return getWorkerScope().getClassifier(name);
054    }
055
056    @Override
057    public ClassDescriptor getObjectDescriptor(@NotNull Name name) {
058        return getWorkerScope().getObjectDescriptor(name);
059    }
060
061    @NotNull
062    @Override
063    public Collection<ClassDescriptor> getObjectDescriptors() {
064        return getWorkerScope().getObjectDescriptors();
065    }
066
067    @NotNull
068    @Override
069    public Collection<VariableDescriptor> getProperties(@NotNull Name name) {
070        return getWorkerScope().getProperties(name);
071    }
072
073    @Override
074    public VariableDescriptor getLocalVariable(@NotNull Name name) {
075        return getWorkerScope().getLocalVariable(name);
076    }
077
078    @NotNull
079    @Override
080    public DeclarationDescriptor getContainingDeclaration() {
081        return getWorkerScope().getContainingDeclaration();
082    }
083
084    @NotNull
085    @Override
086    public Collection<DeclarationDescriptor> getDeclarationsByLabel(LabelName labelName) {
087        return getWorkerScope().getDeclarationsByLabel(labelName);
088    }
089
090    @Override
091    public PropertyDescriptor getPropertyByFieldReference(@NotNull Name fieldName) {
092        return getWorkerScope().getPropertyByFieldReference(fieldName);
093    }
094
095    @NotNull
096    @Override
097    public Collection<DeclarationDescriptor> getAllDescriptors() {
098        return getWorkerScope().getAllDescriptors();
099    }
100
101    @NotNull
102    @Override
103    public Collection<DeclarationDescriptor> getOwnDeclaredDescriptors() {
104        return getWorkerScope().getOwnDeclaredDescriptors();
105    }
106}