private Strategy getStrategy(ACLMessage msg, CuratorAgent agent, BidSettings bs) { int i = agent.getCuratorId(); if (bs.getStrategy() != 0) { i = bs.getStrategy(); } switch (i) { case 1: return new StrategyOne(msg, agent, bs); case 2: return new StrategyTwo(msg, agent, bs); case 3: return new StrategyThree(msg, agent, bs); case 4: return new StrategyFour(msg, agent, bs); default: return new StrategyOne(msg, agent, bs); } }
/** Looks at the message type and starts the appropriate handler */ @Override public void action() { ACLMessage msg = curator.receive(mt); if (msg != null) { String ontology = msg.getOntology(); if (ontology.equalsIgnoreCase(Ontologies.AUCTION_START)) { handleAuctionStart(msg); } else if (ontology.equalsIgnoreCase(Ontologies.CALL_FOR_PROPOSALS)) { handleCFP(msg); } else if (ontology.equalsIgnoreCase(Ontologies.AUCTION_NO_BIDS)) { handleAuctionNoBids(msg); } else if (ontology.equalsIgnoreCase(Ontologies.AUCTION_WON)) { handleAuctionWon(msg); } else if (msg.getPerformative() == ACLMessage.ACCEPT_PROPOSAL) { handleAcceptProposal(msg); } else if (msg.getPerformative() == ACLMessage.REJECT_PROPOSAL) { handleReject(msg); } } else { block(); } }