#include <nominal.h>
Public Member Functions | |
NominalAttribute () | |
NominalAttribute (string name) | |
void | addValue (string value) throw ( logic_error ) |
virtual int | getSize () const |
string | getValue (int index) throw ( logic_error ) |
int | getIndex (string value) throw ( logic_error ) |
virtual void | print (ostream &out=cout) const |
![]() | |
Attribute () | |
Attribute (string name) | |
string | getName () const |
void | setName (string name) |
Private Attributes | |
vector< string > | domain |
Friends | |
ostream & | operator<< (ostream &out, const NominalAttribute &na) |
Additional Inherited Members | |
![]() | |
string | name |
Stores information for a nominal attribute. A nominal attribute has has a name and a domain.
NominalAttribute::NominalAttribute | ( | ) |
Default constructor.
NominalAttribute::NominalAttribute | ( | string | name | ) |
Explicit constructor. Creates a nominal attribute with the specified name.
name | the name of this data set |
void NominalAttribute::addValue | ( | string | value | ) | |
throw | ( | logic_error | |||
) |
Adds a new nominal value to the domain of this nominal attribute.
value | the attribute's new domain value |
logic_error | if the value can not be added |
int NominalAttribute::getIndex | ( | string | value | ) | |
throw | ( | logic_error | |||
) |
Returns the index of the specified value index for this nominal attribute.
value | the attribute's value |
logic_error | if an exception occurs |
|
virtual |
Gets the size of this nominal attribute's domain.
Reimplemented from Attribute.
string NominalAttribute::getValue | ( | int | index | ) | |
throw | ( | logic_error | |||
) |
Returns the value of this nominal attribute at the specified index.
index | the attribute value's index |
logic_error | if the index is out of bounds |
|
virtual |
Prints this nominal attribute to the specified output stream.
out | the output stream for printing |
Reimplemented from Attribute.
|
friend |
Writes the specified nominal attribute to the output stream and returns it.
out | the output stream for writing |
na | the specified nominal attribute for writing |
|
private |
a vector of strings for the domain of nominal attributes