GClasses

GClasses::GArffRelation Class Reference

ARFF = Attribute-Relation File Format. This stores richer information than GRelation. This includes a name, a name for each attribute, and names for each supported nominal value. More...

#include <GMatrix.h>

Inheritance diagram for GClasses::GArffRelation:
GClasses::GMixedRelation GClasses::GRelation

List of all members.

Public Member Functions

 GArffRelation ()
virtual ~GArffRelation ()
virtual RelationType type ()
 Returns the type of relation.
virtual GRelationclone ()
 Returns a deep copy of this object.
virtual GRelationcloneSub (size_t start, size_t count)
 Makes a deep copy of the specified subset of this relation.
virtual void flush ()
 Deletes all the attributes.
virtual void printAttrName (std::ostream &stream, size_t column)
 Prints the specified attribute name to a stream.
virtual void printAttrValue (std::ostream &stream, size_t column, double value)
 Prints the specified value to a stream.
virtual bool isCompatible (GRelation &that)
 Returns true iff the attributes in both relations have the same names, the same number of values, and the names of those values all match. (Empty strings are considered to match everything.)
void addAttribute (const char *szName, size_t nValues, std::vector< const char * > *pValues)
 Adds a new attribute (column) to the relation.
virtual void copyAttr (GRelation *pThat, size_t nAttr)
 Adds a copy of the specified attribute to this relation.
const char * name ()
 Returns the name of the relation.
void setName (const char *szName)
 Sets the name of this relation.
const char * attrName (size_t nAttr)
 Returns the name of the specified attribute.
int addAttrValue (size_t nAttr, const char *szValue)
 Adds a new possible value to a nominal attribute. Returns the numerical form of the new value.
virtual void setAttrValueCount (size_t nAttr, size_t nValues)
 Sets the number of values for the specified attribute.
virtual void swapAttributes (size_t nAttr1, size_t nAttr2)
 Swaps two columns.
virtual void deleteAttribute (size_t nAttr)
 Deletes an attribute.
int findEnumeratedValue (size_t nAttr, const char *szValue)
 Returns the nominal index for the specified attribute with the given value.
double parseValue (size_t attr, const char *val)
 Parses a value.
void parseAttribute (GTokenizer &tok)
 Parses the meta-data for an attribute.

Protected Member Functions

void addAttributeInternal (const char *pName, size_t nameLen, size_t valueCount)
 takes ownership of ppValues

Protected Attributes

std::string m_name
std::vector< GArffAttributem_attrs

Friends

class GMatrix

Detailed Description

ARFF = Attribute-Relation File Format. This stores richer information than GRelation. This includes a name, a name for each attribute, and names for each supported nominal value.


Constructor & Destructor Documentation

GClasses::GArffRelation::GArffRelation ( )
virtual GClasses::GArffRelation::~GArffRelation ( ) [virtual]

Member Function Documentation

void GClasses::GArffRelation::addAttribute ( const char *  szName,
size_t  nValues,
std::vector< const char * > *  pValues 
)

Adds a new attribute (column) to the relation.

void GClasses::GArffRelation::addAttributeInternal ( const char *  pName,
size_t  nameLen,
size_t  valueCount 
) [protected]

takes ownership of ppValues

int GClasses::GArffRelation::addAttrValue ( size_t  nAttr,
const char *  szValue 
)

Adds a new possible value to a nominal attribute. Returns the numerical form of the new value.

const char* GClasses::GArffRelation::attrName ( size_t  nAttr)

Returns the name of the specified attribute.

virtual GRelation* GClasses::GArffRelation::clone ( ) [virtual]

Returns a deep copy of this object.

Reimplemented from GClasses::GMixedRelation.

virtual GRelation* GClasses::GArffRelation::cloneSub ( size_t  start,
size_t  count 
) [virtual]

Makes a deep copy of the specified subset of this relation.

Reimplemented from GClasses::GMixedRelation.

virtual void GClasses::GArffRelation::copyAttr ( GRelation pThat,
size_t  nAttr 
) [virtual]

Adds a copy of the specified attribute to this relation.

Reimplemented from GClasses::GMixedRelation.

virtual void GClasses::GArffRelation::deleteAttribute ( size_t  nAttr) [virtual]

Deletes an attribute.

Reimplemented from GClasses::GMixedRelation.

int GClasses::GArffRelation::findEnumeratedValue ( size_t  nAttr,
const char *  szValue 
)

Returns the nominal index for the specified attribute with the given value.

virtual void GClasses::GArffRelation::flush ( ) [virtual]

Deletes all the attributes.

Reimplemented from GClasses::GMixedRelation.

virtual bool GClasses::GArffRelation::isCompatible ( GRelation that) [virtual]

Returns true iff the attributes in both relations have the same names, the same number of values, and the names of those values all match. (Empty strings are considered to match everything.)

Reimplemented from GClasses::GRelation.

const char* GClasses::GArffRelation::name ( ) [inline]

Returns the name of the relation.

void GClasses::GArffRelation::parseAttribute ( GTokenizer tok)

Parses the meta-data for an attribute.

double GClasses::GArffRelation::parseValue ( size_t  attr,
const char *  val 
)

Parses a value.

virtual void GClasses::GArffRelation::printAttrName ( std::ostream &  stream,
size_t  column 
) [virtual]

Prints the specified attribute name to a stream.

Reimplemented from GClasses::GRelation.

virtual void GClasses::GArffRelation::printAttrValue ( std::ostream &  stream,
size_t  column,
double  value 
) [virtual]

Prints the specified value to a stream.

Reimplemented from GClasses::GRelation.

virtual void GClasses::GArffRelation::setAttrValueCount ( size_t  nAttr,
size_t  nValues 
) [virtual]

Sets the number of values for the specified attribute.

Reimplemented from GClasses::GMixedRelation.

void GClasses::GArffRelation::setName ( const char *  szName)

Sets the name of this relation.

virtual void GClasses::GArffRelation::swapAttributes ( size_t  nAttr1,
size_t  nAttr2 
) [virtual]

Swaps two columns.

Reimplemented from GClasses::GMixedRelation.

virtual RelationType GClasses::GArffRelation::type ( ) [inline, virtual]

Returns the type of relation.

Reimplemented from GClasses::GMixedRelation.


Friends And Related Function Documentation

friend class GMatrix [friend]

Member Data Documentation

std::string GClasses::GArffRelation::m_name [protected]