Search in sources :

Example 1 with ConstantDomain

use of org.btrplace.safeplace.testing.fuzzer.domain.ConstantDomain in project scheduler by btrplace.

the class DefaultFuzzer method domain.

private Domain<?> domain(UserVar<?> v, Model mo) {
    Domain<?> d = doms.get(v.label());
    if (d != null) {
        return d;
    }
    // Default domains
    if (!(v.getBackend().type() instanceof SetType)) {
        return null;
    }
    SetType back = (SetType) v.getBackend().type();
    if (back.enclosingType().equals(NodeType.getInstance())) {
        return new ConstantDomain<>(rnd, "nodes", NodeType.getInstance(), new ArrayList<>(mo.getMapping().getAllNodes()));
    } else if (back.enclosingType().equals(VMType.getInstance())) {
        return new ConstantDomain<>(rnd, "vms", VMType.getInstance(), new ArrayList<>(mo.getMapping().getAllVMs()));
    }
    throw new IllegalArgumentException("No domain value attached to argument '" + v.label() + "'");
}
Also used : SetType(org.btrplace.safeplace.spec.type.SetType) ConstantDomain(org.btrplace.safeplace.testing.fuzzer.domain.ConstantDomain) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 SetType (org.btrplace.safeplace.spec.type.SetType)1 ConstantDomain (org.btrplace.safeplace.testing.fuzzer.domain.ConstantDomain)1