currentSize += abortsBefore->size();
}
-/*
- void ArbitrationRound::generateParts() {
- if (didGenerateParts) {
- return;
- }
- parts = new Vector<Entry *>((Vector<Entry *> *)abortsBefore);
- if (commit != NULL) {
- parts->addAll(commit->getParts()->values());
- }
- }*/
+ArbitrationRound::~ArbitrationRound() {
+ delete abortsBefore;
+ delete parts;
+}
+
+void ArbitrationRound::generateParts() {
+ if (didGenerateParts) {
+ return;
+ }
+ parts = new Vector<Entry *>();
+ SetIterator<Abort *, Abort *> *abit = abortsBefore->iterator();
+ while (abit->hasNext())
+ parts->add((Entry *)abit->next());
+ delete abit;
+ if (commit != NULL) {
+ Vector<CommitPart *> *cParts = commit->getParts();
+ uint cPartsSize = cParts->size();
+ for (uint i = 0; i < cPartsSize; i++) {
+ parts->add((Entry *)cParts->get(i));
+ }
+ }
+}
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();
}
}
bool ArbitrationRound::isFull() {
- return currentSize >= MAX_PARTS;
+ return currentSize >= ArbitrationRound_MAX_PARTS;
}
bool ArbitrationRound::getDidSendPart() {
return didSendPart;
}
-