本文整理汇总了Java中de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization.reportError方法的典型用法代码示例。如果您正苦于以下问题:Java Parameterization.reportError方法的具体用法?Java Parameterization.reportError怎么用?Java Parameterization.reportError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization
的用法示例。
在下文中一共展示了Parameterization.reportError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入方法依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
IntParameter dimlatP = new IntParameter(LATDIM_ID) //
.addConstraint(CommonConstraints.GREATER_EQUAL_ZERO_INT);
if(config.grab(dimlatP)) {
dimlat = dimlatP.getValue();
}
IntParameter dimlngP = new IntParameter(LNGDIM_ID) //
.addConstraint(CommonConstraints.GREATER_EQUAL_ZERO_INT);
if(config.grab(dimlngP)) {
dimlng = dimlngP.getValue();
}
// Non-formalized parameter constraint:
if(dimlat == dimlng) {
config.reportError(new WrongParameterValueException("Parameters " + dimlatP.getName() + " and " + dimlngP.getName() + " should be different columns."));
}
ObjectParameter<EarthModel> modelP = new ObjectParameter<>(EarthModel.MODEL_ID, EarthModel.class, SphericalVincentyEarthModel.class);
if(config.grab(modelP)) {
model = modelP.instantiateClass(config);
}
}
示例2: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入方法依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
DoubleListParameter minimaP = new DoubleListParameter(MINIMA_ID) //
.setOptional(true);
if(config.grab(minimaP)) {
minima = minimaP.getValue().clone();
}
DoubleListParameter maximaP = new DoubleListParameter(MAXIMA_ID) //
.setOptional(!minimaP.isDefined());
if(config.grab(maximaP)) {
maxima = maximaP.getValue().clone();
}
// Non-formalized parameter constraint:
if(minima != null && maxima != null && minima.length != maxima.length) {
config.reportError(new WrongParameterValueException("Parameters " + minimaP.getName() + " and " + maximaP.getName() + " must have the same number of values."));
}
}
示例3: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入方法依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
DoubleListParameter meanP = new DoubleListParameter(MEAN_ID) //
.setOptional(true);
if(config.grab(meanP)) {
mean = meanP.getValue().clone();
}
DoubleListParameter stddevP = new DoubleListParameter(STDDEV_ID) //
.setOptional(!meanP.isDefined());
if(config.grab(stddevP)) {
stddev = stddevP.getValue().clone();
for(double d : stddev) {
if(d == 0.) {
config.reportError(new WrongParameterValueException("Standard deviations must not be 0."));
}
}
}
// Non-formalized parameter constraint:
if(mean != null && stddev != null && mean.length != stddev.length) {
config.reportError(new WrongParameterValueException("Parameters " + meanP.getName() + " and " + stddevP.getName() + " must have the same number of values."));
}
}
示例4: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入方法依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
DoubleParameter minP = new DoubleParameter(MIN_ID, 0.);
if(config.grab(minP)) {
min = minP.doubleValue();
}
DoubleParameter maxP = new DoubleParameter(MAX_ID, 1.);
if(config.grab(maxP)) {
max = maxP.doubleValue();
}
// Non-formalized parameter constraint: min < max
if(min >= max) {
config.reportError(new WrongParameterValueException("Parameter " + minP.getName() + " must be less than " + maxP.getName()));
}
}
示例5: instantiateClasses
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入方法依赖的package包/类
@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);
}
示例6: instantiateClasses
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入方法依赖的package包/类
/**
* Returns a list of new instances for the value (i.e., the class name) of
* this class list parameter. The instances have the type of the restriction
* class of this class list parameter.
* <p/>
* If the Class for the class names is not found, the instantiation is tried
* using the package of the restriction class as package of the class name.
*
* @param config Parameterization to use (if Parameterizable))
* @return a list of new instances for the value of this class list parameter
*/
public List<C> instantiateClasses(Parameterization config) {
config = config.descend(this);
List<C> instances = new ArrayList<>();
if(getValue() == null) {
config.reportError(new UnspecifiedParameterException(this));
return instances; // empty list.
}
for(Class<? extends C> cls : getValue()) {
// NOTE: There is a duplication of this code in ObjectListParameter - keep
// in sync!
try {
instances.add(ClassGenericsUtil.tryInstantiate(restrictionClass, cls, config));
}
catch(Exception e) {
config.reportError(new WrongParameterValueException(this, cls.getName(), e.getMessage(), e));
}
}
return instances;
}
示例7: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入方法依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
DoubleParameter t1P = new DoubleParameter(T1_ID);
if(config.grab(t1P)) {
t1 = t1P.doubleValue();
}
DoubleParameter t2P = new DoubleParameter(T2_ID);
if(config.grab(t2P)) {
t2 = t2P.doubleValue();
}
// Non-formalized parameter constraint: t1 >= t2
if(t1 < t2) {
config.reportError(new WrongParameterValueException("Parameter " + t1P.getName() + " should be at least " + t2P.getName()));
}
}
示例8: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入方法依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
IntParameter samplingP = new IntParameter(SAMPLING_ID, DEFAULT_SAMPLE_SIZE) //
.addConstraint(CommonConstraints.GREATER_EQUAL_MINUSONE_INT);
if(config.grab(samplingP)) {
samplesize = samplingP.intValue();
}
StringParameter stylelibP = new StringParameter(STYLELIB_ID, PropertiesBasedStyleLibrary.DEFAULT_SCHEME_FILENAME);
if(config.grab(stylelibP)) {
String filename = stylelibP.getValue();
try {
stylelib = new PropertiesBasedStyleLibrary(filename, filename);
}
catch(AbortException e) {
config.reportError(new WrongParameterValueException(stylelibP, filename, e.getMessage(), e));
}
}
PatternParameter enablevisP = new PatternParameter(ENABLEVIS_ID) //
.setOptional(true);
if(config.grab(enablevisP) && !"all".equals(enablevisP.getValueAsString())) {
enableVisualizers = enablevisP.getValue();
}
MergedParameterization merged = new MergedParameterization(config);
factories = collectFactorys(merged, enableVisualizers);
}
示例9: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入方法依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
final FileParameter param = new FileParameter(MATRIX_ID, FileParameter.FileType.INPUT_FILE);
if(config.grab(param)) {
File matrixfile = param.getValue();
try {
cache = new OnDiskUpperTriangleMatrix(matrixfile, FLOAT_CACHE_MAGIC, 0, ByteArrayUtil.SIZE_FLOAT, false);
}
catch(IOException e) {
config.reportError(new WrongParameterValueException(param, matrixfile.toString(), e.getMessage(), e));
}
}
}
示例10: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入方法依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
final FileParameter param = new FileParameter(MATRIX_ID, FileParameter.FileType.INPUT_FILE);
if(config.grab(param)) {
File matrixfile = param.getValue();
try {
cache = new OnDiskUpperTriangleMatrix(matrixfile, DOUBLE_CACHE_MAGIC, 0, ByteArrayUtil.SIZE_DOUBLE, false);
}
catch(IOException e) {
config.reportError(new WrongParameterValueException(param, matrixfile.toString(), e.getMessage(), e));
}
}
}
示例11: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入方法依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
EnumParameter<ScalingReference> scalingReferenceP = new EnumParameter<>(SCALINGREFERENCE_ID, ScalingReference.class, ScalingReference.UNITCUBE);
if(config.grab(scalingReferenceP)) {
scalingreference = scalingReferenceP.getValue();
}
EnumParameter<NoiseDistribution> noisedistributionP = new EnumParameter<>(NOISEDISTRIBUTION_ID, NoiseDistribution.class, NoiseDistribution.UNIFORM);
if(config.grab(noisedistributionP)) {
noisedistribution = noisedistributionP.getValue();
}
DoubleParameter percentageP = new DoubleParameter(PERCENTAGE_ID, .01) //
.addConstraint(CommonConstraints.GREATER_THAN_ZERO_DOUBLE) //
.addConstraint(CommonConstraints.LESS_EQUAL_ONE_DOUBLE);
if(config.grab(percentageP)) {
percentage = percentageP.getValue();
}
LongParameter seedP = new LongParameter(SEED_ID) //
.setOptional(true);
if(config.grab(seedP)) {
seed = seedP.getValue();
}
DoubleListParameter minimaP = new DoubleListParameter(MINIMA_ID) //
.setOptional(true);
if(config.grab(minimaP)) {
minima = minimaP.getValue().clone();
}
DoubleListParameter maximaP = new DoubleListParameter(MAXIMA_ID) //
.setOptional(!minimaP.isDefined());
if(config.grab(maximaP)) {
maxima = maximaP.getValue().clone();
}
// Non-formalized parameter constraint:
if(minima != null && maxima != null && minima.length != maxima.length) {
config.reportError(new WrongParameterValueException("Parameters " + minimaP.getName() + " and " + maximaP.getName() + " must have the same number of values."));
}
}
示例12: instantiateClass
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入方法依赖的package包/类
/**
* Returns a new instance for the value (i.e., the class name) of this class
* parameter. The instance has the type of the restriction class of this class
* parameter.
* <p/>
* If the Class for the class name is not found, the instantiation is tried
* using the package of the restriction class as package of the class name.
*
* @param config Parameterization to use (if Parameterizable))
* @return a new instance for the value of this class parameter
*/
public C instantiateClass(Parameterization config) {
if(getValue() == null /* && !optionalParameter */) {
config.reportError(new UnspecifiedParameterException(this));
return null;
}
try {
config = config.descend(this);
return ClassGenericsUtil.tryInstantiate(restrictionClass, getValue(), config);
}
catch(ClassInstantiationException e) {
config.reportError(new WrongParameterValueException(this, getValue().getCanonicalName(), "Error instantiating class.", e));
return null;
}
}
示例13: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入方法依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
// Neighborhood predicate
ObjectParameter<NeighborPredicate<?>> npredOpt = new ObjectParameter<>(NEIGHBORHOODPRED_ID, NeighborPredicate.class, EpsilonNeighborPredicate.class);
if(config.grab(npredOpt)) {
npred = npredOpt.instantiateClass(config);
}
// Core point predicate
ObjectParameter<CorePredicate<?>> corepredOpt = new ObjectParameter<>(COREPRED_ID, CorePredicate.class, MinPtsCorePredicate.class);
if(config.grab(corepredOpt)) {
corepred = corepredOpt.instantiateClass(config);
}
if(npred != null && corepred != null) {
// Ignore the generic, we do a run-time test below:
@SuppressWarnings("unchecked")
CorePredicate<Object> cp = (CorePredicate<Object>) corepred;
if(!cp.acceptsType(npred.getOutputType())) {
config.reportError(new WrongParameterValueException(corepredOpt, corepredOpt.getValueAsString(), "Neighbor predicate and core predicate are not compatible."));
}
}
Flag coremodelOpt = new Flag(COREMODEL_ID);
if(config.grab(coremodelOpt)) {
coremodel = coremodelOpt.isTrue();
}
}
示例14: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入方法依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
// Neighborhood predicate
ObjectParameter<NeighborPredicate<?>> npredOpt = new ObjectParameter<>(NEIGHBORHOODPRED_ID, NeighborPredicate.class, EpsilonNeighborPredicate.class);
if(config.grab(npredOpt)) {
npred = npredOpt.instantiateClass(config);
}
// Core point predicate
ObjectParameter<CorePredicate<?>> corepredOpt = new ObjectParameter<>(COREPRED_ID, CorePredicate.class, MinPtsCorePredicate.class);
if(config.grab(corepredOpt)) {
corepred = corepredOpt.instantiateClass(config);
}
if(npred != null && corepred != null) {
// Ignore the generic, we do a run-time test below:
@SuppressWarnings("unchecked")
CorePredicate<Object> cp = (CorePredicate<Object>) corepred;
if(!cp.acceptsType(npred.getOutputType())) {
config.reportError(new WrongParameterValueException(corepredOpt, corepredOpt.getValueAsString(), "Neighbor predicate and core predicate are not compatible."));
}
}
Flag coremodelOpt = new Flag(COREMODEL_ID);
if(config.grab(coremodelOpt)) {
coremodel = coremodelOpt.isTrue();
}
}
示例15: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入方法依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
ObjectParameter<ClusteringAlgorithm<C>> palgorithm = new ObjectParameter<>(AbstractAlgorithm.ALGORITHM_ID, ClusteringAlgorithm.class);
if(config.grab(palgorithm)) {
inner = palgorithm.instantiateClass(config);
if(inner != null && inner.getInputTypeRestriction().length > 0 && //
!inner.getInputTypeRestriction()[0].isAssignableFromType(TypeUtil.NUMBER_VECTOR_FIELD)) {
config.reportError(new WrongParameterValueException(palgorithm, palgorithm.getValueAsString(), "The inner clustering algorithm (as configured) does not accept numerical vectors: " + inner.getInputTypeRestriction()[0]));
}
}
}