Last change
on this file since 290 was 287, checked in by Tim Baarslag, 5 years ago |
Major refactor of Agent design
|
File size:
923 bytes
|
Line | |
---|
1 | package onetomany.bargainingchipsgame.players;
|
---|
2 |
|
---|
3 | import java.util.concurrent.BlockingQueue;
|
---|
4 |
|
---|
5 | import onetomany.bargainingchipsgame.interactions.Offer;
|
---|
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 | */
|
---|
11 | public abstract class BilateralAgent implements Runnable
|
---|
12 | {
|
---|
13 | String name;
|
---|
14 | // Messaging from and to the opponent
|
---|
15 | protected BlockingQueue<Offer> in;
|
---|
16 | protected BlockingQueue<Offer> out;
|
---|
17 |
|
---|
18 | protected abstract void receiveOffer(Offer bundle);
|
---|
19 |
|
---|
20 | protected abstract Offer sendOffer();
|
---|
21 |
|
---|
22 | protected abstract Offer sendOpeningOffer();
|
---|
23 |
|
---|
24 | public BilateralAgent(String name, BlockingQueue<Offer> in, BlockingQueue<Offer> out)
|
---|
25 | {
|
---|
26 | super();
|
---|
27 | this.name = name;
|
---|
28 | this.in = in;
|
---|
29 | this.out = out;
|
---|
30 | }
|
---|
31 |
|
---|
32 | @Override
|
---|
33 | public String toString()
|
---|
34 | {
|
---|
35 | return name;
|
---|
36 | }
|
---|
37 |
|
---|
38 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.