1 #include"ArbitrationRound.h"
3 ArbitrationRound::ArbitrationRound(Commit * _commit, Set<Abort *> * _abortsBefore) {
4 parts = new ArrayList<Entry>();
6 abortsBefore = _abortsBefore;
9 commit.createCommitParts();
10 currentSize += commit.getNumberOfParts();
13 currentSize += abortsBefore.size();
16 void ArbitrationRound::generateParts() {
17 if (didGenerateParts) {
20 parts = new ArrayList<Entry>(abortsBefore);
22 parts.addAll(commit.getParts().values());
26 List<Entry *> * ArbitrationRound::getParts() {
30 void ArbitrationRound::removeParts(List<Entry *> * removeParts) {
31 parts.removeAll(removeParts);
35 bool ArbitrationRound::isDoneSending() {
36 if ((commit == NULL) && abortsBefore.isEmpty()) {
40 return parts.isEmpty();
43 Commit * ArbitrationRound::getCommit() {
47 void ArbitrationRound::setCommit(Commit * _commit) {
49 currentSize -= commit.getNumberOfParts();
54 currentSize += commit.getNumberOfParts();
58 void ArbitrationRound::addAbort(Abort * abort) {
59 abortsBefore.add(abort);
63 void ArbitrationRound::addAborts(Set<Abort *> * aborts) {
64 abortsBefore.addAll(aborts);
65 currentSize += aborts.size();
68 Set<Abort> ArbitrationRound::getAborts() {
72 int ArbitrationRound::getAbortsCount() {
73 return abortsBefore.size();
76 int ArbitrationRound::getCurrentSize() {
80 bool ArbitrationRound::isFull() {
81 return currentSize >= MAX_PARTS;
84 bool ArbitrationRound::didSendPart() {