void TrieNode::addItemPiece(CatItem it, Tuple tpl, QString pieceName, int position, bool is_description){ int charChanges = MIN((log(it.getFullWeight())-1), KEY_SKIP_SWITCH_LIMIT-1); ItemRep ir(it, tpl, charChanges, position, is_description); ir.setName(pieceName); insertRep(ir); }
ItemRep::ItemRep(CatItem it, Tuple internalId, int change_count, short nthPiece, bool nameFromDescript){ Q_ASSERT(!it.isEmpty()); matchType = it.getMatchType(); matchIndex = it.getMatchIndex(); //description = it.fullDescription; m_internalId = internalId; m_name = it.getName(); Q_ASSERT(!m_name.isEmpty()); //Q_ASSERT(it.getFullWeight()); totalWeight = it.getFullWeight(); change_cn = change_count; l_to_match = -1; skip_m = false; this->itemType = it.getItemType(); //change_cn = 0; m_nthPiece= nthPiece; m_name_from_description=nameFromDescript; }
bool WeightLess (CatItem & a, CatItem & b) { return (a.getFullWeight() > b.getFullWeight()); }