cosc575.p1
Class NumericAttribute

java.lang.Object
  extended by cosc575.p1.Attribute
      extended by cosc575.p1.NumericAttribute

public class NumericAttribute
extends Attribute

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
 
Fields inherited from class cosc575.p1.Attribute
name
 
Constructor Summary
NumericAttribute()
           
NumericAttribute(java.util.Scanner scanner)
          Explicit constructor.
NumericAttribute(java.lang.String name)
          Explicit constructor.
 
Method Summary
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.Double value)
          Returns whether the value is valid for a numeric attribute
 
Methods inherited from class cosc575.p1.Attribute
getName, getSize, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NumericAttribute

public NumericAttribute()

NumericAttribute

public NumericAttribute(java.lang.String name)
                 throws java.lang.Exception
Explicit constructor. Creates an empty data set of the specified name.

Parameters:
name - the name of this data set
Throws:
java.lang.Exception

NumericAttribute

public NumericAttribute(java.util.Scanner scanner)
                 throws java.lang.Exception
Explicit constructor. Creates a data set populated with the tokens in the scanner.

Parameters:
scanner - a Scanner containing the data set's tokens
Throws:
java.lang.Exception - if an exception occurs
Method Detail

parse

public boolean parse(java.util.Scanner scanner)
              throws java.lang.Exception
Processes a single attribute declaration, consisting of the keyword, attribute name, and attribute type.

Parameters:
scanner - a Scanner containing the data set's tokens
Returns:
true while there are more attribute to process; false otherwise
Throws:
java.lang.Exception - if an exception occurs

toString

public java.lang.String toString()
Returns a string representation of this attribute.

Overrides:
toString in class Attribute
Returns:
a string representation of the names structure

validValue

public boolean validValue(java.lang.Double value)
                   throws java.lang.Exception
Returns whether the value is valid for a numeric attribute

Parameters:
value - the value for testing
Returns:
true if the value is valid; false otherwise
Throws:
java.lang.Exception - if an exception occurs

main

public static void main(java.lang.String[] args)