Last change
on this file since 162 was 127, checked in by Wouter Pasman, 6 years ago |
#41 ROLL BACK of rev.126 . So this version is equal to rev. 125
|
File size:
1.4 KB
|
Rev | Line | |
---|
[127] | 1 | package negotiator.parties;
|
---|
| 2 |
|
---|
| 3 | import java.util.List;
|
---|
| 4 |
|
---|
| 5 | import genius.core.AgentID;
|
---|
| 6 | import genius.core.actions.Accept;
|
---|
| 7 | import genius.core.actions.Action;
|
---|
| 8 | import genius.core.actions.ActionWithBid;
|
---|
| 9 | import genius.core.parties.AbstractNegotiationParty;
|
---|
| 10 |
|
---|
| 11 | /**
|
---|
| 12 | * Agent that sleeps..
|
---|
| 13 | * <p/>
|
---|
| 14 | * The class was created as part of a series of agents used to understand the
|
---|
| 15 | * api better
|
---|
| 16 | *
|
---|
| 17 | * @author David Festen
|
---|
| 18 | */
|
---|
| 19 | public class TimeoutNegotiationParty extends AbstractNegotiationParty {
|
---|
| 20 |
|
---|
| 21 | /**
|
---|
| 22 | * If offer was proposed: Accept offer, otherwise: Propose random offer
|
---|
| 23 | *
|
---|
| 24 | * @param possibleActions
|
---|
| 25 | * List of all actions possible.
|
---|
| 26 | * @return Accept or Offer action
|
---|
| 27 | */
|
---|
| 28 | @Override
|
---|
| 29 | public Action chooseAction(final List<Class<? extends Action>> possibleActions) {
|
---|
| 30 |
|
---|
| 31 | try {
|
---|
| 32 | Thread.sleep(Long.MAX_VALUE);
|
---|
| 33 | } catch (InterruptedException e) {
|
---|
| 34 | // do nothing
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | return new Accept(getPartyId(), ((ActionWithBid) getLastReceivedAction()).getBid());
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | /**
|
---|
| 41 | * We ignore any messages received.
|
---|
| 42 | *
|
---|
| 43 | * @param sender
|
---|
| 44 | * The initiator of the action
|
---|
| 45 | * @param arguments
|
---|
| 46 | * The action performed
|
---|
| 47 | */
|
---|
| 48 | @Override
|
---|
| 49 | public void receiveMessage(final AgentID sender, final Action arguments) {
|
---|
| 50 | super.receiveMessage(sender, arguments);
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | @Override
|
---|
| 54 | public String getDescription() {
|
---|
| 55 | return "Sleeping Party";
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.