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    
017    package org.jetbrains.jet.lang.resolve;
018    
019    import com.google.common.base.Predicate;
020    import com.intellij.psi.PsiFile;
021    import org.jetbrains.annotations.NotNull;
022    import org.jetbrains.jet.context.GlobalContext;
023    import org.jetbrains.jet.storage.ExceptionTracker;
024    import org.jetbrains.jet.storage.StorageManager;
025    
026    import java.util.List;
027    
028    /**
029     * Various junk that cannot be placed into context (yet).
030     */
031    public class TopDownAnalysisParameters implements GlobalContext {
032        @NotNull
033        private final StorageManager storageManager;
034        @NotNull
035        private final ExceptionTracker exceptionTracker;
036        @NotNull
037        private final Predicate<PsiFile> analyzeCompletely;
038        private final boolean analyzingBootstrapLibrary;
039        private final boolean declaredLocally;
040        @NotNull
041        private final List<AnalyzerScriptParameter> scriptParameters;
042    
043        public TopDownAnalysisParameters(
044                @NotNull StorageManager storageManager,
045                @NotNull ExceptionTracker exceptionTracker,
046                @NotNull Predicate<PsiFile> analyzeCompletely,
047                boolean analyzingBootstrapLibrary,
048                boolean declaredLocally,
049                @NotNull List<AnalyzerScriptParameter> scriptParameters
050        ) {
051            this.storageManager = storageManager;
052            this.exceptionTracker = exceptionTracker;
053            this.analyzeCompletely = analyzeCompletely;
054            this.analyzingBootstrapLibrary = analyzingBootstrapLibrary;
055            this.declaredLocally = declaredLocally;
056            this.scriptParameters = scriptParameters;
057        }
058    
059        @Override
060        @NotNull
061        public StorageManager getStorageManager() {
062            return storageManager;
063        }
064    
065        @Override
066        @NotNull
067        public ExceptionTracker getExceptionTracker() {
068            return exceptionTracker;
069        }
070    
071        @NotNull
072        public Predicate<PsiFile> getAnalyzeCompletely() {
073            return analyzeCompletely;
074        }
075    
076        public boolean isAnalyzingBootstrapLibrary() {
077            return analyzingBootstrapLibrary;
078        }
079    
080        public boolean isDeclaredLocally() {
081            return declaredLocally;
082        }
083    
084        @NotNull
085        public List<AnalyzerScriptParameter> getScriptParameters() {
086            return scriptParameters;
087        }
088    }