本文整理汇总了C++中Split::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Split::begin方法的具体用法?C++ Split::begin怎么用?C++ Split::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Split
的用法示例。
在下文中一共展示了Split::begin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: subsetOf
bool Split::subsetOf (Split &sp) {
assert(ntaxa == sp.ntaxa);
for (iterator it = begin(), it2 = sp.begin(); it != end(); it++, it2++)
if ( ((*it) & (*it2)) != (*it) )
return false;
return true;
}
示例2:
bool Split::operator==(const Split &sp) const{
if (ntaxa != sp.ntaxa) return false;
for (const_iterator it = begin(), it2 = sp.begin(); it != end(); it++, it2++)
if ((*it) != (*it2))
return false;
return true;
}
示例3: overlap
bool Split::overlap(Split &sp) {
assert(ntaxa == sp.ntaxa);
iterator it, it2;
for (it = begin(), it2 = sp.begin(); it != end(); it++, it2++)
if ((*it) & (*it2)) return true;
return false;
}
示例4: preserved
/**
@param taxa_set set of taxa
@return true if this split is preserved in the set taxa_set
*/
bool Split::preserved(Split &taxa_set)
{
// be sure that the two split has the same size
assert(taxa_set.size() == size() && taxa_set.ntaxa == ntaxa);
int time_zero = 0, time_notzero = 0;
for (iterator it = begin(), sit = taxa_set.begin(); it != end(); it++, sit++)
{
UINT res = (*it) & (*sit);
if (res != 0 && res != (*sit))
return true;
if (*sit != 0) {
if (res == 0) time_zero++; else time_notzero++;
if (res == 0 && time_notzero > 0) return true;
if (res != 0 && time_zero > 0) return true;
}
}
return false;
}
示例5: compatible
/**
@param sp the other split
@return true if this split is compatible with sp
*/
bool Split::compatible(Split &sp)
{
// be sure that the two split has the same size
assert(sp.size() == size() && sp.ntaxa == ntaxa);
UINT res = 0, res2 = 0, res3 = 0, res4 = 0;
for (iterator it = begin(), sit = sp.begin(); it != end(); it++, sit++)
{
int num_bits = (it+1 == end()) ? ntaxa % UINT_BITS : UINT_BITS;
UINT it2 = (1 << (num_bits-1)) - 1 + (1 << (num_bits-1)) - (*it);
UINT sit2 = (1 << (num_bits-1)) - 1 + (1 << (num_bits-1)) - (*sit);
res |= (*it) & (*sit);
res2 |= (it2) & (sit2);
res3 |= (*it) & (sit2);
res4 |= (it2) & (*sit);
if (res != 0 && res2 != 0 && res3 != 0 && res4 != 0)
return false;
//if (res != 0 && res != (*it) && res != (*sit) && res2 != 0)
//return false;
}
return true;
//return (res == 0) || (res2 == 0) || (res3 == 0) || (res4 == 0);
}