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
|
(package private) boolean |
sorted
a Boolean indicating whether the nominal domain is sorted
|
| 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.
|
int |
getSize()
Gets the size of this nominal attribute's domain.
|
java.lang.String |
getValue(int index)
Returns the value of this nominal attribute at the specified index.
|
static void |
main(java.lang.String[] args) |
java.lang.String |
toString()
Returns a string representation of this attribute.
|
boolean |
validValue(java.lang.String value)
Returns whether the value is valid for a nominal attribute
|
java.util.ArrayList<java.lang.String> domain
boolean sorted
public NominalAttribute()
public NominalAttribute(java.lang.String name)
throws java.lang.Exception
name - the name of this data setjava.lang.Exceptionpublic void addValue(java.lang.String value)
throws java.lang.Exception
value - the attribute's new domain valuejava.lang.Exception - if an exception occurspublic int getSize()
throws java.lang.Exception
public java.lang.String getValue(int index)
throws java.lang.Exception
index - the attribute value's indexjava.lang.Exception - if an exception occurspublic int getIndex(java.lang.String value)
throws java.lang.Exception
value - the attribute's valuejava.lang.Exception - if an exception occurspublic java.lang.String toString()
public boolean validValue(java.lang.String value)
throws java.lang.Exception
value - the value for testingjava.lang.Exception - if an exception occurspublic static void main(java.lang.String[] args)