当前位置: 首页>>代码示例>>Java>>正文


Java OptionID类代码示例

本文整理汇总了Java中de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID的典型用法代码示例。如果您正苦于以下问题:Java OptionID类的具体用法?Java OptionID怎么用?Java OptionID使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OptionID类属于de.lmu.ifi.dbs.elki.utilities.optionhandling包,在下文中一共展示了OptionID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ListParameterization

import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; //导入依赖的package包/类
/**
 * Constructor with an existing collection.
 *
 * @param dbParameters existing parameter collection
 */
public ListParameterization(Collection<ParameterPair> dbParameters) {
  this();
  this.parameters = new LinkedList<>();
  for(ParameterPair pair : dbParameters) {
    if(pair.option instanceof OptionID) {
      addParameter((OptionID) pair.option, pair.value);
    }
    else if(pair.option instanceof String) {
      addParameter((String) pair.option, pair.value);
    }
    else {
      throw new IllegalStateException("The option field must only store OptionID or Strings.");
    }
  }
}
 
开发者ID:elki-project,项目名称:elki,代码行数:21,代码来源:ListParameterization.java

示例2: ClassParameter

import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; //导入依赖的package包/类
/**
 * Constructs a class parameter with the given optionID, restriction class,
 * and default value.
 *
 * @param optionID the unique id of the option
 * @param restrictionClass the restriction class of this class parameter
 * @param defaultValue the default value of this class parameter
 */
@SuppressWarnings("unchecked")
public ClassParameter(OptionID optionID, Class<?> restrictionClass, Class<?> defaultValue) {
  super(optionID, (Class<? extends C>) defaultValue);
  // It would be nice to be able to use Class<C> here, but this won't work
  // with nested Generics:
  // * ClassParameter<Foo<Bar>>(optionID, Foo.class) doesn't satisfy Class<C>
  // * ClassParameter<Foo<Bar>>(optionID, Foo<Bar>.class) isn't valid
  // * ClassParameter<Foo<Bar>>(optionID, (Class<Foo<Bar>>) Foo.class) is an
  // invalid cast.
  this.restrictionClass = (Class<C>) restrictionClass;
  if(restrictionClass == null) {
    LOG.warning("Restriction class 'null' for parameter '" + optionID + "'", new Throwable());
  }
}
 
开发者ID:elki-project,项目名称:elki,代码行数:23,代码来源:ClassParameter.java

示例3: ObjectParameter

import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; //导入依赖的package包/类
/**
 * Constructs a class parameter with the given optionID, and restriction
 * class.
 * 
 * @param optionID the unique id of the option
 * @param restrictionClass the restriction class of this class parameter
 */
public ObjectParameter(OptionID optionID, Class<?> restrictionClass) {
  // It would be nice to be able to use Class<C> here, but this won't work
  // with nested Generics:
  // * ClassParameter<Foo<Bar>>(optionID, Foo.class) doesn't satisfy Class<C>
  // * ClassParameter<Foo<Bar>>(optionID, Foo<Bar>.class) isn't valid
  // * ClassParameter<Foo<Bar>>(optionID, (Class<Foo<Bar>>) Foo.class) is an
  // invalid cast.
  super(optionID, restrictionClass);
}
 
开发者ID:elki-project,项目名称:elki,代码行数:17,代码来源:ObjectParameter.java

示例4: makeOptions

import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; //导入依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
	super.makeOptions(config);
	ObjectParameter<DimensionSelectingSubspaceDistanceFunction<V, DoubleDistance>> param = 
			new ObjectParameter<>(new OptionID("geosubclu.distancefunction", "Distance function to determine the distance between database objects."),
					DimensionSelectingSubspaceDistanceFunction.class, 
					SubspaceEuclideanDistanceFunction.class);
			if (config.grab(param)) {
				distance = param.instantiateClass(config);
			}
}
 
开发者ID:giusepperizzo,项目名称:geosummly,代码行数:12,代码来源:GEOSUBCLU.java

示例5: makeByOptOverviewWiki

