string SearchManager::getPartsString(const PartsInfo& partsInfo) const {
        string ret;

        for(PartsInfo::const_iterator i = partsInfo.begin(); i < partsInfo.end(); i+=2){
                ret += Util::toString(*i) + "," + Util::toString(*(i+1)) + ",";
        }

        return ret.substr(0, ret.size()-1);
}
bool QueueItem::isNeededPart(const PartsInfo& partsInfo, int64_t blockSize)
{
	dcassert(partsInfo.size() % 2 == 0);
	
	SegmentConstIter i  = done.begin();
	for(PartsInfo::const_iterator j = partsInfo.begin(); j != partsInfo.end(); j+=2){
		while(i != done.end() && (*i).getEnd() <= (*j) * blockSize)
			i++;

		if(i == done.end() || !((*i).getStart() <= (*j) * blockSize && (*i).getEnd() >= (*(j+1)) * blockSize))
			return true;
	}
	
	return false;

}