RID IndexScan::NoSearch(){ if(position.size() == 0) return RID(-1,-1); int num = position.back(); Node n; index_.getNode(current, n); RID res = n.n[num]; canDo = toRight(); return res; }
RID IndexScan::NeSearch(){ if(position.size() == 0) return RID(-1,-1); int num = position.back(); Node n; index_.getNode(current, n); RID res = n.n[num]; while(n.k[num] == value_){ canDo = toRight(); if(canDo) { num = position.back(); index_.getNode(current, n); res = n.n[num]; } else return RID(-1,-1); } canDo = toRight(); return res; }
void HTree::getSizeThings(QByteArray code) { my_fileCode = code; for(int i = 0; i < 24; i++){ if(i <= 2){ if(getBit(i)){ s_Trash += 0x1 << (2-i); } } else if(i <= 15){ if(getBit(i)){ s_Tree += 0x1 << (15-i); } } else{ if(getBit(i)){ s_Name += 0x1 << (23-i); } } } for(int i = 3; i < 3 + s_Name; i++){ my_fileName += (unsigned char)my_fileCode.at(i); } for(int i = 3 + s_Name; i < 3 + s_Name + s_Tree; i++){ my_treeCode.append((unsigned char)my_fileCode.at(i)); } my_fileCode.remove(0,3+s_Name+s_Tree); setRoot(rebuildTree(this->my_treeCode)); m_cursor = m_root; for(long long int i = 0; i < (long long int)((my_fileCode.size()*8) - s_Trash); i++){ if(getBit(i)){ toRight(); } else{ toLeft(); } if(m_cursor->isLeaf()){ my_finalOutPut += (unsigned char)m_cursor->content; m_cursor = m_root; } } }
bool LogicalChanger::roundEnemySearch( int bacterium_index, Abstract::Point* enemy ) const { int direction = model_->getDirection(team_, bacterium_index); Abstract::Point start = model_->getCoordinates( team_, bacterium_index ); // clockwise round magic int delta = 0; Abstract::Point center = start; for (int i = 0; i < 6; i++) { int steps; if ((i < 2) || (i == 5)) { steps = 1; } else { steps = 2; } Abstract::Point temp = start; bool found = nextCoordinates( direction, steps - delta, start, enemy ); bool error = (std::abs((start.x - center.x)) > 1) || (std::abs((start.y - center.y)) > 1); delta = ((error) ? 1 : 0); direction = ((error) ? direction : toRight(direction)); if (error) { i--; start = temp; } else if (found) { return true; } } return false; }
void LogicalChanger::right(int bacterium_index) { int direction = model_->getDirection(team_, bacterium_index); direction = toRight(direction); model_->setDirection(team_, bacterium_index, direction); }