|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcosc575.p1.Attribute
cosc575.p1.DiscreteAttribute
public class DiscreteAttribute
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 | |
|---|---|
private java.lang.Integer |
maxValue
the number of values for discrete attributes |
| Fields inherited from class cosc575.p1.Attribute |
|---|
name |
| Constructor Summary | |
|---|---|
DiscreteAttribute()
|
|
DiscreteAttribute(java.util.Scanner scanner)
Explicit constructor. |
|
DiscreteAttribute(java.lang.String name)
Explicit constructor. |
|
| Method Summary | |
|---|---|
void |
addValue(int value)
Adds or sets a new discrete domain value to this attribute. |
int |
getSize()
Gets the size of this attribute's domain. |
static void |
main(java.lang.String[] args)
|
boolean |
parse(java.util.Scanner scanner)
Processes a single attribute declaration, consisting of the keyword, attribute name, and attribute type. |
java.lang.String |
toString()
Returns a string representation of this attribute. |
boolean |
validValue(java.lang.Integer value)
Returns whether the value is valid for a discrete 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 |
|---|
private java.lang.Integer maxValue
| Constructor Detail |
|---|
public DiscreteAttribute()
public DiscreteAttribute(java.lang.String name)
throws java.lang.Exception
name - the name of this attribute
java.lang.Exception
public DiscreteAttribute(java.util.Scanner scanner)
throws java.lang.Exception
scanner - a Scanner containing the data set's tokens
java.lang.Exception - if an exception occurs| Method Detail |
|---|
public void addValue(int value)
throws java.lang.Exception
value - the attribute's new domain value
java.lang.Exception - if an exception occurs
public int getSize()
throws java.lang.Exception
getSize in class Attributejava.lang.Exception
public 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.Integer 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 | |||||||