50 lines
1.2 KiB
Java
50 lines
1.2 KiB
Java
package src.fr.impl;
|
|
|
|
import src.fr.api.Category;
|
|
import src.fr.api.CompatibilityChecker;
|
|
import src.fr.api.Configuration;
|
|
import src.fr.api.PartType;
|
|
import src.fr.api.Configurator;
|
|
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
|
|
public class ConfiguratorImpl implements Configurator {
|
|
private Set<Category> categories;
|
|
private Set<PartType> partTypes;
|
|
private Configuration configuration;
|
|
private CompatibilityChecker compatibilityChecker;
|
|
|
|
public ConfiguratorImpl (Set<Category> cat, Set<PartType> pt, Configuration config) {
|
|
this.categories= cat;
|
|
this.partTypes=pt;
|
|
this.configuration=config;
|
|
}
|
|
|
|
@Override
|
|
public Set<Category> getCategories() {
|
|
return this.categories;
|
|
}
|
|
|
|
@Override
|
|
public Set<PartType> getVariants(Category category) {
|
|
Set<PartType>a = new HashSet<PartType>();
|
|
for(PartType x : partTypes){
|
|
if (x.getCategory()==category){
|
|
a.add(x);
|
|
}
|
|
}
|
|
return a;
|
|
}
|
|
|
|
@Override
|
|
public Configuration getConfiguration() {
|
|
return this.configuration;
|
|
}
|
|
|
|
@Override
|
|
public CompatibilityChecker getCompatibilityChecker() {
|
|
return this.compatibilityChecker;
|
|
}
|
|
}
|