
com.intellij.compiler.ModuleSourceSet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of compiler-openapi Show documentation
Show all versions of compiler-openapi Show documentation
A packaging of the IntelliJ Community Edition compiler-openapi library.
This is release number 1 of trunk branch 142.
The newest version!
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.compiler;
import com.intellij.openapi.module.Module;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
/**
* @author nik
*/
public class ModuleSourceSet {
public enum Type { PRODUCTION, TEST }
private final Module myModule;
private final Type myType;
public ModuleSourceSet(@NotNull Module module, @NotNull Type type) {
myModule = module;
myType = type;
}
@NotNull
public Module getModule() {
return myModule;
}
@NotNull
public Type getType() {
return myType;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ModuleSourceSet set = (ModuleSourceSet)o;
return myModule.equals(set.myModule) && myType == set.myType;
}
@Override
public int hashCode() {
return 31 * myModule.hashCode() + myType.hashCode();
}
@Override
public String toString() {
return getDisplayName();
}
public String getDisplayName() {
return (myType == Type.PRODUCTION ? "" : "Tests of ") + "'" + myModule.getName() + "' module";
}
@NotNull
public static Set getModules(@NotNull Collection sourceSets) {
Set modules = new HashSet();
for (ModuleSourceSet set : sourceSets) {
modules.add(set.getModule());
}
return modules;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy