de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Flag.getName()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(189)

本文整理了Java中de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Flag.getName()方法的一些代码示例,展示了Flag.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flag.getName()方法的具体详情如下:
包路径:de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Flag
类名称:Flag
方法名:getName

Flag.getName介绍

暂无

代码示例

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki

@Override
protected boolean validate(Boolean obj) throws ParameterException {
 if(obj == null) {
  throw new WrongParameterValueException("Boolean option '" + getName() + "' got 'null' value.");
 }
 return true;
}

代码示例来源:origin: stackoverflow.com

onCreate() {
  ...
  btnHint.setOnClickListener(hintOnClickListener);
  ...
  Flag f = db.getFlag(randomNum); // This is the real question & answer
  List<String> wrongAnswers = new ArrayList<String>(3);
  List<String> allAnswers = new ArrayList<String>(4);

  // Loop 3 times for 3 random wrong answers
  for (int i=0; i<=3; i++) {
    randNum = r.nextInt(200);
    String randWrongAnswer = db.getFlag(randNum).getName().toString();
    if (! wrongAnswers.contains(randWrongAnswer)) {
      wrongAnswers.add(randWrongAnswer);
    }
  }

  allAnswers.add(f.getName().toString());
  allAnswers.addAll(wrongAnswers);
  Collection.shuffle(allAnswers);
  ...
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki

@Override
protected Boolean parseValue(Object obj) throws ParameterException {
 if(SET.equals(obj)) {
  return Boolean.TRUE;
 }
 if(NOT_SET.equals(obj)) {
  return Boolean.FALSE;
 }
 if(obj instanceof Boolean) {
  return (Boolean) obj;
 }
 if(obj != null && SET.equals(obj.toString())) {
  return Boolean.TRUE;
 }
 if(obj != null && NOT_SET.equals(obj.toString())) {
  return Boolean.FALSE;
 }
 throw new WrongParameterValueException("Wrong value for flag \"" + getName() + "\". Allowed values:\n" + SET + " or " + NOT_SET);
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki

@Override
 public String getDescription() {
  StringBuilder description = new StringBuilder();
  if(flagConstraint) {
   description.append("If ").append(flag.getName());
   description.append(" is set, the following constraints for parameter ");
   description.append(param.getName()).append(" have to be fullfilled: ");
   if(cons != null) {
    for(int i = 0; i < cons.size(); i++) {
     ParameterConstraint<? super S> c = cons.get(i);
     if(i > 0) {
      description.append(", ");
     }
     description.append(c.getDescription(param.getName()));
    }
   }
   else {
    description.append(param.getName()).append(" must be set.");
   }
  }
  return description.toString();
 }
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki

public FlagParameterConfigurator(Flag param, JComponent parent) {
 super(param, parent);
 // Input field
 GridBagConstraints constraints = new GridBagConstraints();
 constraints.gridwidth = 2;
 constraints.fill = GridBagConstraints.HORIZONTAL;
 constraints.weightx = 1.0;
 value = new JCheckBox(param.getName());
 if(param.isDefined() && !param.tookDefaultValue()) {
  value.setSelected(param.isTrue());
 }
 value.setToolTipText(param.getShortDescription());
 parent.add(value, constraints);
 finishGridRow();
 
 value.addActionListener(this);
}

代码示例来源:origin: stackoverflow.com

tvCountryName.setText(flagEntity.getName());

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki

@Override
protected void makeOptions(Parameterization config) {
 super.makeOptions(config);
 Flag absoluteF = new Flag(EIGENPAIR_FILTER_ABSOLUTE);
 if(config.grab(absoluteF)) {
  absolute = absoluteF.isTrue();
 }
 DoubleParameter deltaP = new DoubleParameter(EIGENPAIR_FILTER_DELTA, DEFAULT_DELTA);
 deltaP.addConstraint(CommonConstraints.GREATER_EQUAL_ZERO_DOUBLE);
 if(config.grab(deltaP)) {
  delta = deltaP.doubleValue();
  // TODO: make this a global constraint?
  if(absolute && deltaP.tookDefaultValue()) {
   config.reportError(new WrongParameterValueException("Illegal parameter setting: " + "Flag " + absoluteF.getName() + " is set, " + "but no value for " + deltaP.getName() + " is specified."));
  }
 }
 // Conditional Constraint:
 // delta must be >= 0 and <= 1 if it's a relative value
 // Since relative or absolute is dependent on the absolute flag this is a
 // global constraint!
 List<ParameterConstraint<? super Double>> cons = new ArrayList<>();
 // TODO: Keep the constraint here - applies to non-conditional case as
 // well, and is set above.
 cons.add(CommonConstraints.GREATER_EQUAL_ZERO_DOUBLE);
 cons.add(CommonConstraints.LESS_EQUAL_ONE_DOUBLE);
 GlobalParameterConstraint gpc = new ParameterFlagGlobalConstraint<>(deltaP, cons, absoluteF, false);
 config.checkConstraint(gpc);
}

相关文章