Skip to content
Snippets Groups Projects
Commit 14364d3a authored by Nathan Wijnberg's avatar Nathan Wijnberg
Browse files

Removed unused functions, @override's and more, so that the code is a lot cleaner.

parent 6237b9fb
Branches sub-task/ASDCBA-000-merge-poc-coordinator
4 merge requests!111Release candidate to main,!102MR/final development into release-candidate,!100MR/ Raft to Development,!23MR/merge poc coordinator
Pipeline #6516 passed with stages
in 2 minutes and 10 seconds
......@@ -13,18 +13,5 @@ public interface IAgentManager {
void setupCoordinator(AuctionDTO auctionDTO);
void addSubscriber(IPeer subscriber, LotDTO lotDTO);
void receiveOffer(OfferDTO offer);
void startNewAuction(int roundTotalAmount, long roundDuration);
void addSubscriberToAuction(UUID auctionId, String subscriber);
void removeSubscriberFromAuction(UUID auctionId, String subscriber);
void runLot(UUID auctionId);
void addOfferToAuction(OfferDTO offer);
List<ICoordinatorAgent> getCoordinators();
}
......@@ -15,14 +15,12 @@ public class AgentManager implements IAgentManager {
private final List<ICoordinatorAgent> coordinators = new ArrayList<>();
@Override
public void startNewAuction(int roundTotalAmount, long roundDuration){
ICoordinatorAgent newCoordinator = new CoordinatorAgent(roundTotalAmount, roundDuration);
coordinators.add(newCoordinator);
}
@Override
public void addSubscriberToAuction(UUID auctionId, String subscriber){
for (ICoordinatorAgent coordinator : coordinators) {
if(coordinator.getAuctionId().equals(auctionId)){
......@@ -31,7 +29,6 @@ public class AgentManager implements IAgentManager {
}
}
@Override
public void removeSubscriberFromAuction(UUID auctionId, String subscriber){
for (ICoordinatorAgent coordinator : coordinators) {
if(coordinator.getAuctionId().equals(auctionId) && coordinator.getSubscribers().contains(subscriber)){
......@@ -40,16 +37,14 @@ public class AgentManager implements IAgentManager {
}
}
@Override
public void runLot(UUID auctionId){
for (ICoordinatorAgent coordinator : coordinators) {
if (coordinator.getAuctionId().equals(auctionId)) {
coordinator.runLot();
coordinator.runLot(auctionId);
}
}
}
@Override
public void addOfferToAuction(OfferDTO offer){
for (ICoordinatorAgent coordinator : coordinators) {
if (coordinator.getAuctionId().equals(offer.getLotid())) {
......@@ -58,7 +53,6 @@ public class AgentManager implements IAgentManager {
}
}
@Override
public List<ICoordinatorAgent> getCoordinators() {
return coordinators;
}
......
......@@ -17,7 +17,7 @@ public interface ICoordinatorAgent {
/**
* Starts up the thread for a lot.
*/
void runLot();
void runLot(UUID auctionId);
/**
* @param newOffer {@link OfferDTO} is the offer that has been sent to the coordinator.
......
......@@ -46,7 +46,7 @@ public class CoordinatorAgent implements ICoordinatorAgent {
* Starts up the thread for a lot.
*/
@Override
public void runLot(){
public void runLot(UUID auctionId){
thread = new Thread(() -> {
try {
coordinate();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment