1
2 package hoplugins.transfers.vo;
3
4 import hoplugins.Commons;
5
6 import plugins.ISpieler;
7
8 import java.sql.Timestamp;
9
10
11 /***
12 * Value Object representing a player transfer.
13 *
14 * @author <a href=mailto:nethyperon@users.sourceforge.net>Boy van der Werf</a>
15 */
16 public class PlayerTransfer {
17
18
19 /*** Type to indicate a BUY transfer */
20 public static final int BUY = 1;
21
22 /*** Type to indicate a SELL transfer */
23 public static final int SELL = 2;
24
25 /*** Type to indicate a SELL transfer */
26 public static final int REBOUGHT = 0;
27
28
29
30 /*** Player info on tranfer date */
31 private ISpieler playerInfo;
32
33 /*** Name of the buyer team */
34 private String buyerName = "";
35
36 /*** Name of the transfered player */
37 private String playerName = "";
38
39 /*** Name of the seller team */
40 private String sellerName = "";
41
42 /*** Tranfer date */
43 private Timestamp date;
44
45 /*** Id of the buyer team */
46 private int buyerid = 0;
47
48 /*** Market value of the player at transfer date */
49 private int marketvalue = 0;
50
51 /*** Id of the transfered player */
52 private int playerId = 0;
53
54 /*** Transfer price */
55 private int price = 0;
56
57 /*** Season */
58 private int season;
59
60 /*** Id of the seller team */
61 private int sellerid = 0;
62
63 /*** Id of the transfer */
64 private int transferId = 0;
65
66 /*** TSI value of the player at transfer date */
67 private int tsi = 0;
68
69 /*** Transfer type */
70 private int type;
71
72 /*** Week */
73 private int week;
74
75
76
77 /***
78 * Creates an instance of PlayerTransfer representing a player transfer.
79 *
80 * @param transferid Id of the transfer
81 * @param playerid Id of the transferred player
82 */
83 public PlayerTransfer(int transferid, int playerid) {
84 this.transferId = transferid;
85 this.playerId = playerid;
86 }
87
88
89
90 /***
91 * Sets the name of the buyer team.
92 *
93 * @param name name of the buyer team
94 */
95 public final void setBuyerName(String name) {
96 this.buyerName = name;
97 }
98
99 /***
100 * Gets the name of the buyer team.
101 *
102 * @return Name of the buyer team
103 */
104 public final String getBuyerName() {
105 return buyerName;
106 }
107
108 /***
109 * Sets the id of the buyer team.
110 *
111 * @param id Id of the buyer team
112 */
113 public final void setBuyerid(int id) {
114 this.buyerid = id;
115
116 if (buyerid == Commons.getModel().getBasics().getTeamId()) {
117 if (sellerid != Commons.getModel().getBasics().getTeamId()) {
118 this.type = BUY;
119 } else {
120 this.type = REBOUGHT;
121 }
122 }
123 }
124
125 /***
126 * Gets the id of the buyer team.
127 *
128 * @return Id of the buyer team
129 */
130 public final int getBuyerid() {
131 return buyerid;
132 }
133
134 /***
135 * Sets the transfer date
136 *
137 * @param date Transfer date
138 */
139 public final void setDate(Timestamp date) {
140 this.date = date;
141 }
142
143 /***
144 * Gets the transfer date
145 *
146 * @return Transfer date
147 */
148 public final Timestamp getDate() {
149 return date;
150 }
151
152 /***
153 * Sets the market value of the player on transfer date.
154 *
155 * @param value Market value of the player on transfer date.
156 */
157 public final void setMarketvalue(int value) {
158 this.marketvalue = value;
159 }
160
161 /***
162 * Gets the market value of the player on transfer date.
163 *
164 * @return Market value of the player on transfer date.
165 */
166 public final int getMarketvalue() {
167 return marketvalue;
168 }
169
170 /***
171 * Gets the id of the transfered player.
172 *
173 * @return Id of the transfered player.
174 */
175 public final int getPlayerId() {
176 return playerId;
177 }
178
179 /***
180 * Sets the information about the player on transfer date.
181 *
182 * @param info Player information on transfer date.
183 */
184 public final void setPlayerInfo(ISpieler info) {
185 this.playerInfo = info;
186 }
187
188 /***
189 * Gets the information about the player on transfer date.
190 *
191 * @return Playerinformation if available. else <code>null</code>
192 */
193 public final ISpieler getPlayerInfo() {
194 return playerInfo;
195 }
196
197 /***
198 * Sets the name of the transfered player.
199 *
200 * @param name Name of the transfered player.
201 */
202 public final void setPlayerName(String name) {
203 this.playerName = name;
204 }
205
206 /***
207 * Gets the name of the transfered player.
208 *
209 * @return Name of the transfered player.
210 */
211 public final String getPlayerName() {
212 return playerName;
213 }
214
215 /***
216 * Sets the transfer price.
217 *
218 * @param price Transfer price.
219 */
220 public final void setPrice(int price) {
221 this.price = price;
222 }
223
224 /***
225 * Gets the tranfer price.
226 *
227 * @return Transfer price
228 */
229 public final int getPrice() {
230 return price;
231 }
232
233 /***
234 * Gets the season number.
235 *
236 * @param season number on transfer date
237 */
238 public final void setSeason(int season) {
239 this.season = season;
240 }
241
242 /***
243 * Gets the season number.
244 *
245 * @return Season number on transfer date
246 */
247 public final int getSeason() {
248 return season;
249 }
250
251 /***
252 * Sets the name of the seller team.
253 *
254 * @param name Name of the seller team.
255 */
256 public final void setSellerName(String name) {
257 this.sellerName = name;
258 }
259
260 /***
261 * Gets the name of the seller team.
262 *
263 * @return Name of the seller team.
264 */
265 public final String getSellerName() {
266 return sellerName;
267 }
268
269 /***
270 * Sets the id of the seller team.
271 *
272 * @param id Id of the seller team.
273 */
274 public final void setSellerid(int id) {
275 this.sellerid = id;
276
277 if (sellerid == Commons.getModel().getBasics().getTeamId()) {
278 if (buyerid != Commons.getModel().getBasics().getTeamId()) {
279 this.type = SELL;
280 } else {
281 this.type = REBOUGHT;
282 }
283 }
284 }
285
286 /***
287 * Gets the id of the seller team.
288 *
289 * @return Id of the seller team.
290 */
291 public final int getSellerid() {
292 return sellerid;
293 }
294
295 /***
296 * Gets the id of the transfer.
297 *
298 * @return Id of the transfer
299 */
300 public final int getTransferID() {
301 return transferId;
302 }
303
304 /***
305 * Sets the TSI value when player was tranfered.
306 *
307 * @param tsi TSI value on transfer date.
308 */
309 public final void setTsi(int tsi) {
310 this.tsi = tsi;
311 }
312
313 /***
314 * Gets the TSI value when player was tranfered.
315 *
316 * @return TSI value on transfer date
317 */
318 public final int getTsi() {
319 return tsi;
320 }
321
322 /***
323 * Gets the transfer type.
324 *
325 * @return Type
326 */
327 public final int getType() {
328 return type;
329 }
330
331 /***
332 * Gets the week number.
333 *
334 * @param week number on transfer date
335 */
336 public final void setWeek(int week) {
337 this.week = week;
338 }
339
340 /***
341 * Gets the week number.
342 *
343 * @return Week number on transfer date
344 */
345 public final int getWeek() {
346 return week;
347 }
348 }