/** * Parses a given list of options. * * <p> * <!-- options-start --> * Valid options are: * * <p> * * <pre> -D * Turns on output of debugging information.</pre> * * <pre> -N <double> * The number of attributes to randomly select. * If < 1 then percentage, >= 1 absolute number. * (default: 0.5)</pre> * * <pre> -S <int> * The seed value. * (default: 1)</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; tmpStr = Utils.getOption("N", options); if (tmpStr.length() != 0) setNumAttributes(Double.parseDouble(tmpStr)); else setNumAttributes(0.5); tmpStr = Utils.getOption("S", options); if (tmpStr.length() != 0) setSeed(Integer.parseInt(tmpStr)); else setSeed(1); super.setOptions(options); }
/** * Parses the options for this object. * * <p> * <!-- options-start --> * Valid options are: * * <p> * * <pre> -D * Turns on output of debugging information.</pre> * * <pre> -R <index1,index2-index4,...> * Specify list of string attributes to convert to words. * (default: select all relational attributes)</pre> * * <pre> -V * Inverts the matching sense of the selection.</pre> * * <pre> -S <CASE|NON-CASE> * Determines the type of sorting: * CASE = Case-sensitive * NON-CASE = Case-insensitive * (default: CASE)</pre> * * <!-- options-end --> * * @param options the options to use * @throws Exception if setting of options fails */ public void setOptions(String[] options) throws Exception { String tmpStr; tmpStr = Utils.getOption('R', options); if (tmpStr.length() != 0) setAttributeIndices(tmpStr); else setAttributeIndices("first-last"); setInvertSelection(Utils.getFlag('V', options)); tmpStr = Utils.getOption('S', options); if (tmpStr.length() != 0) setSortType(new SelectedTag(tmpStr, TAGS_SORTTYPE)); else setSortType(new SelectedTag(SORT_CASESENSITIVE, TAGS_SORTTYPE)); super.setOptions(options); }
/** * Parses a given list of options. * * <p> * <!-- options-start --> * Valid options are: * * <p> * * <pre> * -D * Turns on output of debugging information. * </pre> * * <pre> * -min <double> * The minimum threshold. (default -Double.MAX_VALUE) * </pre> * * <pre> * -min-default <double> * The replacement for values smaller than the minimum threshold. * (default -Double.MAX_VALUE) * </pre> * * <pre> * -max <double> * The maximum threshold. (default Double.MAX_VALUE) * </pre> * * <pre> * -max-default <double> * The replacement for values larger than the maximum threshold. * (default Double.MAX_VALUE) * </pre> * * <pre> * -closeto <double> * The number values are checked for closeness. (default 0) * </pre> * * <pre> * -closeto-default <double> * The replacement for values that are close to '-closeto'. * (default 0) * </pre> * * <pre> * -closeto-tolerance <double> * The tolerance below which numbers are considered being close to * to each other. (default 1E-6) * </pre> * * <pre> * -decimals <int> * The number of decimals to round to, -1 means no rounding at all. * (default -1) * </pre> * * <pre> * -R <col1,col2,...> * The list of columns to cleanse, e.g., first-last or first-3,5-last. * (default first-last) * </pre> * * <pre> * -V * Inverts the matching sense. * </pre> * * <pre> * -include-class * Whether to include the class in the cleansing. * The class column will always be skipped, if this flag is not * present. (default no) * </pre> * * <!-- options-end --> * * @param options the list of options as an array of strings * @throws Exception if an option is not supported */ @Override public void setOptions(String[] options) throws Exception { String tmpStr = Utils.getOption("min", options); if (tmpStr.length() != 0) { setMinThreshold(Double.parseDouble(tmpStr)); } else { setMinThreshold(-Double.MAX_VALUE); } tmpStr = Utils.getOption("min-default", options); if (tmpStr.length() != 0) { setMinDefault(Double.parseDouble(tmpStr)); } else { setMinDefault(-Double.MAX_VALUE); } tmpStr = Utils.getOption("max", options); if (tmpStr.length() != 0) { setMaxThreshold(Double.parseDouble(tmpStr)); } else { setMaxThreshold(Double.MAX_VALUE); } tmpStr = Utils.getOption("max-default", options); if (tmpStr.length() != 0) { setMaxDefault(Double.parseDouble(tmpStr)); } else { setMaxDefault(Double.MAX_VALUE); } tmpStr = Utils.getOption("closeto", options); if (tmpStr.length() != 0) { setCloseTo(Double.parseDouble(tmpStr)); } else { setCloseTo(0); } tmpStr = Utils.getOption("closeto-default", options); if (tmpStr.length() != 0) { setCloseToDefault(Double.parseDouble(tmpStr)); } else { setCloseToDefault(0); } tmpStr = Utils.getOption("closeto-tolerance", options); if (tmpStr.length() != 0) { setCloseToTolerance(Double.parseDouble(tmpStr)); } else { setCloseToTolerance(1E-6); } tmpStr = Utils.getOption("R", options); if (tmpStr.length() != 0) { setAttributeIndices(tmpStr); } else { setAttributeIndices("first-last"); } setInvertSelection(Utils.getFlag("V", options)); setIncludeClass(Utils.getFlag("include-class", options)); tmpStr = Utils.getOption("decimals", options); if (tmpStr.length() != 0) { setDecimals(Integer.parseInt(tmpStr)); } else { setDecimals(-1); } super.setOptions(options); Utils.checkForRemainingOptions(options); }