shared
Class RealAttrInfo

java.lang.Object
  |
  +--shared.AttrInfo
        |
        +--shared.RealAttrInfo

public class RealAttrInfo
extends AttrInfo

The RealAttrInfo class allows AttrValue of type Real. The standard definitions of the comparison operators is implemented.


Fields inherited from class shared.AttrInfo
attrName, attrType, boundedReal, internalDisjunction, linearNominal, nominal, real, treeStructured, unknown, UNKNOWN_VAL_STR, userInternalDisjunction, userLinearNominal, userNominal, userReal, userTreeStructured
 
Constructor Summary
RealAttrInfo(java.lang.String s)
          Constructor.
 
Method Summary
 java.lang.String attrValue_to_string(AttrValue val)
          Returns a String value of the value in the specified AttrInfo.
 boolean can_cast_to_real()
          Checks if this AttrInfo subclass can be cast as a RealAttrInfo class.
 RealAttrInfo cast_to_real()
          Casts this AttrInfo subclass to a RealAttrInfo class.
 void check_in_range(AttrValue val)
          At the moment this does nothing.
 void display_attr_values(java.io.Writer stream)
          Displays the attribute values in names file format.
 void display_attr_values(java.io.Writer stream, boolean protectchars)
          Displays the attribute values in names file format.
 boolean equal_value(AttrValue realValue1, AttrValue realValue2)
          Returns TRUE if given AttrValue are equivalent, FALSE otherwise.
 double get_real_val(AttrValue av)
          Returns the real value of this AttrValue.
 boolean is_unknown(AttrValue realValue)
          Checks if the specified AttrValue is unknown.
 double normalized_value(AttrValue val)
          Normalize the specified AttrValue according to the min and max values for this AttrValue.
 AttrValue read_attr_value(java.io.BufferedReader stream, boolean isTest, FileSchema f)
          Reads the value for the attribute from the BufferedReader specified.
 AttrValue read_attr_value(java.io.StreamTokenizer stream, boolean isTest, FileSchema f)
          Reads the value for the attribute from the StreamTokenizer specified.
 void set_real_val(AttrValue av, double val)
          Sets the specified AttrValue to the specified value.
 void set_unknown(AttrValue val)
          Sets the given AttrValue to be unknown.
 
Methods inherited from class shared.AttrInfo
attr_type_to_string, can_cast_to_nominal, cast_to_nominal, clone, display_attr_values, equal_shallow, get_ignore, get_nominal_val, is_linear, name, protect_chars, set_ignore, set_nominal_string, set_nominal_val, type
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RealAttrInfo

public RealAttrInfo(java.lang.String s)
Constructor.
Parameters:
s - The name for this attribute.
Method Detail

can_cast_to_real

public boolean can_cast_to_real()
Checks if this AttrInfo subclass can be cast as a RealAttrInfo class.
Overrides:
can_cast_to_real in class AttrInfo
Returns:
Always returns TRUE for the RealAttrInfo class.

cast_to_real

public RealAttrInfo cast_to_real()
Casts this AttrInfo subclass to a RealAttrInfo class.
Overrides:
cast_to_real in class AttrInfo
Returns:
A reference to this RealAttrInfo object.

read_attr_value

public AttrValue read_attr_value(java.io.BufferedReader stream,
                                 boolean isTest,
                                 FileSchema f)
Reads the value for the attribute from the BufferedReader specified.
Overrides:
read_attr_value in class AttrInfo
Parameters:
stream - The specified BufferedReader to be read from.
isTest - TRUE if this value is for a test Instance, FALSE otherwise.
f - The FileSchema for the file being read.
Returns:
The attribute read from the BufferedReader.

read_attr_value

public AttrValue read_attr_value(java.io.StreamTokenizer stream,
                                 boolean isTest,
                                 FileSchema f)
Reads the value for the attribute from the StreamTokenizer specified.
Parameters:
stream - The specified StreamTokenizer to be read from.
isTest - TRUE if this value is for a test Instance, FALSE otherwise.
f - The FileSchema for the file being read.
Returns:
The attribute read from the StreamTokenizer.

is_unknown

public boolean is_unknown(AttrValue realValue)
Checks if the specified AttrValue is unknown.
Overrides:
is_unknown in class AttrInfo
Parameters:
realValue - The specified AttrValue.
Returns:
TRUE if the specified AttrValue is unknown.

get_real_val

public double get_real_val(AttrValue av)
Returns the real value of this AttrValue.
Overrides:
get_real_val in class AttrInfo
Parameters:
av - realValue The specified av.
Returns:
The real value of this AttrValue.

set_real_val

public void set_real_val(AttrValue av,
                         double val)
Sets the specified AttrValue to the specified value.
Overrides:
set_real_val in class AttrInfo
Parameters:
av - The specified AttrValue.
val - The specified new value.

normalized_value

public double normalized_value(AttrValue val)
Normalize the specified AttrValue according to the min and max values for this AttrValue.
Parameters:
val - The AttrValue to be normalized.
Returns:
The normalized value.

attrValue_to_string

public java.lang.String attrValue_to_string(AttrValue val)
Returns a String value of the value in the specified AttrInfo.
Overrides:
attrValue_to_string in class AttrInfo
Parameters:
val - The specified AttrInfo.
Returns:
A String value of the value in this AttrInfo.

equal_value

public boolean equal_value(AttrValue realValue1,
                           AttrValue realValue2)
Returns TRUE if given AttrValue are equivalent, FALSE otherwise. Assumes that given AttrValue are both of the type described by the instance of RealAttrInfo calling this function.
Overrides:
equal_value in class AttrInfo
Parameters:
realValue1 - The first AttrValue to be compared.
realValue2 - The second AttrValue to be compared.
Returns:
TRUE if the give AttrValue are equivalent, FALSE otherwise.

check_in_range

public void check_in_range(AttrValue val)
At the moment this does nothing. Checks if the given AttrValue is in the range for this AttrValue.
Overrides:
check_in_range in class AttrInfo
Parameters:
val - The specified AttrValue.

set_unknown

public void set_unknown(AttrValue val)
Sets the given AttrValue to be unknown.
Overrides:
set_unknown in class AttrInfo
Parameters:
val - The AttrValue to be changed.

display_attr_values

public void display_attr_values(java.io.Writer stream)
Displays the attribute values in names file format.
Overrides:
display_attr_values in class AttrInfo
Parameters:
stream - Writer to which the display will be written.

display_attr_values

public void display_attr_values(java.io.Writer stream,
                                boolean protectchars)
Displays the attribute values in names file format.
Overrides:
display_attr_values in class AttrInfo
Parameters:
stream - Writer to which the display will be written.
protectchars - True if "\" and "." are to be protected by "\" characters, false otherwise.