import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; //导入依赖的package包/类
private static void makeByOptOverviewWiki(Map<OptionID, List<Pair<Parameter<?>, Class<?>>>> byopt, WikiStream out) {
  List<OptionID> opts = new ArrayList<>(byopt.keySet());
  Collections.sort(opts, new SortByOption());

  for(OptionID oid : opts) {
    final Parameter<?> firstopt = byopt.get(oid).get(0).getFirst();
    out.indent = 1;
    out.printitem("").print("{{{").print(SerializedParameterization.OPTION_PREFIX) //
        .print(firstopt.getName()).print(' ').print(firstopt.getSyntax()).println("}}}:: ");
    out.newline = 1; // No BR needed, we increase the indent.
    out.indent = 2;

    appendMultilineTextWiki(out, firstopt.getShortDescription());
    // class restriction?
    Class<?> superclass = getRestrictionClass(oid, firstopt, byopt);
    if(superclass != null) {
      appendClassRestrictionWiki(out, superclass);
    }
    // default value?
    if(firstopt.hasDefaultValue()) {
      appendDefaultValueWiki(out, firstopt);
    }
    if(FULL_WIKI_OUTPUT) {
      // known values?
      if(superclass != null) {
        appendKnownImplementationsWiki(out, superclass);
      }
      // List of classes that use this parameter
      out.println("Used by:");
      for(Pair<Parameter<?>, Class<?>> clinst : byopt.get(oid)) {
        out.indent = 3;
        out.printitem("* ").javadocLink(clinst.getSecond(), null).println();
        if(clinst.getFirst() instanceof ClassParameter<?> && firstopt instanceof ClassParameter<?>) {
          ClassParameter<?> cls = (ClassParameter<?>) clinst.getFirst();
          if(cls.getRestrictionClass() != null) {
            // TODO: if it is null, it could still be different!
            if(!cls.getRestrictionClass().equals(superclass)) {
              appendClassRestrictionWiki(out, cls.getRestrictionClass());
            }
          }
          else {
            appendNoClassRestrictionWiki(out);
          }
        }
        Parameter<?> param = clinst.getFirst();
        if(param.getDefaultValue() != null) {
          if(!param.getDefaultValue().equals(firstopt.getDefaultValue())) {
            appendDefaultValueWiki(out, param);
          }
        }
        else if(firstopt.getDefaultValue() != null) {
          appendNoDefaultValueWiki(out);
        }
        out.println();
      }
    }
  }
}
 
开发者ID:elki-project,项目名称:elki,代码行数:59,代码来源:DocumentParameters.java

示例6: compare

import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; //导入依赖的package包/类
@Override
public int compare(OptionID o1, OptionID o2) {
  return o1.getName().compareToIgnoreCase(o2.getName());
}
 
开发者ID:elki-project,项目名称:elki,代码行数:5,代码来源:DocumentParameters.java

示例7: getOptionID

import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; //导入依赖的package包/类
@Override
public OptionID getOptionID() {
  return optionid;
}
 
开发者ID:elki-project,项目名称:elki,代码行数:5,代码来源:AbstractParameter.java

示例8: getTitle

import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; //导入依赖的package包/类
/**
 * Try to automatically generate a title for this.
 *
 * @param db Database
 * @param result Result object
 * @return generated title
 */
public static String getTitle(Database db, Result result) {
  List<TrackedParameter> settings = new ArrayList<>();
  for(SettingsResult sr : SettingsResult.getSettingsResults(result)) {
    settings.addAll(sr.getSettings());
  }
  String algorithm = null;
  String distance = null;
  String dataset = null;

  for(TrackedParameter setting : settings) {
    Parameter<?> param = setting.getParameter();
    OptionID option = param.getOptionID();
    String value = param.isDefined() ? param.getValueAsString() : null;
    if(option.equals(AlgorithmStep.Parameterizer.ALGORITHM_ID)) {
      algorithm = value;
    }
    if(option.equals(DistanceBasedAlgorithm.DISTANCE_FUNCTION_ID)) {
      distance = value;
    }
    if(option.equals(FileBasedDatabaseConnection.Parameterizer.INPUT_ID)) {
      dataset = value;
    }
  }
  StringBuilder buf = new StringBuilder();
  if(algorithm != null) {
    buf.append(shortenClassname(algorithm.split(",")[0], '.'));
  }
  if(distance != null) {
    if(buf.length() > 0) {
      buf.append(" using ");
    }
    buf.append(shortenClassname(distance, '.'));
  }
  if(dataset != null) {
    if(buf.length() > 0) {
      buf.append(" on ");
    }
    buf.append(shortenClassname(dataset, File.separatorChar));
  }
  if(buf.length() > 0) {
    return buf.toString();
  }
  return null;
}
 
