1 | /**
|
---|
2 | * Negotiator class
|
---|
3 | */
|
---|
4 | package onetomany.bargainingchipsgame.players;
|
---|
5 |
|
---|
6 | import onetomany.bargainingchipsgame.Bundle;
|
---|
7 | import onetomany.bargainingchipsgame.players.utilityfunction.Utility_Function;
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * A negotiator agent has typically a buyer or seller role.
|
---|
11 | * An agent has a wish list (to buy or sell), which is a bundle, and a utility function for evaluating any proposal.
|
---|
12 | *
|
---|
13 | * Negotiator class has a wishlist, deadline, picture, and (implements) a utility function.
|
---|
14 | *
|
---|
15 | *
|
---|
16 | * @author Faria Nassiri-Mofakham
|
---|
17 | *
|
---|
18 | */
|
---|
19 | public class Agent
|
---|
20 | {
|
---|
21 | private String name;
|
---|
22 | private Bundle wishlist;
|
---|
23 | private Utility_Function utility;
|
---|
24 | private String picture;
|
---|
25 | private long deadline;
|
---|
26 |
|
---|
27 |
|
---|
28 | public Agent()
|
---|
29 | {
|
---|
30 | setName(null);
|
---|
31 | setWishlist(null);
|
---|
32 | setUtility(null);
|
---|
33 | setDeadline(0);
|
---|
34 | setPicture(null);
|
---|
35 | }
|
---|
36 |
|
---|
37 | public Agent(String n, Bundle w, Utility_Function u, long d, String p)
|
---|
38 | {
|
---|
39 | setName(n);
|
---|
40 | setWishlist(w);
|
---|
41 | setUtility(u);
|
---|
42 | setDeadline(d);
|
---|
43 | setPicture(p);
|
---|
44 | }
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * @return the wishlist
|
---|
48 | */
|
---|
49 | public Bundle getWishlist() {
|
---|
50 | return wishlist;
|
---|
51 | }
|
---|
52 | /**
|
---|
53 | * @param wishlist the wishlist to set
|
---|
54 | */
|
---|
55 | public void setWishlist(Bundle wishlist) {
|
---|
56 | this.wishlist = wishlist;
|
---|
57 | }
|
---|
58 | /**
|
---|
59 | * @return the name
|
---|
60 | */
|
---|
61 | public String getName() {
|
---|
62 | return name;
|
---|
63 | }
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * @param name the name to set
|
---|
67 | */
|
---|
68 | public void setName(String name) {
|
---|
69 | this.name = name;
|
---|
70 | }
|
---|
71 |
|
---|
72 | /**
|
---|
73 | * @return the utility
|
---|
74 | */
|
---|
75 | public Utility_Function getUtility() {
|
---|
76 | return utility;
|
---|
77 | }
|
---|
78 | /**
|
---|
79 | * @param u the utility to set
|
---|
80 | */
|
---|
81 | public void setUtility(Utility_Function u) {
|
---|
82 | this.utility = u;
|
---|
83 | }
|
---|
84 | /**
|
---|
85 | * @return the picture
|
---|
86 | */
|
---|
87 | public String getPicture() {
|
---|
88 | return picture;
|
---|
89 | }
|
---|
90 | /**
|
---|
91 | * @param picture the picture to set
|
---|
92 | */
|
---|
93 | public void setPicture(String picture) {
|
---|
94 | this.picture = picture;
|
---|
95 | }
|
---|
96 | /**
|
---|
97 | * @return the deadline
|
---|
98 | */
|
---|
99 | public long getDeadline() {
|
---|
100 | return deadline;
|
---|
101 | }
|
---|
102 | /**
|
---|
103 | * @param deadline the deadline to set
|
---|
104 | */
|
---|
105 | public void setDeadline(long deadline) {
|
---|
106 | this.deadline = deadline;
|
---|
107 | }
|
---|
108 |
|
---|
109 | @Override
|
---|
110 | public String toString()
|
---|
111 | {
|
---|
112 | return this.getClass().getSimpleName()+" (name:"+name+", wishlist:"+this.wishlist+", "+this.utility+", deadline:"+deadline+", picture:"+picture+")";
|
---|
113 | }
|
---|
114 | }
|
---|