use of de.lmu.ifi.dbs.elki.utilities.optionhandling.constraints.ParameterConstraint in project elki by elki-project.
the class OptionUtil method getFullDescription.
/**
* Format a parameter description.
*
* @param param
* @return Parameter description
*/
public static <T> String getFullDescription(Parameter<T> param) {
StringBuilder description = new StringBuilder(1000);
// description.append(getParameterType()).append(" ");
description.append(param.getShortDescription()).append(FormatUtil.NEWLINE);
param.describeValues(description);
if (!FormatUtil.endsWith(description, FormatUtil.NEWLINE)) {
description.append(FormatUtil.NEWLINE);
}
if (param.hasDefaultValue()) {
description.append("Default: ").append(param.getDefaultValueAsString()).append(FormatUtil.NEWLINE);
}
List<ParameterConstraint<? super T>> constraints = param.getConstraints();
if (constraints != null && !constraints.isEmpty()) {
description.append((constraints.size() == 1) ? "Constraint: " : "Constraints: ");
for (int i = 0; i < constraints.size(); i++) {
description.append(i > 0 ? ", " : "").append(constraints.get(i).getDescription(param.getOptionID().getName()));
}
description.append('.').append(FormatUtil.NEWLINE);
}
return description.toString();
}
Aggregations