|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--shared.AttrInfo
The AttrInfo class allows giving attribute names, types, and a position in the instance array. This implementation assumes the value of UNKNOWN_REAL_VAL is never used for a known real value. Given k discrete categories, they will be mapped into integers in the range [0..k-1]. Globals.UNKNOWN_CATEGORY_VAL is used for unknown/undefined.
| Field Summary | |
java.lang.String |
attrName
The name of this attribute. |
byte |
attrType
The type of this attribute. |
static byte |
boundedReal
Value for BoundedReal attribute type. |
static byte |
internalDisjunction
Value for InternalDisjunction attribute type. |
static byte |
linearNominal
Value for LinearNominal attribute type. |
static byte |
nominal
Value for Nominal attribute type. |
static byte |
real
Value for Real attribute type. |
static byte |
treeStructured
Value for TreeStructured attribute type. |
static byte |
unknown
Value for Unknown attribute type. |
static java.lang.String |
UNKNOWN_VAL_STR
The String to be displayed for unknown values. |
static byte |
userInternalDisjunction
Value for UserInternalDisjunction attribute type. |
static byte |
userLinearNominal
Value for UserLinearNominal attribute type. |
static byte |
userNominal
Value for UserNominal attribute type. |
static byte |
userReal
Value for UserReal attribute type. |
static byte |
userTreeStructured
Value for UserTreeStructured attribute type. |
| Constructor Summary | |
AttrInfo(AttrInfo source)
Copy constructor. |
|
AttrInfo(java.lang.String aName,
byte aType)
Constructor. |
|
| Method Summary | |
static java.lang.String |
attr_type_to_string(byte t)
Returns a String value of the type of attribute the specified byte represents. |
abstract java.lang.String |
attrValue_to_string(AttrValue a)
Returns a String representing the value for the specified AttrValue. |
boolean |
can_cast_to_nominal()
Checks if this attribute can be considered a nominal value attribute. |
boolean |
can_cast_to_real()
Checks if this attribute can be considered a real value attribute. |
NominalAttrInfo |
cast_to_nominal()
Determines if this AttrInfo can be considered a Nominla AttrInfo and creates a new one if possible. |
RealAttrInfo |
cast_to_real()
Determines if this AttrInfo can be considered a RealAttrInfo and creates a new one if possible. |
abstract void |
check_in_range(AttrValue val)
Checks if the specified AttrValue is with in the range indicated in the Globals file. |
java.lang.Object |
clone()
Clones this AttrInfo. |
void |
display_attr_values()
Displays the values for the attribute represented by this object to the specified Writer. |
void |
display_attr_values(java.io.Writer stream)
Displays the values for the attribute represented by this object to the specified Writer. |
abstract void |
display_attr_values(java.io.Writer stream,
boolean protectChars)
Displays the values for the attribute represented by this object to the specified Writer. |
protected boolean |
equal_shallow(AttrInfo info,
boolean fatalOnFalse)
Compares attrName, attrType, and attrNum of this AttrInfo to the specified AttrInfo. |
abstract boolean |
equal_value(AttrValue i_attrvalue1,
AttrValue i_attrvalue2)
Determines if the specified AttrValues are equal. |
boolean |
get_ignore()
Checks if this attribute should be ignored during induction. |
int |
get_nominal_val(AttrValue AV)
Always returns zero and displays an error message. |
double |
get_real_val(AttrValue av)
Always returns zero and displays an error message. |
boolean |
is_linear()
Checks if this AttrInfo object has linear values. |
abstract boolean |
is_unknown(AttrValue v)
Checks if the specified AttrValue is an unknown value. |
java.lang.String |
name()
Returns the name of this attribute. |
static java.lang.String |
protect_chars(java.lang.String str)
Protect special characters by prefixing them with \. |
AttrValue |
read_attr_value(java.io.BufferedReader r,
boolean i,
FileSchema f)
Reads the value for the attribute from the BufferedReader specified. |
void |
set_ignore(boolean ig)
Sets wether this attribute should be ignored. |
void |
set_nominal_string(AttrValue a,
java.lang.String s,
boolean b)
Sets the nominal name for this AttrInfo. |
void |
set_nominal_val(AttrValue a,
int v)
Sets the nominal value for this AttrInfo. |
void |
set_real_val(AttrValue av,
double v)
Sets the real value for this AttrInfo. |
abstract void |
set_unknown(AttrValue a)
Sets the value for the specified AttrValue to the unknown value for that attribute type. |
byte |
type()
Returns the type of this attribute. |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public java.lang.String attrName
public byte attrType
public static final byte unknown
public static final byte real
public static final byte boundedReal
public static final byte nominal
public static final byte linearNominal
public static final byte treeStructured
public static final byte internalDisjunction
public static final byte userReal
public static final byte userNominal
public static final byte userLinearNominal
public static final byte userTreeStructured
public static final byte userInternalDisjunction
public static final java.lang.String UNKNOWN_VAL_STR
| Constructor Detail |
public AttrInfo(java.lang.String aName,
byte aType)
aName - The name of the attribute.aType - The type of the attribute.public AttrInfo(AttrInfo source)
source - The AttrInfo to be copied.| Method Detail |
public boolean is_linear()
public abstract boolean is_unknown(AttrValue v)
v - The specified AttrValue containing the value to be checked.public abstract void check_in_range(AttrValue val)
val - The AttrValue being checked.public static java.lang.String attr_type_to_string(byte t)
t - The byte value to be checked.public abstract void set_unknown(AttrValue a)
a - The value to be changed.public abstract java.lang.String attrValue_to_string(AttrValue a)
a - The AttrValue containing the value.public double get_real_val(AttrValue av)
av - The value of the attribute.
public void set_real_val(AttrValue av,
double v)
av - The AttrValue where the new value is to be stored.v - The new value to be stored.
public void set_nominal_string(AttrValue a,
java.lang.String s,
boolean b)
a - The AttrValue where the new value is to be stored.s - The new value to be stored.b - A boolean value.
public void set_nominal_val(AttrValue a,
int v)
a - The AttrValue where the new value is to be stored.v - The new value to be stored.public boolean get_ignore()
public AttrValue read_attr_value(java.io.BufferedReader r,
boolean i,
FileSchema f)
r - The specified BufferedReader to be read from.i - TRUE if this value is for a test Instance, FALSE otherwise.f - The FileSchema of the file being read.
protected boolean equal_shallow(AttrInfo info,
boolean fatalOnFalse)
info - The AttrInfo to be compared to.fatalOnFalse - TRUE if an Error message should be displayed if
these AttrInfos are not equal, FALSE
otherwise.public byte type()
public java.lang.String name()
public void set_ignore(boolean ig)
ig - TRUE if this attribute should be ignored.public boolean can_cast_to_real()
public boolean can_cast_to_nominal()
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
public RealAttrInfo cast_to_real()
public NominalAttrInfo cast_to_nominal()
public int get_nominal_val(AttrValue AV)
AV - The value of the attribute.
public abstract boolean equal_value(AttrValue i_attrvalue1,
AttrValue i_attrvalue2)
i_attrvalue1 - An AttrValue to be compared.i_attrvalue2 - An AttrValue to be compared.
public abstract void display_attr_values(java.io.Writer stream,
boolean protectChars)
stream - The Writer to which the values will be displayed.protectChars - TRUE if the '/' and '.' characters should be
preceeded by a '/' character, FALSE otherwise.public void display_attr_values()
public void display_attr_values(java.io.Writer stream)
stream - The Writer to which the values will be displayed.public static java.lang.String protect_chars(java.lang.String str)
str - The String to be searched for protected characters.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||