KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > poker > business > PokerGameImpl


1 package poker.business;
2
3 import poker.data.user.*;
4 import poker.data.game.*;
5 import java.util.Vector JavaDoc;
6 import poker.spec.user.PlayerDO;
7 import poker.spec.*;
8
9 /**
10  *
11  * EnhyDraw!, beta 4, 5/21/99
12  *
13  * Copyright 1999, Larry Wolcot & Daryl Tempesta
14  * ALL rights reserved. Not for commercial use
15  * without written permission from both authors.
16  *
17  * This is the business object that encapsulates the
18  * PlayerDO and PokerGameDO objects.
19  * It really doesn't do much other than that!
20  */

21 public class PokerGameImpl implements PokerGame,java.io.Serializable JavaDoc {
22
23     private boolean isDirty = false;
24     private PokerGameDO pokerGameDO;
25     private PlayerDO playerDO;
26
27     /*
28      * Constructor that inits the DO's
29      */

30     public PokerGameImpl(){};
31     
32     public PokerGameImpl(String JavaDoc name,String JavaDoc pw,String JavaDoc id,int cash){
33         playerDO = new PlayerDOImpl(name, pw);
34         pokerGameDO = new PokerGameDO(id, cash);
35     }
36
37     /*
38      * Return the PokerGameDO for this object
39      */

40     public PokerGameDO getPokerGameDO(){
41         return pokerGameDO;
42     }
43
44     /*
45      * return the name from the PlayerDO
46      */

47     public String JavaDoc getName(){
48         return playerDO.getName();
49     }
50
51     /*
52      * Check to see if this DO has been changed
53      */

54     public boolean getIsDirty(){
55       return this.isDirty;
56     }
57
58     /*
59      * return the email from the PlayerDO
60      */

61     public String JavaDoc getEmail(){
62         return playerDO.getEmail();
63     }
64
65     /*
66      * return the password from the PlayerDO
67      */

68     public String JavaDoc getPassword(){
69         return playerDO.getPassword();
70     }
71
72     /*
73      * return the cash from the pokerGameDO
74      */

75     public int getCash(){
76         return pokerGameDO.getCash();
77     }
78
79     /*
80      * return the getPlayRound from the pokerGameDO
81      */

82     public int getPlayRound(){
83         return pokerGameDO.getPlayRound();
84     }
85
86
87     /*
88      * return the getID from the pokerGameDO
89      */

90     public String JavaDoc getID(){
91         return pokerGameDO.getID();
92     }
93
94     /*
95      * return the current Bet from the pokerGameDO
96      */

97     public int getBet(){
98         return pokerGameDO.getBet();
99     }
100
101     /*
102      * return the current version from the pokerGameDO
103      */

104     public int getVersion(){
105         return pokerGameDO.getVersion();
106     }
107
108     /*
109      * return the largest bet from the pokerGameDO
110      */

111     public int getLargestBet(){
112         return pokerGameDO.getLargestBet();
113     }
114
115     /*
116      * return the smallest bet from the pokerGameDO
117      */

118     public int getSmallestBet(){
119         return pokerGameDO.getSmallestBet();
120     }
121
122     /*
123      * return the total games played from the pokerGameDO
124      */

125     public int getTotalPlayed(){
126         return pokerGameDO.getTotalPlayed();
127     }
128
129     /*
130      * return the total games won from the pokerGameDO
131      */

132     public int getTotalWon(){
133         return pokerGameDO.getTotalWon();
134     }
135
136     /*
137      * return the Vector of cards in hand from the pokerGameDO
138      */

139     public Vector JavaDoc getCardsInHand(){
140         return pokerGameDO.getCardsInHand();
141     }
142
143     /*
144      * return the Vector of cards already dealt from the pokerGameDO
145      */

146     public Vector JavaDoc getCardsUsed(){
147         return pokerGameDO.getCardsUsed();
148     }
149
150     /*
151      * return the default bet from the pokerGameDO
152      */

153     public int getDefaultBet(){
154         return pokerGameDO.getDefaultBet();
155     }
156
157     /*
158      * return the Vector of cards to drop from the pokerGameDO
159      */

160     public Vector JavaDoc getDropCards(){
161         return pokerGameDO.getDropCards();
162     }
163
164     /*
165      * return the default deck image name from the pokerGameDO
166      */

167     public String JavaDoc getDeck(){
168         return pokerGameDO.getDeck();
169     }
170
171     /*
172      * return the last error from the pokerGameDO
173      * not in use, but too paranoid to remove
174      */

175     public String JavaDoc getLastError(){
176         return pokerGameDO.getLastError();
177     }
178
179     /*
180      * return the PlayerDO from the pokerGameDO
181      * Yeah, I know this ills the encapsulation rules, but hey!
182      * it's only game!
183      */

184     public PlayerDO getPlayer(){ return playerDO; }
185
186    /*
187     * Set the cash in the pokerGameDO
188     */

189     public void setCash(int cash){
190         this.isDirty = true;
191         pokerGameDO.setCash(cash);
192     }
193
194    /*
195     * Set the playround in the pokerGameDO
196     */

197     public void setPlayRound(int playRound){
198         this.isDirty = true;
199         pokerGameDO.setPlayRound(playRound);
200     }
201
202    /*
203     * Set the last error in the pokerGameDO
204     */

205     public void setLastError(String JavaDoc lastError){
206         this.isDirty = true;
207         pokerGameDO.setLastError(lastError);
208     }
209
210    /*
211     * Set the ID in the pokerGameDO
212     */

213     public void setID(String JavaDoc id){
214         this.isDirty = true;
215         pokerGameDO.setID(id);
216     }
217
218    /*
219     * Set the name in the playerDO
220     */

221     public void setName(String JavaDoc name){
222         this.isDirty = true;
223         playerDO.setName(name);
224     }
225
226    /*
227     * Set the password in the playerDO
228     */

229     public void setPassword(String JavaDoc pw){
230         this.isDirty = true;
231         playerDO.setPassword(pw);
232     }
233
234    /*
235     * Set the email in the playerDO
236     */

237     public void setEmail(String JavaDoc email){
238         this.isDirty = true;
239         playerDO.setEmail(email);
240     }
241
242
243    /*
244     * Set the current bet in the pokerGameDO
245     */

246     public void setBet(int bet){
247         this.isDirty = true;
248         pokerGameDO.setBet(bet);
249     }
250
251    /*
252     * Set the current version in the pokerGameDO
253     */

254     public void setVersion(int version){
255         this.isDirty = true;
256         pokerGameDO.setVersion(version);
257     }
258
259    /*
260     * Set the largest bet placed in the pokerGameDO
261     */

262     public void setLargestBet(int largestBet){
263         this.isDirty = true;
264         pokerGameDO.setLargestBet(largestBet);
265     }
266
267    /*
268     * Set the smallest bet in the pokerGameDO
269     */

270     public void setSmallestBet(int smallestBet){
271         this.isDirty = true;
272         pokerGameDO.setSmallestBet(smallestBet);
273     }
274
275    /*
276     * Set the total hands played in the pokerGameDO
277     */

278     public void setTotalPlayed(int totalPlayed){
279         this.isDirty = true;
280         pokerGameDO.setTotalPlayed(totalPlayed);
281     }
282
283    /*
284     * Set the total hands won in the pokerGameDO
285     */

286     public void setTotalWon(int totalWon){
287         this.isDirty = true;
288         pokerGameDO.setTotalWon(totalWon);
289     }
290
291    /*
292     * Set the current cards in hand in the pokerGameDO
293     */

294     public void setCardsInHand(Vector JavaDoc cardsInHand){
295         pokerGameDO.setCardsInHand(cardsInHand);
296     }
297
298   /*
299    * Set the cards used in the pokerGameDO
300    */

301     public void setCardsUsed(Vector JavaDoc cardsUsed){
302         pokerGameDO.setCardsUsed(cardsUsed);
303     }
304
305    /*
306     * Set the cards to be dropped in the pokerGameDO
307     */

308     public void setDropCards(Vector JavaDoc dropCards){
309         pokerGameDO.setDropCards(dropCards);
310     }
311
312    /*
313     * Set the default deck image name in the pokerGameDO
314     */

315     public void setDeck(String JavaDoc deck){
316         this.isDirty = true;
317         pokerGameDO.setDeck(deck);
318     }
319
320    /*
321     * Set the default bet in the pokerGameDO
322     */

323     public void setDefaultBet(int defaultBet){
324         this.isDirty = true;
325         pokerGameDO.setDefaultBet(defaultBet);
326     }
327
328 }
329
Popular Tags