Package weka.core
Class CheckOptionHandler
- java.lang.Object
-
- weka.core.Check
-
- weka.core.CheckOptionHandler
-
- All Implemented Interfaces:
OptionHandler,RevisionHandler
public class CheckOptionHandler extends Check
Simple command line checking of classes that implement OptionHandler. Usage:CheckOptionHandler -W optionHandlerClassName -- test optionsValid options are:-D Turn on debugging output.
-S Silent mode - prints nothing to stdout.
-W Full name of the OptionHandler analysed. eg: weka.classifiers.rules.ZeroR (default weka.classifiers.rules.ZeroR)
Options specific to option handler weka.classifiers.rules.ZeroR:
-D If set, classifier is run in debug mode and may output additional info to the console
Options after -- are used as user options in testing the OptionHandler- Version:
- $Revision: 1.13 $
- Author:
- Len Trigg (trigg@cs.waikato.ac.nz), FracPete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description CheckOptionHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckCanonicalUserOptions()checks whether the user-supplied options stay the same after settting, getting and re-setting againbooleancheckDefaultOptions()checks whether the default options can be processed completely or some invalid options are returned by the getOptions() method.booleancheckListOptions()checks whether the listOptions method worksbooleancheckRemainingOptions()checks whether the user-supplied options can be processed completely or some "left-over" options remainbooleancheckResettingOptions()checks whether the optionhandler can be re-setted again to default options after the user-supplied options have been set.booleancheckSetOptions()checks whether the user-supplied options can be processed at allvoiddoTests()Runs some diagnostic tests on an optionhandler object.OptionHandlergetOptionHandler()Get the OptionHandler used in the tests.java.lang.String[]getOptions()Gets the current settings of the CheckClassifier.java.lang.StringgetRevision()Returns the revision string.booleangetSuccess()returns the success of the testsjava.lang.String[]getUserOptions()Gets the current user-supplied options (creates a copy)java.util.EnumerationlistOptions()Returns an enumeration describing the available options.static voidmain(java.lang.String[] args)Main method for using the CheckOptionHandler.voidsetOptionHandler(OptionHandler value)Set the OptionHandler to work on..voidsetOptions(java.lang.String[] options)Parses a given list of options.voidsetUserOptions(java.lang.String[] value)Sets the user-supplied options (creates a copy)
-
-
-
Method Detail
-
listOptions
public java.util.Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classCheck- Returns:
- an enumeration of all the available options.
-
setOptions
public void setOptions(java.lang.String[] options) throws java.lang.ExceptionParses a given list of options. Valid options are:-D Turn on debugging output.
-S Silent mode - prints nothing to stdout.
-W Full name of the OptionHandler analysed. eg: weka.classifiers.rules.ZeroR (default weka.classifiers.rules.ZeroR)
Options specific to option handler weka.classifiers.rules.ZeroR:
-D If set, classifier is run in debug mode and may output additional info to the console
- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classCheck- Parameters:
options- the list of options as an array of strings- Throws:
java.lang.Exception- if an option is not supported
-
getOptions
public java.lang.String[] getOptions()
Gets the current settings of the CheckClassifier.- Specified by:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin classCheck- Returns:
- an array of strings suitable for passing to setOptions
-
setOptionHandler
public void setOptionHandler(OptionHandler value)
Set the OptionHandler to work on..- Parameters:
value- the OptionHandler to use.
-
getOptionHandler
public OptionHandler getOptionHandler()
Get the OptionHandler used in the tests.- Returns:
- the OptionHandler used in the tests.
-
setUserOptions
public void setUserOptions(java.lang.String[] value)
Sets the user-supplied options (creates a copy)- Parameters:
value- the user-supplied options to use
-
getUserOptions
public java.lang.String[] getUserOptions()
Gets the current user-supplied options (creates a copy)- Returns:
- the user-supplied options
-
getSuccess
public boolean getSuccess()
returns the success of the tests- Returns:
- true if the tests were successful
-
checkListOptions
public boolean checkListOptions()
checks whether the listOptions method works- Returns:
- index 0 is true if the test was passed, index 1 is always false
-
checkSetOptions
public boolean checkSetOptions()
checks whether the user-supplied options can be processed at all- Returns:
- index 0 is true if the test was passed, index 1 is always false
-
checkDefaultOptions
public boolean checkDefaultOptions()
checks whether the default options can be processed completely or some invalid options are returned by the getOptions() method.- Returns:
- index 0 is true if the test was passed, index 1 is always false
-
checkRemainingOptions
public boolean checkRemainingOptions()
checks whether the user-supplied options can be processed completely or some "left-over" options remain- Returns:
- index 0 is true if the test was passed, index 1 is always false
-
checkCanonicalUserOptions
public boolean checkCanonicalUserOptions()
checks whether the user-supplied options stay the same after settting, getting and re-setting again- Returns:
- index 0 is true if the test was passed, index 1 is always false
-
checkResettingOptions
public boolean checkResettingOptions()
checks whether the optionhandler can be re-setted again to default options after the user-supplied options have been set.- Returns:
- index 0 is true if the test was passed, index 1 is always false
-
doTests
public void doTests()
Runs some diagnostic tests on an optionhandler object. Output is printed to System.out (if not silent).
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Returns:
- the revision
-
main
public static void main(java.lang.String[] args)
Main method for using the CheckOptionHandler.- Parameters:
args- the options to the CheckOptionHandler
-
-