bool Score::BetterThan(const Score& another) const { if (this->_value == another.Value()) return false; if (this->_sign == ScoreSign::POSITIVE) return (this->_value > another.Value()); else return (this->_value < another.Value()); }
bool FilterCriteria::Satisfy(const DNALength& alnLength, const float& pctSimilarity, const float& pctAccuracy, const Score& score) const { if (alnLength < _minAlnLength) { if (_verbose > 0) std::cout << "Alignment length " << alnLength << " is too short." << std::endl; return false; } if (pctSimilarity < _minPctSimilarity) { if (_verbose > 0) std::cout << "Percentage similarity " << pctSimilarity << " is too low." << std::endl; return false; } if (pctAccuracy < _minPctAccuracy) { if (_verbose > 0) std::cout << "Percentage accuracy " << pctAccuracy << " is too low." << std::endl; return false; } if (_useScore and not score.BetterThanOrEqual(_scoreCutoff)) { if (_verbose) std::cout << "Alignment score " << score.Value() << " worse than cut off." << std::endl; return false; } return true; }
Bonus Skill::Melee::DamageBonus(const Score& skillScore) { if (damage.empty()) return Bonus(); auto index = skillScore.Value(); if (index == 0) return Bonus(); else if (index > damage.size()) return Bonus(skillScore.Description(), damage.back()); else return Bonus(skillScore.Description(), damage.at(index - 1)); }
Bonus Skill::GetChance(const Score& level) const { if (chance.empty()) return Bonus(100); else { auto index = level.Value(); if (index == 0) { return Bonus(); } else if (index > chance.size()) { return Bonus(level.Description(), chance.back()); } else { return Bonus(level.Description(), chance.at(index - 1)); } } }
bool Score::operator==(const Score& another) const { return (another.Value() - this->_value < errorunit and another.Value() - this->_value > -errorunit); }