// Return list of joined slices Coordinates joinedSlices() const { Coordinates slices0; bool prev_good = false; int max_i = block_length_ - frame_length_; for (int i = 0; i <= max_i; i++) { bool curr_good = goodSlice(i); if (curr_good) { if (prev_good) { // increase previous slice ASSERT_GT(slices0.size(), 0); slices0.back().second += 1; } else { // add new slice int stop = i + frame_length_ - 1; slices0.push_back(StartStop(i, stop)); } } prev_good = curr_good; } Coordinates slices; BOOST_FOREACH (const StartStop& slice, slices0) { StartStop slice1 = strip(slice); if (valid(slice1)) { slices.push_back(slice1); } }
StartStop exclude(const StartStop& self, const StartStop& other) const { int start1 = self.first; int stop1 = self.second; if (other.first <= self.first && self.first <= other.second) { start1 = other.second + 1; } if (other.first <= self.second && self.second <= other.second) { stop1 = other.first - 1; } return StartStop(start1, stop1); }
StartStop strip(const StartStop& self) const { if (!valid(self)) { return self; } int start1 = self.first; int stop1 = self.second; while (!goodLeftEnd(start1) && start1 + end_length_ - 1 < stop1) { start1 = start1 + 1; } while (!goodRightEnd(stop1) && start1 + end_length_ - 1 < stop1) { stop1 = stop1 - 1; } return StartStop(start1, stop1); }
//************************************************************************************************ void tGuiConnectConfirmReport::ExeCommand(QDataStream& _in) { bool ok=false; _in >> ok; if(!ok) { QMessageBox mb; mb.setText(QString::fromUtf8("В подключении отказано")); mb.setWindowTitle(QString::fromUtf8("Подключение")); mb.exec(); } emit StartStop(ok); }
void NoteList::addNote(const int startTick, const int endTick, const int staff) { if (staff >= 0 && staff < _staffNoteLists.size()) _staffNoteLists[staff] << StartStop(startTick, endTick); }
void StopwatchEngine::Stop() { StartStop(false); }
void StopwatchEngine::Start() { StartStop(true); }