public class CategoricalAttribute extends AbstractAttribute
Categorical attributes
Modifier and Type | Field and Description |
---|---|
protected java.util.List<java.lang.String> |
categories
Categories list (external values)
|
protected java.util.List<java.lang.Double> |
doubleValues
Categories list (internal values)
|
protected java.util.Hashtable |
htDoubleValue
Association between double and real values
|
protected java.util.Hashtable |
htRealValue
Association between real and double values
|
protected double |
lastValue
The last value assigned
|
protected int |
numCategories
Number of Categories
|
name
Constructor and Description |
---|
CategoricalAttribute()
Empty constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addValue(java.lang.Object newValue)
Adds a new value
|
int |
getNumberCategories()
Access to Number of categories
|
AttributeType |
getType()
Access to the attribute type
|
Interval |
intervalValues()
Return an interval with the allowed values
|
boolean |
isValid(double internalValue)
Check if this internal attribute value is valid
|
boolean |
isValid(java.lang.Object externalValue)
Check if this external attribute value is valid
|
double |
parse(java.lang.String externalValue)
Parse an external value to obtain the internal value of the
Attribute
|
void |
setNumberCategories(int numCategories)
Set Number of categories
|
java.lang.String |
show(double internalValue)
Show an String which represents a given real value
|
getName, setName
protected int numCategories
protected java.util.Hashtable htRealValue
protected java.util.Hashtable htDoubleValue
protected java.util.List<java.lang.String> categories
protected java.util.List<java.lang.Double> doubleValues
protected double lastValue
public int getNumberCategories()
Access to Number of categories
public void setNumberCategories(int numCategories)
Set Number of categories
numCategories
- New Number of Categoriespublic void addValue(java.lang.Object newValue)
Adds a new value
newValue
- New value to be addedpublic AttributeType getType()
Access to the attribute type
getType
in interface IAttribute
getType
in class AbstractAttribute
public boolean isValid(double internalValue)
Check if this internal attribute value is valid
isValid
in interface IAttribute
isValid
in class AbstractAttribute
internalValue
- value to check
public boolean isValid(java.lang.Object externalValue)
Check if this external attribute value is valid
isValid
in interface IAttribute
isValid
in class AbstractAttribute
externalValue
- Value to checkpublic double parse(java.lang.String externalValue)
Parse an external value to obtain the internal value of the Attribute
parse
in interface IAttribute
parse
in class AbstractAttribute
externalValue
- Value to check
public java.lang.String show(double internalValue)
Show an String which represents a given real value
show
in interface IAttribute
show
in class AbstractAttribute
internalValue
- internal value asked.public Interval intervalValues()
Return an interval with the allowed values