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