public class NominalAttribute extends Attribute
Modifier and Type | Field and Description |
---|---|
(package private) java.util.ArrayList<java.lang.String> |
domain
a list of strings for the domain of nominal attributes
|
Constructor and Description |
---|
NominalAttribute()
Default constructor.
|
NominalAttribute(java.lang.String name)
Explicit constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addValue(java.lang.String value)
Adds a new nominal value to the domain of this nominal attribute.
|
int |
getIndex(java.lang.String value)
Returns the index of the specified value index for this nominal
attribute.
|
java.lang.String |
getValue(int index)
Returns the value of this nominal attribute at the specified index.
|
static void |
main(java.lang.String[] args) |
int |
size()
Gets the size of this nominal attribute's domain.
|
java.lang.String |
toString()
Returns a string representation of this NominalAttribute.
|
boolean |
validValue(java.lang.String value)
Returns whether the value is valid for a nominal attribute
|
java.util.ArrayList<java.lang.String> domain
public NominalAttribute()
public NominalAttribute(java.lang.String name)
name
- the name of this data setpublic void addValue(java.lang.String value)
value
- the attribute's new domain valuepublic int size()
public java.lang.String getValue(int index)
index
- the attribute value's indexpublic int getIndex(java.lang.String value) throws java.lang.Exception
value
- the attribute's valuejava.lang.Exception
- if the value is not in the domainpublic java.lang.String toString()
public boolean validValue(java.lang.String value)
value
- the value for testingpublic static void main(java.lang.String[] args)