#include "ArbitrationRound.h"
#include "Commit.h"
-ArbitrationRound::ArbitrationRound(Commit * _commit, Hashset<Abort *> * _abortsBefore) :
+ArbitrationRound::ArbitrationRound(Commit *_commit, Hashset<Abort *> *_abortsBefore) :
abortsBefore(_abortsBefore),
- parts(new Vector<Entry *>()),
- commit(_commit),
+ parts(new Vector<Entry *>()),
+ commit(_commit),
currentSize(0),
didSendPart(false),
didGenerateParts(false) {
-
- if (commit != NULL) {
- commit->createCommitParts();
- currentSize += commit->getNumberOfParts();
+
+ if (commit != NULL) {
+ commit->createCommitParts();
+ currentSize += commit->getNumberOfParts();
}
-
- currentSize += abortsBefore->size();
+
+ currentSize += abortsBefore->size();
}
-void ArbitrationRound::generateParts() {
- if (didGenerateParts) {
+/*
+ void ArbitrationRound::generateParts() {
+ if (didGenerateParts) {
return;
- }
- parts = new Vector<Entry>(abortsBefore);
- if (commit != NULL) {
+ }
+ parts = new Vector<Entry *>((Vector<Entry *> *)abortsBefore);
+ if (commit != NULL) {
parts->addAll(commit->getParts()->values());
- }
-}
+ }
+ }*/
-Vector<Entry *> * ArbitrationRound::getParts() {
- return parts;
+Vector<Entry *> *ArbitrationRound::getParts() {
+ return parts;
}
-void ArbitrationRound::removeParts(Vector<Entry *> * removeParts) {
- parts->removeAll(removeParts);
- didSendPart = true;
-}
+/*
+ void ArbitrationRound::removeParts(Vector<Entry *> * removeParts) {
+ parts->removeAll(removeParts);
+ didSendPart = true;
+ }
+ */
bool ArbitrationRound::isDoneSending() {
- if ((commit == NULL) && abortsBefore->isEmpty()) {
- return true;
- }
-
- return parts->isEmpty();
+ if ((commit == NULL) && abortsBefore->isEmpty()) {
+ return true;
+ }
+
+ return parts->isEmpty();
}
-Commit * ArbitrationRound::getCommit() {
- return commit;
+Commit *ArbitrationRound::getCommit() {
+ return commit;
}
-
-void ArbitrationRound::setCommit(Commit * _commit) {
- if (commit != NULL) {
- currentSize -= commit->getNumberOfParts();
- }
- commit = _commit;
-
- if (commit != NULL) {
- currentSize += commit->getNumberOfParts();
- }
+
+void ArbitrationRound::setCommit(Commit *_commit) {
+ if (commit != NULL) {
+ currentSize -= commit->getNumberOfParts();
+ }
+ commit = _commit;
+
+ if (commit != NULL) {
+ currentSize += commit->getNumberOfParts();
+ }
}
-void ArbitrationRound::addAbort(Abort * abort) {
- abortsBefore->add(abort);
- currentSize++;
+void ArbitrationRound::addAbort(Abort *abort) {
+ abortsBefore->add(abort);
+ currentSize++;
}
-
-void ArbitrationRound::addAborts(Hashset<Abort *> * aborts) {
- abortsBefore->addAll(aborts);
- currentSize += aborts->size();
+
+void ArbitrationRound::addAborts(Hashset<Abort *> *aborts) {
+ abortsBefore->addAll(aborts);
+ currentSize += aborts->size();
}
-
-Hashset<Abort *> * ArbitrationRound::getAborts() {
- return abortsBefore;
+
+Hashset<Abort *> *ArbitrationRound::getAborts() {
+ return abortsBefore;
}
int ArbitrationRound::getAbortsCount() {
- return abortsBefore->size();
+ return abortsBefore->size();
}
int ArbitrationRound::getCurrentSize() {
- return currentSize;
+ return currentSize;
}
bool ArbitrationRound::isFull() {
- return currentSize >= MAX_PARTS;
+ return currentSize >= MAX_PARTS;
}
-
+
bool ArbitrationRound::getDidSendPart() {
- return didSendPart;
+ return didSendPart;
}