Rev | Line | |
---|
[269] | 1 | package onetomany.bargainingchipsgame.players;
|
---|
| 2 |
|
---|
| 3 | import java.util.concurrent.BlockingQueue;
|
---|
| 4 |
|
---|
| 5 | import onetomany.bargainingchipsgame.interactions.Offer;
|
---|
[283] | 6 | /**
|
---|
| 7 | * An agent has typically a buyer or seller role.
|
---|
| 8 | * An agent has a wish list (to buy or sell), which is a bundle, and a utility function for evaluating any proposal.
|
---|
| 9 | *
|
---|
| 10 | */
|
---|
[273] | 11 | public abstract class BilateralAgent implements Runnable
|
---|
[269] | 12 | {
|
---|
[273] | 13 | String name;
|
---|
[278] | 14 | // Messaging from and to the opponent
|
---|
| 15 | protected BlockingQueue<Offer> in;
|
---|
| 16 | protected BlockingQueue<Offer> out;
|
---|
[269] | 17 |
|
---|
[278] | 18 | protected abstract void receiveOffer(Offer bundle);
|
---|
[274] | 19 |
|
---|
| 20 | protected abstract Offer sendOffer();
|
---|
| 21 |
|
---|
| 22 | protected abstract Offer sendOpeningOffer();
|
---|
| 23 |
|
---|
[273] | 24 | public BilateralAgent(String name, BlockingQueue<Offer> in, BlockingQueue<Offer> out)
|
---|
[269] | 25 | {
|
---|
| 26 | super();
|
---|
[273] | 27 | this.name = name;
|
---|
[269] | 28 | this.in = in;
|
---|
[273] | 29 | this.out = out;
|
---|
[269] | 30 | }
|
---|
| 31 |
|
---|
[278] | 32 | @Override
|
---|
[274] | 33 | public String toString()
|
---|
| 34 | {
|
---|
| 35 | return name;
|
---|
| 36 | }
|
---|
| 37 |
|
---|
[269] | 38 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.