コード例 #1
0
ファイル: InstanceQuery.java プロジェクト: SuperWan/weka
  /**
   * Parses a given list of options.
   * <!-- options-start -->
   * Valid options are:
   *
   * <p>
   *
   * <pre> -Q &lt;query&gt;
   *  SQL query to execute.</pre>
   *
   * <pre> -S
   *  Return sparse rather than normal instances.</pre>
   *
   * <pre> -U &lt;username&gt;
   *  The username to use for connecting.</pre>
   *
   * <pre> -P &lt;password&gt;
   *  The password to use for connecting.</pre>
   *
   * <pre> -D
   *  Enables debug output.</pre>
   *
   * <!-- options-end -->
   *
   * @param options the list of options as an array of strings
   * @throws Exception if an option is not supported
   */
  public void setOptions(String[] options) throws Exception {

    String tmpStr;

    setSparseData(Utils.getFlag('S', options));

    tmpStr = Utils.getOption('Q', options);
    if (tmpStr.length() != 0) setQuery(tmpStr);

    tmpStr = Utils.getOption('U', options);
    if (tmpStr.length() != 0) setUsername(tmpStr);

    tmpStr = Utils.getOption('P', options);
    if (tmpStr.length() != 0) setPassword(tmpStr);

    setDebug(Utils.getFlag('D', options));
  }
コード例 #2
0
  /**
   * Parses a given list of options.
   * <!-- options-start -->
   * Valid options are:
   *
   * <p>
   *
   * <pre> -Q &lt;query&gt;
   *  SQL query to execute.</pre>
   *
   * <pre> -S
   *  Return sparse rather than normal instances.</pre>
   *
   * <pre> -U &lt;username&gt;
   *  The username to use for connecting.</pre>
   *
   * <pre> -P &lt;password&gt;
   *  The password to use for connecting.</pre>
   *
   * <pre> -D
   *  Enables debug output.</pre>
   *
   * <!-- options-end -->
   *
   * @param options the list of options as an array of strings
   * @throws Exception if an option is not supported
   */
  public void setOptions(String[] options) throws Exception {

    String tmpStr;

    setSparseData(Utils.getFlag('S', options));

    tmpStr = Utils.getOption('Q', options);
    if (tmpStr.length() != 0) setQuery(tmpStr);

    tmpStr = Utils.getOption('U', options);
    if (tmpStr.length() != 0) setUsername(tmpStr);

    tmpStr = Utils.getOption('P', options);
    if (tmpStr.length() != 0) setPassword(tmpStr);

    tmpStr = Utils.getOption("custom-props", options);
    if (tmpStr.length() == 0) setCustomPropsFile(null);
    else setCustomPropsFile(new File(tmpStr));

    setDebug(Utils.getFlag('D', options));
  }