1 package cz.cuni.amis.pogamut.ut2004.utils;
2
3 import java.io.Serializable;
4 import java.util.logging.Logger;
5
6 import cz.cuni.amis.pogamut.base.utils.Pogamut;
7
8
9
10
11 public class UCCWrapperConf implements Serializable {
12
13
14
15
16 private static final long serialVersionUID = -8577056681683055775L;
17
18 protected UCCWrapperPatterns patterns = new UCCWrapperPatterns();
19 protected String unrealHome = null;
20 protected String mapName = "DM-TrainingDay";
21 protected String gameBotsPack = "GameBots2004";
22 protected String gameType = "BotDeathMatch";
23 protected String mutators = "";
24 protected String options = "";
25
26 protected int playerPort = -1;
27 protected boolean startOnUnusedPort = true;
28 transient Logger log = null;
29
30 public UCCWrapperConf() {
31 }
32
33 public UCCWrapperConf(UCCWrapperConf uccConf) {
34 this.patterns = new UCCWrapperPatterns(uccConf.getPatterns());
35 this.unrealHome = uccConf.getUnrealHome();
36 this.mapName = uccConf.getMapName();
37 this.gameBotsPack = uccConf.getGameBotsPack();
38 this.gameType = uccConf.getGameType();
39 this.mutators = uccConf.getMutators();
40 this.options = uccConf.getOptions();
41 this.playerPort = uccConf.getPlayerPort();
42 this.startOnUnusedPort = uccConf.isStartOnUnusedPort();
43 this.log = uccConf.getLog();
44 }
45
46
47 public int getPlayerPort() {
48 return playerPort;
49 }
50
51
52 public void setPlayerPort(int playerPort) {
53 this.playerPort = playerPort;
54 }
55
56 @Override
57 public String toString() {
58 if (this == null) return "UCCWrapperConf";
59 return getClass().getSimpleName() + "[unrealHome=" + unrealHome + ", gameBotsPack=" + gameBotsPack + ", gameType=" + gameType + ", mutators=" + mutators + ", options=" + options + ", startOnUnusedPorts=" + startOnUnusedPort + "]";
60 }
61
62
63
64
65
66 public UCCWrapperPatterns getPatterns() {
67 return patterns;
68 }
69
70
71
72
73
74 public void setPatterns(UCCWrapperPatterns patterns) {
75 this.patterns = patterns;
76 }
77
78
79
80
81
82 public String getUnrealHome() {
83 if (unrealHome == null) {
84 return Pogamut.getPlatform().getProperty(PogamutUT2004Property.POGAMUT_UNREAL_HOME.getKey());
85 } else {
86 return unrealHome;
87 }
88 }
89
90
91
92
93
94
95
96
97 public void setUnrealHome(String unrealHome) {
98 this.unrealHome = unrealHome;
99 }
100
101
102
103
104
105 public UCCWrapperConf setStartOnUnusedPort(boolean startOnUnusedPort) {
106 this.startOnUnusedPort = startOnUnusedPort;
107 return this;
108 }
109
110
111
112
113
114 public UCCWrapperConf setGameBotsPack(String gameBotsPack) {
115 this.gameBotsPack = gameBotsPack;
116 return this;
117 }
118
119 public UCCWrapperConf setMapName(String mapName) {
120 this.mapName = mapName;
121 return this;
122 }
123
124
125
126
127
128 public UCCWrapperConf setGameType(String gameType) {
129 this.gameType = gameType;
130 return this;
131 }
132
133
134
135
136
137 public UCCWrapperConf setOptions(String options) {
138 this.options = options;
139 return this;
140 }
141
142
143
144
145
146 public UCCWrapperConf setLogger(Logger log) {
147 this.log = log;
148 return this;
149 }
150
151 public String getMutators() {
152 return mutators;
153 }
154
155 public void setMutators(String mutators) {
156 this.mutators = mutators;
157 }
158
159 public Logger getLog() {
160 return log;
161 }
162
163 public void setLog(Logger log) {
164 this.log = log;
165 }
166
167 public String getMapName() {
168 return mapName;
169 }
170
171 public String getGameBotsPack() {
172 return gameBotsPack;
173 }
174
175 public String getGameType() {
176 return gameType;
177 }
178
179 public String getOptions() {
180 return options;
181 }
182
183 public boolean isStartOnUnusedPort() {
184 return startOnUnusedPort;
185 }
186
187 }