1 /**
2 * This program is free software: you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation, version 3.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program. If not, see <http://www.gnu.org/licenses/>.
13 */
14
15 package net.curre.prefcount.bean;
16
17 import java.util.List;
18
19 /**
20 * Object of this class represents a bean that holds all
21 * score and results for a preferance card game.
22 * <p/>
23 * Created date: Apr 9, 2007
24 *
25 * @author Yevgeny Nyden
26 */
27 public class GameResultBean {
28
29 /** Indicates that all player data has been entered or not. */
30 private boolean finalScoresReady;
31
32 /** Target bullet players need to reach. */
33 private Integer targetBullet;
34
35 /** Average mountain for this game. */
36 private Float averageMountain;
37
38 /** Minimum mountain in this game. */
39 private Integer minMountain;
40
41 /** List with player statistics. */
42 private List<PlayerStatistics> playerStats;
43
44 /**
45 * Default ctor that sets targetBullet
46 * to the min int value.
47 */
48 public GameResultBean() {
49 targetBullet = Integer.MIN_VALUE;
50 }
51
52 /**
53 * Getter for the flag that indicates that the player
54 * final scores are ready for display.
55 *
56 * @return True if all the player final scores have been generated;
57 * false otherwise.
58 */
59 public boolean isFinalScoresReady() {
60 return finalScoresReady;
61 }
62
63 /**
64 * Setter for the flag that indicates that the player
65 * final scores are ready for display.
66 *
67 * @param finalScoresReady True if the player final scores have
68 * been generated; false otherwise.
69 */
70 public void setFinalScoresReady(boolean finalScoresReady) {
71 this.finalScoresReady = finalScoresReady;
72 }
73
74 /**
75 * Getter for the target bullet players need to reach.
76 *
77 * @return Target bullet players need to reach.
78 */
79 public Integer getTargetBullet() {
80 return targetBullet;
81 }
82
83 /**
84 * Setter for the target bullet players need to reach.
85 *
86 * @param targetBullet Target bullet players need to reach.
87 */
88 public void setTargetBullet(Integer targetBullet) {
89 this.targetBullet = targetBullet;
90 }
91
92 /**
93 * Getter for the player's average mountain.
94 *
95 * @return The player's average mountain.
96 */
97 public Float getAverageMountain() {
98 return averageMountain;
99 }
100
101 /**
102 * Setter for the player's average mountain.
103 *
104 * @param averageMountain Player's average mountain to set.
105 */
106 public void setAverageMountain(Float averageMountain) {
107 this.averageMountain = averageMountain;
108 }
109
110 /**
111 * Returns minimum mountain in the game.
112 *
113 * @return Min mountain in the game.
114 */
115 public Integer getMinMountain() {
116 return minMountain;
117 }
118
119 /**
120 * Setter for the minimum mountain in the game.
121 *
122 * @param minMountain Min mountain in the game to set.
123 */
124 public void setMinMountain(Integer minMountain) {
125 this.minMountain = minMountain;
126 }
127
128 /**
129 * Getter for the list of player statistics.
130 *
131 * @return List of player statistics.
132 */
133 public List<PlayerStatistics> getPlayerStats() {
134 return playerStats;
135 }
136
137 /**
138 * Setter for the list of player statistics.
139 *
140 * @param playerStats List of player statistics.
141 */
142 public void setPlayerStats(List<PlayerStatistics> playerStats) {
143 this.playerStats = playerStats;
144 }
145
146 /**
147 * Returns the number of players in the game.
148 *
149 * @return The number of players in the game.
150 */
151 public int getNumberOfPlayers() {
152 return this.playerStats.size();
153 }
154
155 /** {@inheritDoc} */
156 public String toString() {
157 StringBuilder buff = new StringBuilder();
158 return buff.append(super.toString()).append(": finalScoresReady=").append(finalScoresReady).
159 append(", targetBullet=").append(targetBullet).
160 append(", averageMountain=").append(averageMountain).
161 append(", minMountain=").append(minMountain).append(';').toString();
162 }
163
164 }