cosc575.p1
Class Attribute

java.lang.Object
  extended by cosc575.p1.Attribute
Direct Known Subclasses:
DiscreteAttribute, NominalAttribute, NumericAttribute

public class Attribute
extends java.lang.Object

Stores attribute information for data sets for machine learning. An attribute has a name.


Field Summary
protected  java.lang.String name
          this attribute's name
 
Constructor Summary
Attribute()
          Default constructor.
Attribute(java.util.Scanner s)
          Explicit constructor.
Attribute(java.lang.String name)
          Explicit constructor.
 
Method Summary
 java.lang.String getName()
          Gets the name of this attribute.
 int getSize()
          Gets the size of this attribute's domain.
static void main(java.lang.String[] args)
           
private  boolean parse(java.util.Scanner scanner)
          Extracts an attribute from the specified scanner
 void setName(java.lang.String name)
          Sets the name of this attribute to the specified name.
 java.lang.String toString()
          Returns a string representation of this attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
this attribute's name

Constructor Detail

Attribute

public Attribute()
Default constructor.


Attribute

public Attribute(java.lang.String name)
          throws java.lang.Exception
Explicit constructor. name.

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

Attribute

public Attribute(java.util.Scanner s)
          throws java.lang.Exception
Explicit constructor. Creates an attribute from the specified scanner.

Parameters:
s - the scanner containing an attribute.
Throws:
java.lang.Exception
Method Detail

getName

public java.lang.String getName()
                         throws java.lang.Exception
Gets the name of this attribute.

Returns:
a string storing the name
Throws:
java.lang.Exception

getSize

public int getSize()
            throws java.lang.Exception
Gets the size of this attribute's domain.

Returns:
an int storing the size of the domain
Throws:
java.lang.Exception

parse

private boolean parse(java.util.Scanner scanner)
               throws java.lang.Exception
Extracts an attribute from the specified scanner

Throws:
java.lang.Exception

setName

public void setName(java.lang.String name)
Sets the name of this attribute to the specified name.

Parameters:
name - the name of this attribute

toString

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

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this attribute

main

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