1 #include "ArbitrationRound.h"
4 ArbitrationRound::ArbitrationRound(Commit *_commit, Hashset<Abort *> *_abortsBefore) :
5 abortsBefore(_abortsBefore),
6 parts(new Vector<Entry *>()),
10 didGenerateParts(false) {
13 commit->createCommitParts();
14 currentSize += commit->getNumberOfParts();
17 currentSize += abortsBefore->size();
20 ArbitrationRound::~ArbitrationRound() {
25 Vector<Entry *> *ArbitrationRound::getParts() {
29 bool ArbitrationRound::isDoneSending() {
30 if ((commit == NULL) && abortsBefore->isEmpty()) {
33 return parts->isEmpty();
36 Commit *ArbitrationRound::getCommit() {
40 void ArbitrationRound::setCommit(Commit *_commit) {
42 currentSize -= commit->getNumberOfParts();
47 currentSize += commit->getNumberOfParts();
51 void ArbitrationRound::addAbort(Abort *abort) {
52 abortsBefore->add(abort);
56 void ArbitrationRound::addAborts(Hashset<Abort *> *aborts) {
57 abortsBefore->addAll(aborts);
58 currentSize += aborts->size();
61 Hashset<Abort *> *ArbitrationRound::getAborts() {
65 int ArbitrationRound::getAbortsCount() {
66 return abortsBefore->size();
69 int ArbitrationRound::getCurrentSize() {
73 bool ArbitrationRound::isFull() {
74 return currentSize >= ArbitrationRound_MAX_PARTS;
77 bool ArbitrationRound::getDidSendPart() {