weka.core

## Class Option

- java.lang.Object
- - weka.core.Option

- All Implemented Interfaces:
    RevisionHandler

      public class Option
      extends java.lang.Object
      implements RevisionHandler

  Class to store information about an option.

  Typical usage:

  `Option myOption = new Option("Uses extended mode.", "E", 0, "-E"));`

  Version:
    $Revision: 12505 $
  Author:
    Eibe Frank (eibe@cs.waikato.ac.nz)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Option(java.lang.String description, java.lang.String name, int numArguments, java.lang.String synopsis)` Creates new option with the given parameters.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `deleteFlagString(java.util.List<java.lang.String> list, java.lang.String name)` Removes an option from a given list of strings that specifies options.
    `static void` | `deleteOption(java.util.List<Option> list, java.lang.String name)` Removes an option from a given list of options.
    `static void` | `deleteOptionString(java.util.List<java.lang.String> list, java.lang.String name)` Removes an option from a given list of strings that specifies options.
    `java.lang.String` | `description()` Returns the option's description.
    `static java.lang.String[]` | `getOptions(java.lang.Object target, java.lang.Class<?> targetClazz)` Get the settings of the supplied object.
    `static java.lang.String[]` | `getOptionsForHierarchy(java.lang.Object target, java.lang.Class<?> oldestAncestorClazz)` Get the settings of the supplied object.
    `java.lang.String` | `getRevision()` Returns the revision string.
    `static java.util.Vector<Option>` | `listOptionsForClass(java.lang.Class<?> clazz)` Gets a list of options for the supplied class.
    `static java.util.Vector<Option>` | `listOptionsForClassHierarchy(java.lang.Class<?> childClazz, java.lang.Class<?> oldestAncestorClazz)` Get a list of options for a class.
    `java.lang.String` | `name()` Returns the option's name.
    `int` | `numArguments()` Returns the option's number of arguments.
    `static void` | `setOptions(java.lang.String[] options, java.lang.Object target, java.lang.Class<?> targetClazz)` Sets options on the target object.
    `static void` | `setOptionsForHierarchy(java.lang.String[] options, java.lang.Object target, java.lang.Class<?> oldestAncestorClazz)` Sets options on the target object.
    `java.lang.String` | `synopsis()` Returns the option's synopsis.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Option

          public Option(java.lang.String description,
                        java.lang.String name,
                        int numArguments,
                        java.lang.String synopsis)

      Creates new option with the given parameters.
      Parameters:
        `description` - the option's description
        `name` - the option's name
        `numArguments` - the number of arguments
        `synopsis` - the option's synopsis

  - ### Method Detail

    - #### listOptionsForClassHierarchy

          public static java.util.Vector<Option> listOptionsForClassHierarchy(java.lang.Class<?> childClazz,
                                                                              java.lang.Class<?> oldestAncestorClazz)

      Get a list of options for a class. Options identified by this method are bean properties (with get/set methods) annotated using the OptionMetadata annotation. All options from the class up to, but not including, the supplied oldest superclass are returned.
      Parameters:
        `childClazz` - the class to get options for
        `oldestAncestorClazz` - the oldest superclass (inclusive) at which to stop getting options from
      Returns:
        a list of options

    - #### listOptionsForClass

          public static java.util.Vector<Option> listOptionsForClass(java.lang.Class<?> clazz)

      Gets a list of options for the supplied class. Only examines immediate methods in the class (does not consider superclasses). Options identified by this method are bean properties (with get/set methods) annotated using the OptionMetadata annotation.
      Parameters:
        `clazz` - the class to examine for options
      Returns:
        a list of options

    - #### getOptionsForHierarchy

          public static java.lang.String[] getOptionsForHierarchy(java.lang.Object target,
                                                                  java.lang.Class<?> oldestAncestorClazz)

      Get the settings of the supplied object. Settings identified by this method are bean properties (with get/set methods) annotated using the OptionMetadata annotation. All options from the class up to, but not including, the supplied oldest superclass are returned.
      Parameters:
        `target` - the target object to get settings for
        `oldestAncestorClazz` - the oldest superclass at which to stop getting options from
      Returns:

    - #### getOptions

          public static java.lang.String[] getOptions(java.lang.Object target,
                                                      java.lang.Class<?> targetClazz)

      Get the settings of the supplied object. Settings identified by this method are bean properties (with get/set methods) annotated using the OptionMetadata annotation. Options belonging to the targetClazz (either the class of the target or one of its superclasses) are returned.
      Parameters:
        `target` - the target to extract settings from
        `targetClazz` - the class to consider for obtaining settings - i.e. annotated methods from this class will have their values extracted. This class is expected to be either the class of the target or one of its superclasses
      Returns:
        an array of settings

    - #### setOptionsForHierarchy

          public static void setOptionsForHierarchy(java.lang.String[] options,
                                                    java.lang.Object target,
                                                    java.lang.Class<?> oldestAncestorClazz)

      Sets options on the target object. Settings identified by this method are bean properties (with get/set methods) annotated using the OptionMetadata annotation. All options from the class up to, but not including, the supplied oldest superclass are processed in order.
      Parameters:
        `options` - the options to set
        `target` - the target on which to set options
        `oldestAncestorClazz` - the oldest superclass at which to stop setting options

    - #### setOptions

          public static void setOptions(java.lang.String[] options,
                                        java.lang.Object target,
                                        java.lang.Class<?> targetClazz)

      Sets options on the target object. Settings identified by this method are bean properties (with get/set methods) annotated using the OptionMetadata annotation. Options from just the supplied targetClazz (which is expected to be either the class of the target or one of its superclasses) are set.
      Parameters:
        `options` - the options to set
        `target` - the target on which to set options
        `targetClazz` - the class containing options to be be set - i.e. annotated option methods in this class will have their values set. This class is expected to be either the class of the target or one of its superclasses

    - #### deleteOption

          public static void deleteOption(java.util.List<Option> list,
                                          java.lang.String name)

      Removes an option from a given list of options.
      Parameters:
        `list` - the list to reduce
        `name` - the name of the option

    - #### deleteOptionString

          public static void deleteOptionString(java.util.List<java.lang.String> list,
                                                java.lang.String name)

      Removes an option from a given list of strings that specifies options. This method is for an option that has a parameter value.
      Parameters:
        `list` - the list to reduce
        `name` - the name of the option (including hyphen)

    - #### deleteFlagString

          public static void deleteFlagString(java.util.List<java.lang.String> list,
                                              java.lang.String name)

      Removes an option from a given list of strings that specifies options. This method is for an option without a parameter value (i.e., a flag).
      Parameters:
        `list` - the list to reduce
        `name` - the name of the option (including hyphen)

    - #### description

          public java.lang.String description()

      Returns the option's description.
      Returns:
        the option's description

    - #### name

          public java.lang.String name()

      Returns the option's name.
      Returns:
        the option's name

    - #### numArguments

          public int numArguments()

      Returns the option's number of arguments.
      Returns:
        the option's number of arguments

    - #### synopsis

          public java.lang.String synopsis()

      Returns the option's synopsis.
      Returns:
        the option's synopsis

    - #### getRevision

          public java.lang.String getRevision()

      Returns the revision string.
      Specified by:
        `getRevision` in interface `RevisionHandler`
      Returns:
        the revision