Public Member Functions | Private Attributes | Friends | List of all members
NominalAttribute Class Reference

#include <nominal.h>

Inheritance diagram for NominalAttribute:
Attribute

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
 
- Public Member Functions inherited from Attribute
 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

- Protected Attributes inherited from Attribute
string name
 

Detailed Description

Stores information for a nominal attribute. A nominal attribute has has a name and a domain.

Author
Mark Maloof
Version
1.0, 5/18/11

Constructor & Destructor Documentation

NominalAttribute::NominalAttribute ( )

Default constructor.

NominalAttribute::NominalAttribute ( string  name)

Explicit constructor. Creates a nominal attribute with the specified name.

Parameters
namethe name of this data set

Member Function Documentation

void NominalAttribute::addValue ( string  value)
throw (logic_error
)

Adds a new nominal value to the domain of this nominal attribute.

Parameters
valuethe attribute's new domain value
Exceptions
logic_errorif 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.

Parameters
valuethe attribute's value
Exceptions
logic_errorif an exception occurs
int NominalAttribute::getSize ( ) const
virtual

Gets the size of this nominal attribute's domain.

Returns
an int storing the size of the domain

Reimplemented from Attribute.

string NominalAttribute::getValue ( int  index)
throw (logic_error
)

Returns the value of this nominal attribute at the specified index.

Parameters
indexthe attribute value's index
Exceptions
logic_errorif the index is out of bounds
void NominalAttribute::print ( ostream &  out = cout) const
virtual

Prints this nominal attribute to the specified output stream.

Parameters
outthe output stream for printing

Reimplemented from Attribute.

Friends And Related Function Documentation

ostream& operator<< ( ostream &  out,
const NominalAttribute na 
)
friend

Writes the specified nominal attribute to the output stream and returns it.

Parameters
outthe output stream for writing
nathe specified nominal attribute for writing
Returns
the modified output stream

Member Data Documentation

vector<string> NominalAttribute::domain
private

a vector of strings for the domain of nominal attributes


The documentation for this class was generated from the following files: