|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcosc575.p1.Attribute
cosc575.p1.NominalAttribute
public class NominalAttribute
Stores the attribute information for data sets for machine learning. An attribute has a name, type, and domain. Types can be discrete, numeric, or nominal.
Field Summary | |
---|---|
(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 |
Fields inherited from class cosc575.p1.Attribute |
---|
name |
Constructor Summary | |
---|---|
NominalAttribute()
|
|
NominalAttribute(java.util.Scanner scanner)
Explicit constructor. |
|
NominalAttribute(java.lang.String name)
Explicit constructor. |
Method Summary | |
---|---|
void |
addValue(java.lang.String value)
Adds a new nominal domain value to this attribute. |
java.util.ArrayList<java.lang.String> |
getDomain()
Returns the attribute's domain, which an array of values for nominal attributes. |
int |
getIndex(java.lang.String value)
Returns the index of the specified value index for the attribute. |
int |
getSize()
Gets the size of this attribute's domain. |
java.lang.String |
getValue(int index)
Returns the value of this attribute at the specified index. |
static void |
main(java.lang.String[] args)
|
private boolean |
parse(java.util.Scanner scanner)
Processes a nominal attibute declaration. |
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 |
Methods inherited from class cosc575.p1.Attribute |
---|
getName, setName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
java.util.ArrayList<java.lang.String> domain
boolean sorted
Constructor Detail |
---|
public NominalAttribute()
public NominalAttribute(java.lang.String name) throws java.lang.Exception
name
- the name of this data set
java.lang.Exception
public NominalAttribute(java.util.Scanner scanner) throws java.lang.Exception
scanner
- a Scanner containing the data set's tokens
java.lang.Exception
- if an exception occursMethod Detail |
---|
public void addValue(java.lang.String value) throws java.lang.Exception
value
- the attribute's new domain value
java.lang.Exception
- if an exception occurspublic int getSize() throws java.lang.Exception
getSize
in class Attribute
java.lang.Exception
public java.util.ArrayList<java.lang.String> getDomain()
public java.lang.String getValue(int index) throws java.lang.Exception
index
- the attribute value's index
java.lang.Exception
- if an exception occurspublic int getIndex(java.lang.String value) throws java.lang.Exception
value
- the attribute's value
java.lang.Exception
- if an exception occursprivate boolean parse(java.util.Scanner scanner) throws java.lang.Exception
scanner
- a scanner containing the data set's tokens
java.lang.Exception
- if an exception occurspublic java.lang.String toString()
toString
in class Attribute
public boolean validValue(java.lang.String value) throws java.lang.Exception
value
- the value for testing
java.lang.Exception
- if an exception occurspublic static void main(java.lang.String[] args)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |