rule
Class Variable

java.lang.Object
  |
  +--rule.Variable
Direct Known Subclasses:
RuleVariable

public abstract class Variable
extends java.lang.Object

The Variable class defines an abstract class for a variable object.


Field Summary
protected  int column
           
protected  java.util.Vector labels
           
protected  java.lang.String name
           
protected  java.lang.String value
           
 
Constructor Summary
Variable()
          Creates a variable object.
Variable(java.lang.String name)
          Creates a variable object with specified name.
 
Method Summary
 boolean categorical()
          Checks if the variable is a categorical variable.
abstract  void computeStatistics(java.lang.String inValue)
          Computes statistics for the variable.
 java.lang.String getDecodedValue(float[] act, int index)
          Retrieves the decoded value at the given index
 int getIndex(java.lang.String label)
          Retrieves the index of the given label.
 java.lang.String getLabel(int index)
          Retrieves the label at the specified index.
 java.util.Vector getLabels()
          Retrieves all the labels for this variable.
 java.lang.String getLabelsAsString()
          Retrieves a string containing all the labels separated by spaces.
 java.lang.String getName()
          Retrieves the variable name.
 java.lang.String getValue()
          Retrieves the value of the variable.
abstract  int normalize(java.lang.String inValue, float[] outArray, int inx)
          Normalizes the variable.
 int normalizedSize()
          Retrieves the normalized size of the variable.
 void setColumn(int column)
          Sets the column (in a DataSet).
 void setLabels(java.lang.String newLabels)
          Sets the labels for the variable from the given string.
 void setValue(java.lang.String value)
          Sets the value of the variable.
 java.lang.String toString()
          Retrieves the name of the variable.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

value

protected java.lang.String value

labels

protected java.util.Vector labels

column

protected int column
Constructor Detail

Variable

public Variable()
Creates a variable object.

Variable

public Variable(java.lang.String name)
Creates a variable object with specified name.
Parameters:
name - the String object that contains the variable name
Method Detail

getName

public java.lang.String getName()
Retrieves the variable name.
Returns:
the String object that contains the variable name

setValue

public void setValue(java.lang.String value)
Sets the value of the variable.
Parameters:
value - the String object that contains the value for the variable

getValue

public java.lang.String getValue()
Retrieves the value of the variable.
Returns:
the String object that contains the value

setLabels

public void setLabels(java.lang.String newLabels)
Sets the labels for the variable from the given string.
Parameters:
newLabels - the String object that contains the labels, separated by spaces

getLabel

public java.lang.String getLabel(int index)
Retrieves the label at the specified index.
Parameters:
index - the integer of the index
Returns:
the String object that contains the label

getLabels

public java.util.Vector getLabels()
Retrieves all the labels for this variable.
Returns:
the Vector object that contains the labels

getLabelsAsString

public java.lang.String getLabelsAsString()
Retrieves a string containing all the labels separated by spaces.
Returns:
the String object that contains the labels

getIndex

public int getIndex(java.lang.String label)
Retrieves the index of the given label.
Parameters:
label - the String object that contains the label whose index is returned
Returns:
the integer value of index or -1 if not found

categorical

public boolean categorical()
Checks if the variable is a categorical variable.
Returns:
the boolean true if the variable is categorical (has labels) or false if it is not categorical

toString

public java.lang.String toString()
Retrieves the name of the variable.
Returns:
the String object that contains the name
Overrides:
toString in class java.lang.Object

setColumn

public void setColumn(int column)
Sets the column (in a DataSet).
Parameters:
column - the integer that represents the column

computeStatistics

public abstract void computeStatistics(java.lang.String inValue)
Computes statistics for the variable.
Parameters:
inValue - the String object used as input to the computation

normalize

public abstract int normalize(java.lang.String inValue,
                              float[] outArray,
                              int inx)
Normalizes the variable.
Parameters:
inValue - the String object containing the input value
outArray - the float[] object that contains the normalized value
inx - the integer that represents the index
Returns:
the integer return value

normalizedSize

public int normalizedSize()
Retrieves the normalized size of the variable.
Returns:
the integer value (the normalized size)

getDecodedValue

public java.lang.String getDecodedValue(float[] act,
                                        int index)
Retrieves the decoded value at the given index
Parameters:
act - the float[] object that contains the values to be decoded
index - the integer index value
Returns:
the String object that contains the decoded value