void TmpPostingStream::write(const Posting &posting, double score) { // cout << "tmp: " << baseDocID << endl; posting.writeTo(fp, score, baseDocID); baseDocID = posting.getDocID(); end = ftell(fp); df ++; }
void PostingStream::write(const Posting &posting, double score) { assert (score == 0); posting.writeTo(out, baseDocID); baseDocID = posting.getDocID(); end = out.tellp(); df ++; }
void History::add_posting(const Posting &post) { if(post.date() <= today && post.accounted()) { unsigned int i; for(i = 0; i < _history.size(); i++) { if(_history[i].date() >= post.date())break; } _history.insert(_history.begin() + i,post); _current_state += post.amount(); }else { if(post.accounted()) { std::cerr << "In what universe can a not-yet-passed posting be accounted for?\n" << "I will proceed, but you might want to look at this one:\n" << post << std::endl; } unsigned int i; for(i = 0; i < _in_waiting.size(); i++) { if(_in_waiting[i].date() >= post.date())break; } _in_waiting.insert(_in_waiting.begin() + i,post); } //whatever happens, it adds here _expected_state += post.amount(); }
string PostingStream::info() { size_t current = this->current; size_t baseDocID = this->baseDocID; this->current = begin; this->baseDocID = 0; string res = "["; while ( hasNext() ) { Posting posting = next(); res += to_string(posting.getDocID()); res += ":"; res += to_string(posting.size() - sizeof(posting.getDocID())); res += ";"; } this->current = current; this->baseDocID = baseDocID; if ( res[res.length() - 1] == ';' ) res.erase(res.length() - 1); res += "]"; return res; }
void MainWindow::submit(){ Posting *post = new Posting(); post->name() = ui->lineEdit_name->text(); post->sum() = ui->doubleSpinBox_summe->value(); post->categorie() = ui->comboBox_categorie->itemData(ui->comboBox_categorie->currentIndex()).toInt(); post->earning() = ui->comboBox_art->currentIndex(); post->discription() = ui->textEdit_discription->toPlainText(); post->date() = ui->dateTimeEdit->dateTime(); m_database->sendBuchungsQuerry(post); ui->lineEdit_name->clear(); ui->textEdit_discription->clear(); ui->doubleSpinBox_summe->clear(); }
bool Posting::operator>(const Posting& p) const { return _doc > p.getDoc(); }
bool Posting::operator==(const Posting& p) const { return _doc == p.getDoc(); }
bool compareResults(const Posting& left, const Posting& right) { return left.getDegree() > right.getDegree(); }