de.lmu.ifi.dbs.elki.utilities.optionhandling
Class OptionUtil

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionUtil

public final class OptionUtil
extends Object

Utility functions related to Option handling.


Constructor Summary
OptionUtil()
           
 
Method Summary
static StringBuffer describeParameterizable(StringBuffer buf, Class<?> pcls, int width, String indent)
          Format a description of a Parameterizable (including recursive options).
static void formatForConsole(StringBuffer buf, int width, String indent, Collection<Pair<Object,Parameter<?,?>>> options)
          Format a list of options (and associated owning objects) for console help output.
static
<O extends Parameter<?,?>>
String
optionsNamesToString(List<O> options)
          Returns a string representation of the specified list of options containing the names of the options.
static
<O extends Parameter<?,?>>
String
optionsNamesToString(O[] options)
          Returns a string representation of the specified list of options containing the names of the options.
static
<N extends Parameter<?,?>>
String
parameterNamesAndValuesToString(List<N> parameters)
          Returns a string representation of the list of number parameters containing the names and the values of the parameters.
static void println(StringBuffer buf, int width, String data, String indent)
          Simple writing helper with no indentation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptionUtil

public OptionUtil()
Method Detail

optionsNamesToString

public static <O extends Parameter<?,?>> String optionsNamesToString(List<O> options)
Returns a string representation of the specified list of options containing the names of the options.

Type Parameters:
O - Option type
Parameters:
options - the list of options
Returns:
the names of the options

optionsNamesToString

public static <O extends Parameter<?,?>> String optionsNamesToString(O[] options)
Returns a string representation of the specified list of options containing the names of the options.

Type Parameters:
O - Option type
Parameters:
options - the list of options
Returns:
the names of the options

parameterNamesAndValuesToString

public static <N extends Parameter<?,?>> String parameterNamesAndValuesToString(List<N> parameters)
Returns a string representation of the list of number parameters containing the names and the values of the parameters.

Type Parameters:
N - Parameter type
Parameters:
parameters - the list of number parameters
Returns:
the names and the values of the parameters

formatForConsole

public static void formatForConsole(StringBuffer buf,
                                    int width,
                                    String indent,
                                    Collection<Pair<Object,Parameter<?,?>>> options)
Format a list of options (and associated owning objects) for console help output.

Parameters:
buf - Serialization buffer
width - Screen width
indent - Indentation string
options - List of options

println

public static void println(StringBuffer buf,
                           int width,
                           String data,
                           String indent)
Simple writing helper with no indentation.

Parameters:
buf - Buffer to write to
width - Width to use for linewraps
data - Data to write.
indent - Indentation

describeParameterizable

public static StringBuffer describeParameterizable(StringBuffer buf,
                                                   Class<?> pcls,
                                                   int width,
                                                   String indent)
Format a description of a Parameterizable (including recursive options).

Parameters:
buf - Buffer to append to.
pcls - Parameterizable class to describe
width - Width
indent - Text indent
Returns:
Formatted description

Release 0.4.0 (2011-09-20_1324)