textclassifier.discretization
Class DiscInterval

java.lang.Object
  extended by textclassifier.discretization.DiscInterval

public class DiscInterval
extends java.lang.Object

A class representing an interval created by discretization step.


Field Summary
static char HEQ
           
static char HIG
           
static char LEQ
          Default chars for interval
static char LES
           
 
Constructor Summary
DiscInterval(double min, double max)
          Constructor of the class (only border values)
DiscInterval(double min, double max, double center, double dist, int count)
          Constructor of the class (all characteristics)
 
Method Summary
 char gerRightBranch()
          Returns the type of the right branch
 double getCenter()
          Returns the center value of the interval
 int getCount()
          Returns the count of values in the interval
 char getLeftBranch()
          Returns the type of the left branch
 double getMax()
          Returns the maximum value of the interval
 double getMin()
          Returns the minimum value of the interval
 java.lang.String getSqlCondition(java.lang.String att_name)
          Returns a condition for WHERE clause of SQL command that will take all records of a table that satisfy condition of the interval
 void incCount()
          Increments the count of values inside the interval
 boolean isSingle()
          Tests if the interval contains only a single value (minimum and maximum are equal)
 boolean isValueIn(double value)
          Tests if a specified value is inside the interval
 void setLeftBranch(char branch_type)
          Sets the type of the left branch of interval
 void setMax(double m)
          Sets the maximum value of the interval
 void setMin(double m)
          Sets the minimum value of the interval
 void setRightBranch(char branch_type)
          Sets the type of the right branch of interval
 void setSimpleBranches()
          Sets a simple (<, >) type of branche for both left and right branches
 java.lang.String toString()
          Converts information about interval into one string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LEQ

public static final char LEQ
Default chars for interval

See Also:
Constant Field Values

LES

public static final char LES
See Also:
Constant Field Values

HEQ

public static final char HEQ
See Also:
Constant Field Values

HIG

public static final char HIG
See Also:
Constant Field Values
Constructor Detail

DiscInterval

public DiscInterval(double min,
                    double max)
Constructor of the class (only border values)

Parameters:
min - minimum (left) value of the interval
max - maximum (right) value of the interval

DiscInterval

public DiscInterval(double min,
                    double max,
                    double center,
                    double dist,
                    int count)
Constructor of the class (all characteristics)

Parameters:
min - minimum (left) value of the interval
max - maximum (right) value of the interval
center - average of the values inside the interval
dist - average distance between values inside the interval
count - count of values inside the interval
Method Detail

toString

public java.lang.String toString()
Converts information about interval into one string

Overrides:
toString in class java.lang.Object
Returns:
string containing all informations about interval

isValueIn

public boolean isValueIn(double value)
Tests if a specified value is inside the interval

Parameters:
value - a numeric value
Returns:
true, if a value is in the interval, else false

getCount

public int getCount()
Returns the count of values in the interval

Returns:
numeric value

getCenter

public double getCenter()
Returns the center value of the interval

Returns:
numeric value

getMin

public double getMin()
Returns the minimum value of the interval

Returns:
numeric value

getMax

public double getMax()
Returns the maximum value of the interval

Returns:
numeric value

setLeftBranch

public void setLeftBranch(char branch_type)
Sets the type of the left branch of interval

Parameters:
branch_type - the required type of branch

setRightBranch

public void setRightBranch(char branch_type)
Sets the type of the right branch of interval

Parameters:
branch_type - the required type of branch

getLeftBranch

public char getLeftBranch()
Returns the type of the left branch

Returns:
the type of branch (character)

gerRightBranch

public char gerRightBranch()
Returns the type of the right branch

Returns:
the type of branch (character)

isSingle

public boolean isSingle()
Tests if the interval contains only a single value (minimum and maximum are equal)

Returns:
boolean value. True, if it is single

setSimpleBranches

public void setSimpleBranches()
Sets a simple (<, >) type of branche for both left and right branches


setMin

public void setMin(double m)
Sets the minimum value of the interval

Parameters:
m - required minimum value

setMax

public void setMax(double m)
Sets the maximum value of the interval

Parameters:
m - required maximum value

getSqlCondition

public java.lang.String getSqlCondition(java.lang.String att_name)
Returns a condition for WHERE clause of SQL command that will take all records of a table that satisfy condition of the interval

Parameters:
att_name - name of the attribute for condition
Returns:
string that contains the condition

incCount

public void incCount()
Increments the count of values inside the interval