From FANG
|
001 packagepackage is used to name the directory or folder a class is in scg.ch14.gamestuff;
002
003 importimport means to make the classes and/or packages available in this program java.util.ArrayList;
004 importimport means to make the classes and/or packages available in this program java.util.Scanner;
005
006 importimport means to make the classes and/or packages available in this program scg.ch14.core.Game;
007
008 /**
009 * A GameObject representing a location in the adventure game.
010 *
011 * <p>A Location has two specific fields: lights, a booleanboolean is a type that is either true or false indicating
012 * whether or not the lights are on and darkDescription, how the
013 * location looks ifif executes the next statement only if the condition in parenthesis evaluates to true there is no light. If there is a darkDescription
014 * and the lights are off, {open braces start code blocks and must be matched with a close brace@link #getDescription()}close braces end code blocks and must match an earlier open brace returns the dark
015 * description. Thus regular description handling in the {open braces start code blocks and must be matched with a close brace@link Game}close braces end code blocks and must match an earlier open brace
016 * can be used with lights without modification.
017 */
018 publicpublic is used to indicate unrestricted access (any other class can have access) classclass is a group of fields and methods used for making objects Location
019 extendsextends means to customize or extend the functionality of a class GameObject {open braces start code blocks and must be matched with a close brace
020 /** value of UUID to mean no such location exists */
021 publicpublic is used to indicate unrestricted access (any other class can have access) staticstatic means that an instance is not required for access (class level access) finalfinal means not changeable (often used for constants) String NO_SUCH_LOCATION =this assignment operator makes the left side equal to the right side "NO_SUCH_LOCATION";
022
023 /** UUIDs of locations in given directions */
024 privateprivate is used to restrict access to the current class only String east;
025
026 /** UUIDs of key objects forfor is a looping structure for repeatedly executing a block of code going a given direction */
027 privateprivate is used to restrict access to the current class only String eKey;
028 privateprivate is used to restrict access to the current class only String nKey;
029 privateprivate is used to restrict access to the current class only String north;
030 privateprivate is used to restrict access to the current class only String sKey;
031
032 privateprivate is used to restrict access to the current class only String south;
033
034 /** a list of visiting critters */
035 privateprivate is used to restrict access to the current class only finalfinal means not changeable (often used for constants) ArrayList<Critter> visitors;
036
037 privateprivate is used to restrict access to the current class only String west;
038
039 /** does player win by getting here? */
040 privateprivate is used to restrict access to the current class only booleanboolean is a type that is either true or false winningLocation;
041 privateprivate is used to restrict access to the current class only String wKey;
042
043 /**
044 * Construct a newnew is used to create objects by calling the constructor, empty Location.
045 */
046 publicpublic is used to indicate unrestricted access (any other class can have access) Location() {open braces start code blocks and must be matched with a close brace
047 visitors =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor ArrayList<Critter>();
048 north =this assignment operator makes the left side equal to the right side NO_SUCH_LOCATION;
049 south =this assignment operator makes the left side equal to the right side NO_SUCH_LOCATION;
050 east =this assignment operator makes the left side equal to the right side NO_SUCH_LOCATION;
051 west =this assignment operator makes the left side equal to the right side NO_SUCH_LOCATION;
052
053 eKey =this assignment operator makes the left side equal to the right side nullnull is the value used to refer to a non-existant object;
054 nKey =this assignment operator makes the left side equal to the right side nullnull is the value used to refer to a non-existant object;
055 sKey =this assignment operator makes the left side equal to the right side nullnull is the value used to refer to a non-existant object;
056 wKey =this assignment operator makes the left side equal to the right side nullnull is the value used to refer to a non-existant object;
057
058 winningLocation =this assignment operator makes the left side equal to the right side falsefalse is a value for the boolean type and means not true;
059 }close braces end code blocks and must match an earlier open brace
060
061 /**
062 * Read one location from the given scanner
063 *
064 * @paramthis is the Javadoc tag for documenting the purpose of parameters gameObjectScanner scanner open forfor is a looping structure for repeatedly executing a block of code input
065 *
066 * @returnnull the newnew is used to create objects by calling the constructor Location or nullnull is the value used to refer to a non-existant object ifif executes the next statement only if the condition in parenthesis evaluates to true there is a problem
067 */
068 publicpublic is used to indicate unrestricted access (any other class can have access) staticstatic means that an instance is not required for access (class level access) Location readObjectFromFile(Scanner gameObjectScanner) {open braces start code blocks and must be matched with a close brace
069 String classID =this assignment operator makes the left side equal to the right side gameObjectScanner.next();
070 ifif executes the next statement only if the condition in parenthesis evaluates to true (!this is the not operator, which changes true to false and false to trueclassID.equalsIgnoreCase("Location")) {open braces start code blocks and must be matched with a close brace
071 returnreturn means to provide the result of the method and/or cease execution of the method immediately nullnull is the value used to refer to a non-existant object;// not the expected type of object; punt
072 }close braces end code blocks and must match an earlier open brace
073
074 String endClassID =this assignment operator makes the left side equal to the right side "/" +adds two numbers together or concatenates Strings together classID;
075
076 Location lo =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor Location();
077 GameObject.processAttributes(gameObjectScanner, endClassID, lo);
078 returnreturn means to provide the result of the method and/or cease execution of the method immediately lo;
079 }close braces end code blocks and must match an earlier open brace
080
081 /**
082 * add the given critter to the object
083 */
084 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value add(Critter critter) {open braces start code blocks and must be matched with a close brace
085 ifif executes the next statement only if the condition in parenthesis evaluates to true (visitors.indexOf(critter) < 0) {open braces start code blocks and must be matched with a close brace
086 visitors.add(critter);
087 critter.setLocation(thisthis means the current object (the implicit parameter));
088 }close braces end code blocks and must match an earlier open brace
089 }close braces end code blocks and must match an earlier open brace
090
091 /**
092 * Get the critter by name
093 *
094 * @paramthis is the Javadoc tag for documenting the purpose of parameters name name to find
095 *
096 * @returnnull reference to critter ifif executes the next statement only if the condition in parenthesis evaluates to true it is found; nullnull is the value used to refer to a non-existant object otherwise
097 */
098 publicpublic is used to indicate unrestricted access (any other class can have access) Critter critterByName(String name) {open braces start code blocks and must be matched with a close brace
099 Critter retval =this assignment operator makes the left side equal to the right side nullnull is the value used to refer to a non-existant object;
100 intint is the type for whole numbers and it is short for integer cNdx =this assignment operator makes the left side equal to the right side critterIndexByName(name);
101 ifif executes the next statement only if the condition in parenthesis evaluates to true (cNdx >=this evaluates to true if the left side is not less than the right side 0) {open braces start code blocks and must be matched with a close brace
102 retval =this assignment operator makes the left side equal to the right side visitors.get(cNdx);
103 }close braces end code blocks and must match an earlier open brace
104 returnreturn means to provide the result of the method and/or cease execution of the method immediately retval;
105 }close braces end code blocks and must match an earlier open brace
106
107 /**
108 * Get the critter by identifier
109 *
110 * @paramthis is the Javadoc tag for documenting the purpose of parameters uuid uuid to find
111 *
112 * @returnnull reference to critter ifif executes the next statement only if the condition in parenthesis evaluates to true it is found; nullnull is the value used to refer to a non-existant object otherwise
113 */
114 publicpublic is used to indicate unrestricted access (any other class can have access) Critter critterByUUID(String uuid) {open braces start code blocks and must be matched with a close brace
115 Critter retval =this assignment operator makes the left side equal to the right side nullnull is the value used to refer to a non-existant object;
116 intint is the type for whole numbers and it is short for integer cNdx =this assignment operator makes the left side equal to the right side critterIndex(uuid);
117 ifif executes the next statement only if the condition in parenthesis evaluates to true (cNdx >=this evaluates to true if the left side is not less than the right side 0) {open braces start code blocks and must be matched with a close brace
118 retval =this assignment operator makes the left side equal to the right side visitors.get(cNdx);
119 }close braces end code blocks and must match an earlier open brace
120 returnreturn means to provide the result of the method and/or cease execution of the method immediately retval;
121 }close braces end code blocks and must match an earlier open brace
122
123 /**
124 * @returnnull the east
125 */
126 publicpublic is used to indicate unrestricted access (any other class can have access) String getEast() {open braces start code blocks and must be matched with a close brace
127 returnreturn means to provide the result of the method and/or cease execution of the method immediately east;
128 }close braces end code blocks and must match an earlier open brace
129
130 publicpublic is used to indicate unrestricted access (any other class can have access) String getEKey() {open braces start code blocks and must be matched with a close brace
131 returnreturn means to provide the result of the method and/or cease execution of the method immediately eKey;
132 }close braces end code blocks and must match an earlier open brace
133
134 publicpublic is used to indicate unrestricted access (any other class can have access) String getNKey() {open braces start code blocks and must be matched with a close brace
135 returnreturn means to provide the result of the method and/or cease execution of the method immediately nKey;
136 }close braces end code blocks and must match an earlier open brace
137
138 /**
139 * @returnnull the north
140 */
141 publicpublic is used to indicate unrestricted access (any other class can have access) String getNorth() {open braces start code blocks and must be matched with a close brace
142 returnreturn means to provide the result of the method and/or cease execution of the method immediately north;
143 }close braces end code blocks and must match an earlier open brace
144
145 publicpublic is used to indicate unrestricted access (any other class can have access) String getSKey() {open braces start code blocks and must be matched with a close brace
146 returnreturn means to provide the result of the method and/or cease execution of the method immediately sKey;
147 }close braces end code blocks and must match an earlier open brace
148
149 /**
150 * @returnnull the south
151 */
152 publicpublic is used to indicate unrestricted access (any other class can have access) String getSouth() {open braces start code blocks and must be matched with a close brace
153 returnreturn means to provide the result of the method and/or cease execution of the method immediately south;
154 }close braces end code blocks and must match an earlier open brace
155
156 /**
157 * Get the list of visitors in the location
158 */
159 publicpublic is used to indicate unrestricted access (any other class can have access) ArrayList<Critter> getVisitors() {open braces start code blocks and must be matched with a close brace
160 returnreturn means to provide the result of the method and/or cease execution of the method immediately visitors;
161 }close braces end code blocks and must match an earlier open brace
162
163 /**
164 * @returnnull the west
165 */
166 publicpublic is used to indicate unrestricted access (any other class can have access) String getWest() {open braces start code blocks and must be matched with a close brace
167 returnreturn means to provide the result of the method and/or cease execution of the method immediately west;
168 }close braces end code blocks and must match an earlier open brace
169
170 publicpublic is used to indicate unrestricted access (any other class can have access) String getWKey() {open braces start code blocks and must be matched with a close brace
171 returnreturn means to provide the result of the method and/or cease execution of the method immediately wKey;
172 }close braces end code blocks and must match an earlier open brace
173
174 /**
175 * Does the critter exist in the visitors?
176 *
177 * @paramthis is the Javadoc tag for documenting the purpose of parameters uuid the uuid to check forfor is a looping structure for repeatedly executing a block of code
178 *
179 * @returnnull truetrue is the boolean value that is the opposite of false ifif executes the next statement only if the condition in parenthesis evaluates to true it is in the visitors, falsefalse is a value for the boolean type and means not true otherwise
180 */
181 publicpublic is used to indicate unrestricted access (any other class can have access) booleanboolean is a type that is either true or false hasCritterUUID(String uuid) {open braces start code blocks and must be matched with a close brace
182 returnreturn means to provide the result of the method and/or cease execution of the method immediately critterIndex(uuid) >=this evaluates to true if the left side is not less than the right side 0;
183 }close braces end code blocks and must match an earlier open brace
184
185 /**
186 * @returnnull the winningLocation
187 */
188 publicpublic is used to indicate unrestricted access (any other class can have access) booleanboolean is a type that is either true or false isWinningLocation() {open braces start code blocks and must be matched with a close brace
189 returnreturn means to provide the result of the method and/or cease execution of the method immediately winningLocation;
190 }close braces end code blocks and must match an earlier open brace
191
192 /**
193 * Remove critter from the visitors by uuid (ifif executes the next statement only if the condition in parenthesis evaluates to true it is here)
194 *
195 * @paramthis is the Javadoc tag for documenting the purpose of parameters uuid the uuid of the object to get
196 *
197 * @returnnull reference to removed object ifif executes the next statement only if the condition in parenthesis evaluates to true one was found; nullnull is the value used to refer to a non-existant object
198 * otherwise
199 */
200 publicpublic is used to indicate unrestricted access (any other class can have access) Critter removeCritterUUID(String uuid) {open braces start code blocks and must be matched with a close brace
201 Critter retval =this assignment operator makes the left side equal to the right side nullnull is the value used to refer to a non-existant object;
202 intint is the type for whole numbers and it is short for integer ndx =this assignment operator makes the left side equal to the right side critterIndex(uuid);
203 ifif executes the next statement only if the condition in parenthesis evaluates to true (ndx >=this evaluates to true if the left side is not less than the right side 0) {open braces start code blocks and must be matched with a close brace
204 retval =this assignment operator makes the left side equal to the right side visitors.remove(ndx);
205 }close braces end code blocks and must match an earlier open brace
206 returnreturn means to provide the result of the method and/or cease execution of the method immediately retval;
207 }close braces end code blocks and must match an earlier open brace
208
209 /**
210 * @paramthis is the Javadoc tag for documenting the purpose of parameters east the east to set
211 */
212 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setEast(String east) {open braces start code blocks and must be matched with a close brace
213 thisthis means the current object (the implicit parameter).east =this assignment operator makes the left side equal to the right side east;
214 }close braces end code blocks and must match an earlier open brace
215
216 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setEKey(String eKey) {open braces start code blocks and must be matched with a close brace
217 thisthis means the current object (the implicit parameter).eKey =this assignment operator makes the left side equal to the right side eKey;
218 }close braces end code blocks and must match an earlier open brace
219
220 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setNKey(String nKey) {open braces start code blocks and must be matched with a close brace
221 thisthis means the current object (the implicit parameter).nKey =this assignment operator makes the left side equal to the right side nKey;
222 }close braces end code blocks and must match an earlier open brace
223
224 /**
225 * @paramthis is the Javadoc tag for documenting the purpose of parameters north the north to set
226 */
227 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setNorth(String north) {open braces start code blocks and must be matched with a close brace
228 thisthis means the current object (the implicit parameter).north =this assignment operator makes the left side equal to the right side north;
229 }close braces end code blocks and must match an earlier open brace
230
231 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setSKey(String sKey) {open braces start code blocks and must be matched with a close brace
232 thisthis means the current object (the implicit parameter).sKey =this assignment operator makes the left side equal to the right side sKey;
233 }close braces end code blocks and must match an earlier open brace
234
235 /**
236 * @paramthis is the Javadoc tag for documenting the purpose of parameters south the south to set
237 */
238 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setSouth(String south) {open braces start code blocks and must be matched with a close brace
239 thisthis means the current object (the implicit parameter).south =this assignment operator makes the left side equal to the right side south;
240 }close braces end code blocks and must match an earlier open brace
241
242 /**
243 * @paramthis is the Javadoc tag for documenting the purpose of parameters west the west to set
244 */
245 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setWest(String west) {open braces start code blocks and must be matched with a close brace
246 thisthis means the current object (the implicit parameter).west =this assignment operator makes the left side equal to the right side west;
247 }close braces end code blocks and must match an earlier open brace
248
249 /**
250 * @paramthis is the Javadoc tag for documenting the purpose of parameters winningLocation the winningLocation to set
251 */
252 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setWinningLocation(booleanboolean is a type that is either true or false winningLocation) {open braces start code blocks and must be matched with a close brace
253 thisthis means the current object (the implicit parameter).winningLocation =this assignment operator makes the left side equal to the right side winningLocation;
254 }close braces end code blocks and must match an earlier open brace
255
256 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setWKey(String wKey) {open braces start code blocks and must be matched with a close brace
257 thisthis means the current object (the implicit parameter).wKey =this assignment operator makes the left side equal to the right side wKey;
258 }close braces end code blocks and must match an earlier open brace
259
260 /**
261 * Find the index of the given critter
262 *
263 * @paramthis is the Javadoc tag for documenting the purpose of parameters critterUUID critters uuid
264 *
265 * @returnnull index of match or -1
266 */
267 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer critterIndex(String critterUUID) {open braces start code blocks and must be matched with a close brace
268 forfor is a looping structure for repeatedly executing a block of code (intint is the type for whole numbers and it is short for integer i =this assignment operator makes the left side equal to the right side 0; i !=this is the not equals operator which evaluates to true if both sides are different visitors.size(); ++this is the increment operator, which increases the variable by 1i) {open braces start code blocks and must be matched with a close brace
269 ifif executes the next statement only if the condition in parenthesis evaluates to true (visitors.get(i).getUUID().equalsIgnoreCase(critterUUID)) {open braces start code blocks and must be matched with a close brace
270 returnreturn means to provide the result of the method and/or cease execution of the method immediately i;
271 }close braces end code blocks and must match an earlier open brace
272 }close braces end code blocks and must match an earlier open brace
273 returnreturn means to provide the result of the method and/or cease execution of the method immediately -1;
274 }close braces end code blocks and must match an earlier open brace
275
276 /**
277 * Find the index of the given critter
278 *
279 * @paramthis is the Javadoc tag for documenting the purpose of parameters critterName critters uuid
280 *
281 * @returnnull index of match or -1
282 */
283 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer critterIndexByName(String critterName) {open braces start code blocks and must be matched with a close brace
284 forfor is a looping structure for repeatedly executing a block of code (intint is the type for whole numbers and it is short for integer i =this assignment operator makes the left side equal to the right side 0; i !=this is the not equals operator which evaluates to true if both sides are different visitors.size(); ++this is the increment operator, which increases the variable by 1i) {open braces start code blocks and must be matched with a close brace
285 ifif executes the next statement only if the condition in parenthesis evaluates to true (visitors.get(i).getName().equalsIgnoreCase(critterName)) {open braces start code blocks and must be matched with a close brace
286 returnreturn means to provide the result of the method and/or cease execution of the method immediately i;
287 }close braces end code blocks and must match an earlier open brace
288 }close braces end code blocks and must match an earlier open brace
289 returnreturn means to provide the result of the method and/or cease execution of the method immediately -1;
290 }close braces end code blocks and must match an earlier open brace
291
292 /**
293 * Handle, ifif executes the next statement only if the condition in parenthesis evaluates to true possible, the given name/value pair
294 *
295 * @paramthis is the Javadoc tag for documenting the purpose of parameters attribute name of the attribute
296 * @paramthis is the Javadoc tag for documenting the purpose of parameters value the value of the attribute
297 *
298 * @returnnull truetrue is the boolean value that is the opposite of false ifif executes the next statement only if the condition in parenthesis evaluates to true the attribute was handled at thisthis means the current object (the implicit parameter) level; falsefalse is a value for the boolean type and means not true
299 * otherwise.
300 */
301 @Override
302 protectedprotected is used to restrict access to the current class and subclasses only booleanboolean is a type that is either true or false handleAttributeValuePair(String attribute,
303 String value) {open braces start code blocks and must be matched with a close brace
304 ifif executes the next statement only if the condition in parenthesis evaluates to true (super.handleAttributeValuePair(attribute, value)) {open braces start code blocks and must be matched with a close brace
305 returnreturn means to provide the result of the method and/or cease execution of the method immediately truetrue is the boolean value that is the opposite of false;
306 }close braces end code blocks and must match an earlier open brace
307
308 value =this assignment operator makes the left side equal to the right side value.toLowerCase(); // all of them need it
309 ifif executes the next statement only if the condition in parenthesis evaluates to true (attribute.equalsIgnoreCase("nKey")) {open braces start code blocks and must be matched with a close brace
310 setNKey(value);
311 returnreturn means to provide the result of the method and/or cease execution of the method immediately truetrue is the boolean value that is the opposite of false;
312 }close braces end code blocks and must match an earlier open brace elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true (attribute.equalsIgnoreCase("eKey")) {open braces start code blocks and must be matched with a close brace
313 setEKey(value);
314 returnreturn means to provide the result of the method and/or cease execution of the method immediately truetrue is the boolean value that is the opposite of false;
315 }close braces end code blocks and must match an earlier open brace elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true (attribute.equalsIgnoreCase("nKey")) {open braces start code blocks and must be matched with a close brace
316 setNKey(value);
317 returnreturn means to provide the result of the method and/or cease execution of the method immediately truetrue is the boolean value that is the opposite of false;
318 }close braces end code blocks and must match an earlier open brace elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true (attribute.equalsIgnoreCase("sKey")) {open braces start code blocks and must be matched with a close brace
319 setSKey(value);
320 returnreturn means to provide the result of the method and/or cease execution of the method immediately truetrue is the boolean value that is the opposite of false;
321 }close braces end code blocks and must match an earlier open brace elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true (attribute.equalsIgnoreCase("wKey")) {open braces start code blocks and must be matched with a close brace
322 setWKey(value);
323 returnreturn means to provide the result of the method and/or cease execution of the method immediately truetrue is the boolean value that is the opposite of false;
324 }close braces end code blocks and must match an earlier open brace elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true (attribute.equalsIgnoreCase("east")) {open braces start code blocks and must be matched with a close brace
325 setEast(value);
326 returnreturn means to provide the result of the method and/or cease execution of the method immediately truetrue is the boolean value that is the opposite of false;
327 }close braces end code blocks and must match an earlier open brace elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true (attribute.equalsIgnoreCase("north")) {open braces start code blocks and must be matched with a close brace
328 setNorth(value);
329 returnreturn means to provide the result of the method and/or cease execution of the method immediately truetrue is the boolean value that is the opposite of false;
330 }close braces end code blocks and must match an earlier open brace elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true (attribute.equalsIgnoreCase("south")) {open braces start code blocks and must be matched with a close brace
331 setSouth(value);
332 returnreturn means to provide the result of the method and/or cease execution of the method immediately truetrue is the boolean value that is the opposite of false;
333 }close braces end code blocks and must match an earlier open brace elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true (attribute.equalsIgnoreCase("west")) {open braces start code blocks and must be matched with a close brace
334 setWest(value);
335 returnreturn means to provide the result of the method and/or cease execution of the method immediately truetrue is the boolean value that is the opposite of false;
336 }close braces end code blocks and must match an earlier open brace elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true (attribute.equalsIgnoreCase("winningLocation")) {open braces start code blocks and must be matched with a close brace
337 setWinningLocation(Boolean.parseBoolean(value));
338 returnreturn means to provide the result of the method and/or cease execution of the method immediately truetrue is the boolean value that is the opposite of false;
339 }close braces end code blocks and must match an earlier open brace
340 returnreturn means to provide the result of the method and/or cease execution of the method immediately falsefalse is a value for the boolean type and means not true;
341 }close braces end code blocks and must match an earlier open brace
342
343 /**
344 * Internal toString helper method.
345 *
346 * @returnnull A string representation of the fields.
347 */
348 @Override
349 protectedprotected is used to restrict access to the current class and subclasses only String toStringGuts() {open braces start code blocks and must be matched with a close brace
350 returnreturn means to provide the result of the method and/or cease execution of the method immediately super.toStringGuts() +adds two numbers together or concatenates Strings together "\n" +adds two numbers together or concatenates Strings together "\n" +adds two numbers together or concatenates Strings together "north = " +adds two numbers together or concatenates Strings together north +adds two numbers together or concatenates Strings together
351 "\n" +adds two numbers together or concatenates Strings together "south = " +adds two numbers together or concatenates Strings together south +adds two numbers together or concatenates Strings together "\n" +adds two numbers together or concatenates Strings together "east = " +adds two numbers together or concatenates Strings together east +adds two numbers together or concatenates Strings together "\n" +adds two numbers together or concatenates Strings together
352 "west = " +adds two numbers together or concatenates Strings together west;
353 }close braces end code blocks and must match an earlier open brace
354 }close braces end code blocks and must match an earlier open brace
355
356 //Uploaded on Mon Mar 29 21:40:52 EDT 2010
|
Download/View scg/ch14/gamestuff/Location.java