de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Flag类的使用及代码示例

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

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

Flag介绍

[英]Option class specifying a flag object.

A flag object is optional parameter which can be set (value "true") or not (value "false").
[中]指定标志对象的选项类。
标志对象是可选参数,可以设置(值“true”)或不设置(值“false”)。

代码示例

代码示例来源:origin: elki-project/elki

/**
 * Get the variance statistics parameter.
 * 
 * @param config Parameterization
 */
protected void getParameterVarstat(Parameterization config) {
 Flag varF = new Flag(VARSTAT_ID);
 varstat = config.grab(varF) && varF.isTrue();
}

代码示例来源:origin: elki-project/elki

@Override
protected void makeOptions(Parameterization config) {
 super.makeOptions(config);
 final Flag flag = new Flag(INVERT_ID);
 if(config.grab(flag)) {
  invert = flag.getValue();
 }
}

代码示例来源:origin: elki-project/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.getOptionID().getName());
 if(param.isDefined() && !param.tookDefaultValue()) {
  value.setSelected(param.isTrue());
 }
 value.setToolTipText(param.getShortDescription());
 parent.add(value, constraints);
 finishGridRow();
 
 value.addActionListener(this);
}

代码示例来源:origin: elki-project/elki

/**
 * Shorthand for {@code isDefined() && getValue() == true}
 * 
 * @return true when defined and true.
 */
public boolean isTrue() {
 return isDefined() && getValue().booleanValue();
}

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

/**
 * Convenience - add a Flag option directly.
 * 
 * @param flag Flag to add, if set
 */
public void forwardOption(Flag flag) {
 if(flag.isDefined() && flag.getValue().booleanValue()) {
  addFlag(flag.getOptionID());
 }
}

代码示例来源:origin: elki-project/elki

@Override
protected void makeOptions(Parameterization config) {
 super.makeOptions(config);
 DoubleParameter alphaP = new DoubleParameter(ClusterHullVisualization.Parameterizer.ALPHA_ID, Double.POSITIVE_INFINITY);
 if(config.grab(alphaP)) {
  alpha = alphaP.doubleValue();
 }
 Flag bendP = new Flag(STRAIGHT_ID);
 if(config.grab(bendP)) {
  bend = bendP.isFalse();
 }
}

代码示例来源:origin: elki-project/elki

Flag helpF = new Flag(Parameterizer.HELP_ID);
params.grab(helpF);
Flag helpLongF = new Flag(Parameterizer.HELP_LONG_ID);
params.grab(helpLongF);
try {
 Flag verboseF = new Flag(Parameterizer.VERBOSE_ID);
 if(config.grab(verboseF) && verboseF.isTrue()) {
  Flag verbose2F = new Flag(Parameterizer.VERBOSE_ID);
  LoggingConfiguration.setVerbose((config.grab(verbose2F) && verbose2F.isTrue()) ? Level.VERYVERBOSE : Level.VERBOSE);
 if((helpF.isDefined() && helpF.getValue()) || (helpLongF.isDefined() && helpLongF.getValue())) {
  LoggingConfiguration.setVerbose(Level.VERBOSE);
  LOG.verbose(usage(config.getAllParameters()));

代码示例来源:origin: elki-project/elki

@Override
protected void makeOptions(Parameterization config) {
 super.makeOptions(config);
 Flag fillF = new Flag(TreeMBRVisualization.Parameterizer.FILL_ID) //
   .setDefaultValue(Boolean.TRUE);
 if(config.grab(fillF)) {
  fill = fillF.isTrue();
 }
}

代码示例来源: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: elki-project/elki

@Override
public String getValueAsString() {
 return getValue().booleanValue() ? SET : NOT_SET;
}

代码示例来源:origin: elki-project/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 \"" + getOptionID().getName() + "\". Allowed values:\n" + SET + " or " + NOT_SET);
}

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

@Override
protected void makeOptions(Parameterization config) {
 super.makeOptions(config);
 DoubleParameter alphaP = new DoubleParameter(ClusterHullVisualization.Parameterizer.ALPHA_ID, Double.POSITIVE_INFINITY);
 if(config.grab(alphaP)) {
  alpha = alphaP.doubleValue();
 }
 Flag bendP = new Flag(STRAIGHT_ID);
 if(config.grab(bendP)) {
  bend = bendP.isFalse();
 }
}

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

Flag helpF = new Flag(Parameterizer.HELP_ID);
params.grab(helpF);
Flag helpLongF = new Flag(Parameterizer.HELP_LONG_ID);
params.grab(helpLongF);
try {
 Flag verboseF = new Flag(Parameterizer.VERBOSE_ID);
 if(config.grab(verboseF) && verboseF.isTrue()) {
  Flag verbose2F = new Flag(Parameterizer.VERBOSE_ID);
  LoggingConfiguration.setVerbose((config.grab(verbose2F) && verbose2F.isTrue()) ? Level.VERYVERBOSE : Level.VERBOSE);
 if((helpF.isDefined() && helpF.getValue()) || (helpLongF.isDefined() && helpLongF.getValue())) {
  LoggingConfiguration.setVerbose(Level.VERBOSE);
  LOG.verbose(usage(config.getAllParameters()));

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

@Override
protected void makeOptions(Parameterization config) {
 super.makeOptions(config);
 Flag fillF = new Flag(TreeMBRVisualization.Parameterizer.FILL_ID);
 fillF.setDefaultValue(Boolean.TRUE);
 if(config.grab(fillF)) {
  fill = fillF.isTrue();
 }
}

代码示例来源:origin: elki-project/elki

/**
  * Shorthand for {@code isDefined() && getValue() == false}
  * 
  * @return true when defined and true.
  */
 public boolean isFalse() {
  return isDefined() && !getValue().booleanValue();
 }
}

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

@Override
public String getValueAsString() {
 return getValue().booleanValue() ? SET : NOT_SET;
}

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

@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 \"" + getOptionID().getName() + "\". Allowed values:\n" + SET + " or " + NOT_SET);
}

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

/**
 * Get the variance statistics parameter.
 * 
 * @param config Parameterization
 */
protected void getParameterVarstat(Parameterization config) {
 Flag varF = new Flag(VARSTAT_ID);
 varstat = config.grab(varF) && varF.isTrue();
}

代码示例来源:origin: elki-project/elki

@Override
protected void makeOptions(Parameterization config) {
 super.makeOptions(config);
 Flag normalizeF = new Flag(NORMALIZE_ID);
 if(config.grab(normalizeF)) {
  normalize = normalizeF.getValue();
 }
}

代码示例来源:origin: elki-project/elki

@Override
protected void makeOptions(Parameterization config) {
 super.makeOptions(config);
 EnumParameter<NoiseHandling> noiseP = new EnumParameter<NoiseHandling>(NOISE_ID, NoiseHandling.class, NoiseHandling.TREAT_NOISE_AS_SINGLETONS);
 if(config.grab(noiseP)) {
  noiseOption = noiseP.getValue();
 }
 if(noiseOption == NoiseHandling.IGNORE_NOISE) {
  Flag penalizeP = new Flag(NO_PENALIZE_ID);
  if(config.grab(penalizeP)) {
   penalize = penalizeP.isFalse();
  }
 }
}

相关文章