weka.datagenerators
Class Test

java.lang.Object
  extended byweka.datagenerators.Test
All Implemented Interfaces:
java.io.Serializable

public class Test
extends java.lang.Object
implements java.io.Serializable

Class to represent a test.

The string representation of the test can be supplied in standard notation or for a subset of types of attributes in Prolog notation.
Following examples for all possible tests that can be represented by this class, given in standard notation.

Examples of tests for numeric attributes:
B >= 2.333
B < 4.56

Examples of tests for nominal attributes with more then 2 values:
A = rain
A != rain

Examples of tests for nominal attribute with exactly 2 values:
A = false
A = true


The Prolog notation is only supplied for numeric attributes and for nominal attributes that have the values "true" and "false".

Following examples for the Prolog notation provided.

Examples of tests for numeric attributes:
The same as for standard notation above.

Examples of tests for nominal attributes with values "true"and "false":
A
not(A)

(Other nominal attributes are not supported by the Prolog notation.)

Version:
$Revision: 1.1 $
Author:
Gabi Schmidberger (gabi@cs.waikato.ac.nz)
See Also:
Serialized Form

Field Summary
(package private)  int m_AttIndex
           
(package private)  Instances m_Dataset
           
(package private)  boolean m_Not
           
(package private)  double m_Split
           
 
Constructor Summary
(package private) Test(int i, double s, Instances dataset)
          Constructor
(package private) Test(int i, double s, Instances dataset, boolean n)
          Constructor
 
Method Summary
 boolean equalTo(Test t)
          Compares the test with the test that is given as parameter.
 Test getNot()
          Negates the test.
 boolean passesTest(Instance inst)
          Determines whether an instance passes the test.
private  java.lang.String testComparisonString()
          Gives a string representation of the test, starting from the comparison symbol.
private  java.lang.String testPrologComparisonString()
          Gives a string representation of the test in Prolog notation, starting from the comparison symbol.
 java.lang.String toPrologString()
          Returns the test represented by a string in Prolog notation.
 java.lang.String toString()
          Returns the test represented by a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_AttIndex

int m_AttIndex

m_Split

double m_Split

m_Not

boolean m_Not

m_Dataset

Instances m_Dataset
Constructor Detail

Test

Test(int i,
     double s,
     Instances dataset)
Constructor


Test

Test(int i,
     double s,
     Instances dataset,
     boolean n)
Constructor

Method Detail

getNot

public Test getNot()
Negates the test.

Returns:
the test itself negated

passesTest

public boolean passesTest(Instance inst)
                   throws java.lang.Exception
Determines whether an instance passes the test.

Parameters:
inst - the instance
Returns:
true if the instance satisfies the test, false otherwise
Throws:
java.lang.Exception - if something goes wrong

toString

public java.lang.String toString()
Returns the test represented by a string.

Returns:
a string representing the test

toPrologString

public java.lang.String toPrologString()
Returns the test represented by a string in Prolog notation.

Returns:
a string representing the test in Prolog notation

testComparisonString

private java.lang.String testComparisonString()
Gives a string representation of the test, starting from the comparison symbol.

Returns:
a string representing the test

testPrologComparisonString

private java.lang.String testPrologComparisonString()
Gives a string representation of the test in Prolog notation, starting from the comparison symbol.

Returns:
a string representing the test in Prolog notation

equalTo

public boolean equalTo(Test t)
Compares the test with the test that is given as parameter.

Parameters:
t - the test the object is compared to
Returns:
true if the two Tests are equal