本文整理汇总了C++中Part::getPartCategory方法的典型用法代码示例。如果您正苦于以下问题:C++ Part::getPartCategory方法的具体用法?C++ Part::getPartCategory怎么用?C++ Part::getPartCategory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Part
的用法示例。
在下文中一共展示了Part::getPartCategory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: match
bool Chain::match (
const Chain* c,
vector<cMatchType>& xyz
) const
{
//
// find parts of non-substituent type
//
vector<markType> ns_t;
vector<cMatchType> asmb;
bool start = true;
int numParts = c->listOfParts.size ();
for (int cnt =0; cnt < listOfParts.size (); cnt++)
{
Part* p = listOfParts[cnt];
string ctg = p->getPartCategory ();
if (ctg != "substituent")
{
if (start)
{
ns_t.push_back (make_pair (cnt, 0));
start = false;
}
}
else
{
ns_t.back ().second = cnt-1;
start = true;
}
}
if (ns_t.size () > 0)
{
vector< markType >* m_pos =
new vector< markType > [ns_t.size ()];
//
// for each non-substituent part, find its possible
// matching points in this chain
//
int permAll = 0;
for (int cnt =0; cnt < ns_t.size (); cnt++)
{
int start = ns_t[cnt].first;
int end = ns_t[cnt].second;
int diff = end-start;
Part* ps = listOfParts[start];
Part* pe = listOfParts[end];
string mkey = genUnicode (ps, pe);
for (string::size_type pos = 0;
(pos = unicode.find_first_of (mkey, pos))
!= string::npos; pos++)
{
int spos = count (unicode.begin (), unicode.begin ()+pos, ']');
int epos = spos + diff;
m_pos[cnt].push_back (make_pair (spos, epos));
}
if (m_pos[cnt].size () == 0)
{
delete [] m_pos;
return 0;
}
else permAll *= m_pos[cnt].size ();
}
//
// find possible matching combinations
//
for (int i =0; i < permAll; i++)
{
int lastp = -1;
cMatchType tmp;
int divide = i;
for (int j=0; j< ns_t.size (); j++)
{
markType p = m_pos[j][divide % m_pos[j].size ()];
if (p.first <= lastp)
{
tmp.clear ();
break;
}
else
{
lastp = p.second;
tmp.push_back (p);
}
divide /= m_pos[j].size ();
}
assert (tmp.size () == ns_t.size ());
if (!tmp.empty ()) asmb.push_back (tmp);
}
//.........这里部分代码省略.........