Test::TestGroup* Test::TestGroup::getNextTest(TestGroup* current) { current = getNextLeaf(current); while (current && !current->isTest()) current = getNextLeaf(current); return current; }
int VarTree::getIndex( const Iterator& item ) { int index = 0; Iterator it; for( it = m_flat ? firstLeaf() : m_children.begin(); it != m_children.end(); it = m_flat ? getNextLeaf( it ) : getNextVisibleItem( it ) ) { if( it == item ) break; index++; } return (it == item) ? index : -1; }
Test::TestGroup* Test::TestGroup::getNextLeaf(TestGroup* current) { PX_ASSERT(current); if (current == this) return NULL; TestGroup* parent = current->getParent(); if (!parent) return NULL; TestGroup* nextSibling = parent->getNextChild(*current); if (nextSibling) return nextSibling->getFirstLeaf(); else return getNextLeaf(parent); }
void SynopsisMD2::mark_used(vector<int> low,vector<int> high) { vector<history> hist; struct nodeMD res = navigate(low,hist); while( !greater(res.low,high)) { /* cout<<"marking used leafie:"; cout<<res.low[0]<<","<<res.low[1]<<endl; cout<<res.high[0]<<","<<res.high[1]<<endl; */ if(overlap(res.low,res.high,low,high)) { /* every leaf involved in answering the query */ incrementUsed(res.lvl,res.leaf_idx); } if(qcompare(res.high,high) == EQUAL) //we don't need to mark any more leaves, we did it :D return; vector<int> next = getNextLeaf(hist,res.high,high); hist.clear(); res = navigate(next,hist); if(next[0] == REACHED_END) break; /* cout<<"next leafie:"; cout<<res.low[0]<<","<<res.low[1]<<endl; cout<<res.high[0]<<","<<res.high[1]<<endl;*/ //blargh } //end of {while still have leaves in range to mark as used} }
VarTree::Iterator VarTree::firstLeaf() { Iterator b = root()->m_children.begin(); if( b->size() ) return getNextLeaf( b ); return b; }