开发者ID:elki-project,项目名称:elki,代码行数:52,代码来源:VisualizerParameterizer.java

示例9: AbstractParameter

import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; //导入依赖的package包/类
/**
 * Constructs a parameter with the given optionID, constraints, and default
 * value.
 * 
 * @param optionID the unique id of this parameter
 * @param defaultValue the default value of this parameter (may be null)
 */
public AbstractParameter(OptionID optionID, T defaultValue) {
  this.optionid = optionID;
  this.shortDescription = optionID.getDescription();
  this.optionalParameter = true;
  this.defaultValue = defaultValue;
}
 
开发者ID:elki-project,项目名称:elki,代码行数:14,代码来源:AbstractParameter.java

示例10: with

import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; //导入依赖的package包/类
/**
 * Add an option to the builder.
 *
 * @param opt Option ID (usually found in the Parameterizer class)
 * @param value Value
 * @return The same builder
 */
public ELKIBuilder<T> with(OptionID opt, Object value) {
  p.addParameter(opt, value);
  return this;
}
 
开发者ID:elki-project,项目名称:elki,代码行数:12,代码来源:ELKIBuilder.java

示例11: LongParameter

import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; //导入依赖的package包/类
/**
 * Constructs a long parameter with the given optionID and default value.
 * 
 * @param optionID the unique OptionID for this parameter
 * @param defaultValue the default value
 */
public LongParameter(OptionID optionID, long defaultValue) {
  super(optionID, Long.valueOf(defaultValue));
}
 
开发者ID:elki-project,项目名称:elki,代码行数:10,代码来源:LongParameter.java

示例12: FileParameter

import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; //导入依赖的package包/类
/**
 * Constructs a file parameter with the given optionID, and file type.
 * 
 * @param optionID optionID the unique id of the option
 * @param fileType the file type of this file parameter
 */
public FileParameter(OptionID optionID, FileType fileType) {
  super(optionID);
  this.fileType = fileType;
}
 
开发者ID:elki-project,项目名称:elki,代码行数:11,代码来源:FileParameter.java

示例13: Flag

import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; //导入依赖的package包/类
/**
 * Constructs a flag object with the given optionID.
 * <p/>
 * If the flag is not set its value is &quot;false&quot;.
 * 
 * @param optionID the unique id of the option
 */
public Flag(OptionID optionID) {
  super(optionID);
  setOptional(true);
  setDefaultValue(Boolean.FALSE);
}
 
开发者ID:elki-project,项目名称:elki,代码行数:13,代码来源:Flag.java

示例14: ListParameter

import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; //导入依赖的package包/类
/**
 * Constructs a list parameter with the given optionID.
 * 
 * @param optionID the unique id of this parameter
 * @param defaultValue the default value of this parameter (may be null)
 */
public ListParameter(OptionID optionID, T defaultValue) {
  super(optionID, defaultValue);
}
 
开发者ID:elki-project,项目名称:elki,代码行数:10,代码来源:ListParameter.java

示例15: EnumParameter

import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; //导入依赖的package包/类
/**
 * Constructs an enum parameter with the given optionID, constraints and
 * default value.
 * 
 * @param optionID the unique id of the parameter
 * @param defaultValue the default value of the parameter
 */
public EnumParameter(OptionID optionID, Class<E> enumClass, E defaultValue) {
  super(optionID, defaultValue);
  this.enumClass = enumClass;
}
 
开发者ID:elki-project,项目名称:elki,代码行数:12,代码来源:EnumParameter.java


注:本文中的de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。