001    /*
002     * Copyright 2010-2014 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.psi.stubs.impl;
018    
019    import com.intellij.psi.stubs.StubElement;
020    import com.intellij.util.io.StringRef;
021    import org.jetbrains.annotations.Nullable;
022    import org.jetbrains.jet.lang.psi.JetImportDirective;
023    import org.jetbrains.jet.lang.psi.stubs.PsiJetImportDirectiveStub;
024    import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
025    
026    public class PsiJetImportDirectiveStubImpl extends JetStubBaseImpl<JetImportDirective> implements PsiJetImportDirectiveStub {
027        private final boolean isAbsoluteInRootPackage;
028        private final boolean isAllUnder;
029        @Nullable
030        private final StringRef aliasName;
031        private final boolean isValid;
032    
033        public PsiJetImportDirectiveStubImpl(
034                StubElement parent,
035                boolean isAbsoluteInRootPackage,
036                boolean isAllUnder,
037                @Nullable StringRef aliasName,
038                boolean isValid
039        ) {
040            super(parent, JetStubElementTypes.IMPORT_DIRECTIVE);
041            this.isAbsoluteInRootPackage = isAbsoluteInRootPackage;
042            this.isAllUnder = isAllUnder;
043            this.aliasName = aliasName;
044            this.isValid = isValid;
045        }
046    
047        @Override
048        public boolean isAbsoluteInRootPackage() {
049            return isAbsoluteInRootPackage;
050        }
051    
052        @Override
053        public boolean isAllUnder() {
054            return isAllUnder;
055        }
056    
057        @Nullable
058        @Override
059        public String getAliasName() {
060            return StringRef.toString(aliasName);
061        }
062    
063        @Override
064        public boolean isValid() {
065            return isValid;
066        }
067    }