![]() |
KSquare Utilities
|
describes a single Feature, Type and possible values. More...
#include <Attribute.h>
Public Member Functions | |
| Attribute () | |
| Attribute (const KKStr &_name, AttributeType _type, kkint32 _fieldNum) | |
| Attribute (const Attribute &a) | |
| ~Attribute () | |
| void | AddANominalValue (const KKStr &nominalValue, bool &alreadyExists) |
| Adds a allowable Nominal value to the Nominal or Symbolic field that this attribute represents. More... | |
| kkint32 | Cardinality () const |
| Returns back the cardinality of the attribute; the number of possible values it can take. More... | |
| kkint32 | FieldNum () const |
| kkint32 | GetNominalCode (const KKStr &nominalValue) const |
| const KKStr & | GetNominalValue (kkint32 code) const |
| Returns the nominal value for the given ordinal value. More... | |
| kkint32 | MemoryConsumedEstimated () const |
| const KKStr & | Name () const |
| const KKStr & | NameUpper () const |
| bool | operator!= (const Attribute &rightSide) const |
| Attribute & | operator= (const Attribute &right) |
| bool | operator== (const Attribute &rightSide) const |
| void | ReadXML (XmlStream &s, XmlTagConstPtr tag, VolConstBool &cancelFlag, RunLog &log) |
| AttributeType | Type () const |
| KKStr | TypeStr () const |
| void | WriteXML (const KKStr &varName, std::ostream &o) const |
describes a single Feature, Type and possible values.
Used to support 'FileDesc', 'FeatureVector', and is derived classes classes. FileDesc will maintain a list of 'Attribute' objects to describe each separate field in a given FeatureFile. A given Feature can be one of several types, Numeric, Nominal, Ordinal, and Symbolic.
Definition at line 74 of file Attribute.h.
| Attribute::Attribute | ( | ) |
Definition at line 33 of file Attribute.cpp.
References KKB::KKStr::KKStr(), and KKMLL::NULLAttribute.
| Attribute::Attribute | ( | const KKStr & | _name, |
| AttributeType | _type, | ||
| kkint32 | _fieldNum | ||
| ) |
Definition at line 44 of file Attribute.cpp.
References KKB::KKStr::KKStr(), KKB::KKStrListIndexed::KKStrListIndexed(), KKMLL::Nominal, KKMLL::Symbolic, and KKB::KKStr::Upper().
| Attribute::Attribute | ( | const Attribute & | a | ) |
Definition at line 67 of file Attribute.cpp.
References KKB::KKStr::KKStr(), KKB::KKStrListIndexed::KKStrListIndexed(), KKMLL::Nominal, and KKMLL::Symbolic.
| Attribute::~Attribute | ( | ) |
Definition at line 86 of file Attribute.cpp.
| void Attribute::AddANominalValue | ( | const KKStr & | nominalValue, |
| bool & | alreadyExists | ||
| ) |
Adds a allowable Nominal value to the Nominal or Symbolic field that this attribute represents.
To only be used by instances of 'Attribute' that represent Nominal or Symbolic type attributes. If the Attribute type is not s 'Nominal' or 'Symbolic' then this method will throw am exception
| [in] | nominalValue | A possible value that this instance of 'Attribute' could represent. |
| [out] | alreadyExists | Indicates if this instance of 'Attribute' already contains a nominal value called 'nominalValue'. |
Definition at line 123 of file Attribute.cpp.
References KKB::KKStrListIndexed::Add(), KKB::KKStr::Concat(), GetNominalCode(), and KKB::KKStr::KKStr().
Referenced by KKMLL::FileDesc::AddANominalValue(), and KKMLL::FeatureFileIOC45::LoadFile().
| kkint32 Attribute::Cardinality | ( | ) | const |
Returns back the cardinality of the attribute; the number of possible values it can take.
Only attributes with type Nominal or Symbolic have a fixed number of possible values all others will return 999999999.
Definition at line 173 of file Attribute.cpp.
References KKMLL::Nominal, KKB::KKStrListIndexed::size(), and KKMLL::Symbolic.
Referenced by KKMLL::FileDesc::Cardinality(), KKMLL::FileDesc::DisplayAttributeMappings(), KKMLL::FeatureEncoder::FeatureEncoder(), and KKMLL::FeatureFileIOC45::SaveFile().
|
inline |
Definition at line 106 of file Attribute.h.
Referenced by KKMLL::FileDesc::GetFieldNumFromAttributeName().
Definition at line 185 of file Attribute.cpp.
References KKB::KKStrListIndexed::LookUp().
Referenced by AddANominalValue(), KKMLL::FileDesc::DisplayAttributeMappings(), KKMLL::FeatureFileIODstWeb::LoadFile(), KKMLL::FeatureFileIOC45::LoadFile(), and KKMLL::FileDesc::LookUpNominalCode().
Returns the nominal value for the given ordinal value.
For example: you could have a Attribute called DayOfTheWeek that would be type 'Nominal' where its possible values are "Sun", "Mon", "Tue", "Wed", "Thur", "Fri", and "Sat". In this case a call to this method where 'code' == 3 would return "Wed".
Definition at line 143 of file Attribute.cpp.
References KKB::KKStr::Concat(), KKB::KKStr::EmptyStr(), and KKB::KKStrListIndexed::LookUp().
Referenced by KKMLL::FileDesc::DisplayAttributeMappings(), KKMLL::FeatureEncoder::FeatureEncoder(), KKMLL::FeatureFileIORoberts::SaveFile(), and KKMLL::FeatureFileIOC45::SaveFile().
| kkint32 Attribute::MemoryConsumedEstimated | ( | ) | const |
Definition at line 92 of file Attribute.cpp.
References KKB::KKStr::MemoryConsumedEstimated(), and KKB::KKStrListIndexed::MemoryConsumedEstimated().
|
inline |
Definition at line 122 of file Attribute.h.
Referenced by KKMLL::FeatureEncoder::FeatureEncoder(), and KKMLL::FeatureFileIOC45::LoadFile().
|
inline |
Definition at line 125 of file Attribute.h.
| bool Attribute::operator!= | ( | const Attribute & | rightSide | ) | const |
Definition at line 213 of file Attribute.cpp.
References operator==().
Definition at line 222 of file Attribute.cpp.
References KKB::KKStrListIndexed::KKStrListIndexed(), and KKB::KKStr::operator=().
| bool Attribute::operator== | ( | const Attribute & | rightSide | ) | const |
Definition at line 194 of file Attribute.cpp.
References KKMLL::Nominal, KKB::KKStr::operator!=(), KKB::KKStrListIndexed::operator!=(), KKMLL::Symbolic, and Type().
Referenced by operator!=().
| void Attribute::ReadXML | ( | XmlStream & | s, |
| XmlTagConstPtr | tag, | ||
| VolConstBool & | cancelFlag, | ||
| RunLog & | log | ||
| ) |
Definition at line 283 of file Attribute.cpp.
References KKMLL::AttributeTypeFromStr(), KKB::XmlTag::AttributeValueInt32(), KKB::XmlTag::AttributeValueKKStr(), KKB::XmlStream::GetNextToken(), KKB::KKStr::operator=(), and KKB::KKStr::ToUpper().
|
inline |
Definition at line 133 of file Attribute.h.
Referenced by KKMLL::FileDesc::AddAAttribute(), KKMLL::FileDesc::Cardinality(), KKMLL::FileDesc::DisplayAttributeMappings(), KKMLL::FeatureEncoder::FeatureEncoder(), KKMLL::FeatureFileIOC45::LoadFile(), KKMLL::FileDesc::LookUpNominalCode(), operator==(), KKMLL::FeatureFileIORoberts::SaveFile(), and KKMLL::FeatureFileIOC45::SaveFile().
| KKStr Attribute::TypeStr | ( | ) | const |
Definition at line 241 of file Attribute.cpp.
References KKMLL::AttributeTypeToStr().
Referenced by WriteXML().
| void Attribute::WriteXML | ( | const KKStr & | varName, |
| std::ostream & | o | ||
| ) | const |
Definition at line 249 of file Attribute.cpp.
References KKB::XmlTag::AddAtribute(), KKB::KKStr::Empty(), KKMLL::EncodeProblem(), KKMLL::Nominal, KKMLL::Symbolic, KKB::XmlTag::tagEmpty, KKB::XmlTag::tagEnd, KKB::XmlTag::tagStart, TypeStr(), KKB::VectorKKStr::WriteXML(), KKB::XmlTag::WriteXML(), and KKB::XmlTag::XmlTag().
Referenced by KKMLL::AttributeList::WriteXML().