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 void ArbitrationRound::generateParts() {
21 if (didGenerateParts) {
24 parts = new Vector<Entry>(abortsBefore);
26 parts->addAll(commit->getParts()->values());
30 List<Entry *> * ArbitrationRound::getParts() {
34 void ArbitrationRound::removeParts(List<Entry *> * removeParts) {
35 parts->removeAll(removeParts);
39 bool ArbitrationRound::isDoneSending() {
40 if ((commit == NULL) && abortsBefore->isEmpty()) {
44 return parts->isEmpty();
47 Commit * ArbitrationRound::getCommit() {
51 void ArbitrationRound::setCommit(Commit * _commit) {
53 currentSize -= commit->getNumberOfParts();
58 currentSize += commit->getNumberOfParts();
62 void ArbitrationRound::addAbort(Abort * abort) {
63 abortsBefore->add(abort);
67 void ArbitrationRound::addAborts(Hashset<Abort *> * aborts) {
68 abortsBefore->addAll(aborts);
69 currentSize += aborts->size();
72 Hashset<Abort *> * ArbitrationRound::getAborts() {
76 int ArbitrationRound::getAbortsCount() {
77 return abortsBefore->size();
80 int ArbitrationRound::getCurrentSize() {
84 bool ArbitrationRound::isFull() {
85 return currentSize >= MAX_PARTS;
88 bool ArbitrationRound::getDidSendPart() {