public class CheckSource extends java.lang.Object implements OptionHandler, RevisionHandler
weka.filters.Sourcable interface. It takes a filter, the classname of the generated source and the dataset the source was generated with as
parameters and tests the output of the built filter against the output of the generated source. Use option '-h' to display all available commandline options.
Valid options are:
-W <classname and options> The filter (incl. options) that was used to generate the source code.
-S <classname> The classname of the generated source code.
-t <file> The training set with which the source code was generated.
-c <index> The class index of the training set. 'first' and 'last' are valid indices. (default: none)Options after -- are passed to the designated filter.
Sourcable| Modifier and Type | Field and Description |
|---|---|
protected int |
m_ClassIndex
the class index
|
protected java.io.File |
m_Dataset
the dataset to use for testing
|
protected Filter |
m_Filter
the classifier used for generating the source code
|
protected Filter |
m_SourceCode
the generated source code
|
| Constructor and Description |
|---|
CheckSource() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
compare(Instance inst1,
Instance inst2)
compares two Instance
|
protected boolean |
compare(Instances inst1,
Instances inst2)
compares the two Instances objects
|
boolean |
execute()
performs the comparison test
|
int |
getClassIndex()
Gets the class index of the dataset.
|
java.io.File |
getDataset()
Gets the dataset to use for testing, can be null.
|
Filter |
getFilter()
Gets the filter being used for the tests, can be null.
|
java.lang.String[] |
getOptions()
Gets the current settings of the filter.
|
java.lang.String |
getRevision()
Returns the revision string.
|
Filter |
getSourceCode()
Gets the class to test.
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(java.lang.String[] args)
Executes the tests, use "-h" to list the commandline options.
|
void |
setClassIndex(int value)
Sets the class index of the dataset.
|
void |
setDataset(java.io.File value)
Sets the dataset to use for testing.
|
void |
setFilter(Filter value)
Sets the filter to use for the comparison.
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setSourceCode(Filter value)
Sets the class to test.
|
protected Filter m_Filter
protected Filter m_SourceCode
protected java.io.File m_Dataset
protected int m_ClassIndex
public java.util.Enumeration<Option> listOptions()
listOptions in interface OptionHandlerpublic void setOptions(java.lang.String[] options)
throws java.lang.Exception
-W <classname and options> The filter (incl. options) that was used to generate the source code.
-S <classname> The classname of the generated source code.
-t <file> The training set with which the source code was generated.
-c <index> The class index of the training set. 'first' and 'last' are valid indices. (default: none)Options after -- are passed to the designated filter.
setOptions in interface OptionHandleroptions - the list of options as an array of stringsjava.lang.Exception - if an option is not supportedpublic java.lang.String[] getOptions()
getOptions in interface OptionHandlerpublic void setFilter(Filter value)
value - the filter to usepublic Filter getFilter()
public void setSourceCode(Filter value)
value - the class to testpublic Filter getSourceCode()
public void setDataset(java.io.File value)
value - the dataset to use.public java.io.File getDataset()
public void setClassIndex(int value)
value - the class index of the dataset.public int getClassIndex()
protected boolean compare(Instance inst1, Instance inst2)
inst1 - the first Instance object to compareinst2 - the second Instance object to compareprotected boolean compare(Instances inst1, Instances inst2)
inst1 - the first Instances object to compareinst2 - the second Instances object to comparepublic boolean execute()
throws java.lang.Exception
java.lang.Exception - if tests failpublic java.lang.String getRevision()
getRevision in interface RevisionHandlerpublic static void main(java.lang.String[] args)
throws java.lang.Exception
args - the commandline parametersjava.lang.Exception - if something goes wrong