use of de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization in project elki by elki-project.
the class ObjectListParameter method instantiateClasses.
@Override
public List<C> instantiateClasses(Parameterization config) {
if (instances == null) {
// instantiateClasses will descend itself.
instances = super.instantiateClasses(config);
} else {
Parameterization cfg = null;
for (int i = 0; i < instances.size(); i++) {
if (instances.get(i) == null) {
Class<? extends C> cls = getValue().get(i);
try {
// Descend at most once, and only when needed
cfg = (cfg == null) ? config.descend(this) : null;
C instance = ClassGenericsUtil.tryInstantiate(restrictionClass, cls, cfg);
instances.set(i, instance);
} catch (Exception e) {
config.reportError(new WrongParameterValueException(this, cls.getName(), e.getMessage(), e));
}
}
}
}
return new ArrayList<>(instances);
}
Aggregations