![JAR search and dependency download from the Maven repository](/logo.png)
com.github.dakusui.jcunit8.factorspace.FactorSpace Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jcunit Show documentation
Show all versions of jcunit Show documentation
Automated combinatorial testing framework on top of JUnit
The newest version!
package com.github.dakusui.jcunit8.factorspace;
import com.github.dakusui.jcunit.core.tuples.Tuple;
import com.github.dakusui.jcunit8.core.StreamableTupleCartesianator;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
import static java.lang.String.format;
public interface FactorSpace {
static FactorSpace create(List extends Factor> factors, List constraints) {
List work = new ArrayList<>(constraints);
return new FactorSpace() {
Map factorMap = new LinkedHashMap() {{
factors.forEach(each -> put(each.getName(), each));
}};
@SuppressWarnings("unchecked")
@Override
public List getFactors() {
return (List) factors;
}
@Override
public Factor getFactor(String name) {
return factorMap.get(name);
}
@Override
public List getConstraints() {
return work;
}
@Override
public String toString() {
return format("factors:%s,constraints:%s", factors, constraints);
}
};
}
List getConstraints();
List getFactors();
Factor getFactor(String name);
default Stream stream() {
return new StreamableTupleCartesianator(getFactors()).stream();
}
default List getFactorNames() {
return FactorUtils.toFactorNames(this.getFactors());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy