本文整理汇总了C++中Row::addNode方法的典型用法代码示例。如果您正苦于以下问题:C++ Row::addNode方法的具体用法?C++ Row::addNode怎么用?C++ Row::addNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Row
的用法示例。
在下文中一共展示了Row::addNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
const std::vector<Row>& CsvGenerator::generate(int nbRowGenerate) {
this->_rows.clear();
std::vector<Category> categories = this->normalizeCategories();
for (int y = 0; y < nbRowGenerate; ++y) {
Row newRow;
int x = 0;
std::vector<Category>::iterator current_category = categories.begin();
while (current_category != categories.end()) {
Node newNode;
const std::pair<std::string, float> value =
current_category->getRandomValue();
if (current_category->isMaximazed())
newNode.setParams(value.first, value.second,
std::pair<int, int>(x, y));
else
newNode.setParams(value.first,
current_category->maxNodeWeight() - value.second,
std::pair<int, int>(x, y));
current_category->addNode(newNode);
newRow.addNode(newNode);
current_category++;
}
this->_rows.push_back(newRow.normalize());
}
return this->_rows;
}
示例2: isControlate
bool CsvGenerator::isControlate(const std::vector<std::string>& values) {
std::vector<Category> categories = this->normalizeCategories();
std::vector<Category>::const_iterator begin_categories = categories.begin();
std::vector<Category>::const_iterator end_categories = categories.end();
Row newRow;
unsigned int i = 0;
while (begin_categories != end_categories && i < values.size())
{
std::string name = values[i];
float weight = begin_categories->findWeightByNameValue(name);
Node new_node(name, weight, i, 0);
newRow.addNode(new_node);
i++;
begin_categories++;
}
newRow = newRow.normalize();
CalcPondarateRow pondarateAlgo(categories, this->_controleValue);
pondarateAlgo.operator()(newRow);
if ( pondarateAlgo.getTotal() > this->_controleValue)
return false;
return true;
}