1 17 package org.apache.ws.jaxme.js; 18 19 import java.io.IOException ; 20 import java.util.Enumeration ; 21 import java.util.Iterator ; 22 23 26 public abstract class ConditionalIndentationJavaSourceObject extends JavaSourceObject 27 implements ConditionalIndentationEngine { 28 private class LocalJavaFieldDeclaration { 29 LJFImpl field; 30 private LocalJavaFieldDeclaration(LJFImpl pField) { 31 field = pField; 32 } 33 } 34 35 public class LoopVariable implements DirectAccessible, IndentedObject { 36 private Object value; 37 private JavaQName type; 38 public LoopVariable(Object pValue, JavaQName pType) { 39 value = pValue; 40 type = pType; 41 } 42 public JavaQName getType() { return type; } 43 public boolean isNullable() { return false; } 44 public void setNullable(boolean pNullable) { 45 if (pNullable) { 46 throw new IllegalStateException ("Loop variables cannot be nullable."); 47 } 48 } 49 public Object getValue() { 50 return value; 51 } 52 public void write(IndentationEngine pEngine, IndentationTarget pTarget) 53 throws IOException { 54 pEngine.write(pTarget, getValue()); 55 } 56 } 57 58 public class LJFImpl extends JavaField implements LocalJavaField { 59 LJFImpl(JavaQName pType, String pName) { 60 super(pName, pType, null); 61 } 62 public void write(IndentationEngine pEngine, IndentationTarget pTarget) 63 throws IOException { 64 pEngine.write(pTarget, getName()); 65 } 66 } 67 68 private int localVariableCounter = 0; 69 70 protected ConditionalIndentationJavaSourceObject 71 (String pName, JavaQName pType, JavaSource.Protection pProtection) { 72 super(pName, pType, pProtection); 73 } 74 75 public void addIf(Object [] pTokens) { 76 addLine("if (", pTokens, ") {"); 77 indent(); 78 } 79 public void addIf(Object pToken1) { 80 addIf(new Object []{pToken1}); 81 } 82 public void addIf(Object pToken1, Object pToken2) { 83 addIf(new Object []{pToken1, pToken2}); 84 } 85 public void addIf(Object pToken1, Object pToken2, Object pToken3) { 86 addIf(new Object []{pToken1, pToken2, pToken3}); 87 } 88 public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4) { 89 addIf(new Object []{pToken1, pToken2, pToken3, pToken4}); 90 } 91 public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 92 Object pToken5) { 93 addIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5}); 94 } 95 public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 96 Object pToken5, Object pToken6) { 97 addIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6}); 98 } 99 public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 100 Object pToken5, Object pToken6, Object pToken7) { 101 addIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 102 pToken7}); 103 } 104 public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 105 Object pToken5, Object pToken6, Object pToken7, Object pToken8) { 106 addIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 107 pToken7, pToken8}); 108 } 109 public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 110 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 111 Object pToken9) { 112 addIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 113 pToken7, pToken8, pToken9}); 114 } 115 public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 116 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 117 Object pToken9, Object pToken10) { 118 addIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 119 pToken7, pToken8, pToken9, pToken10}); 120 } 121 public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 122 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 123 Object pToken9, Object pToken10, Object pToken11) { 124 addIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 125 pToken7, pToken8, pToken9, pToken10, pToken11}); 126 } 127 public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 128 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 129 Object pToken9, Object pToken10, Object pToken11, 130 Object pToken12) { 131 addIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 132 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12}); 133 } 134 public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 135 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 136 Object pToken9, Object pToken10, Object pToken11, 137 Object pToken12, Object pToken13) { 138 addIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 139 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 140 pToken13}); 141 } 142 public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 143 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 144 Object pToken9, Object pToken10, Object pToken11, 145 Object pToken12, Object pToken13, Object pToken14) { 146 addIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 147 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 148 pToken13, pToken14}); 149 } 150 public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 151 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 152 Object pToken9, Object pToken10, Object pToken11, 153 Object pToken12, Object pToken13, Object pToken14, 154 Object pToken15) { 155 addIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 156 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 157 pToken13, pToken14, pToken15}); 158 } 159 160 public void addElseIf(Object [] pTokens) { 161 unindent(); 162 addLine("} else if (", pTokens, ") {"); 163 indent(); 164 } 165 public void addElseIf(Object pToken1) { 166 addElseIf(new Object []{pToken1}); 167 } 168 public void addElseIf(Object pToken1, Object pToken2) { 169 addElseIf(new Object []{pToken1, pToken2}); 170 } 171 public void addElseIf(Object pToken1, Object pToken2, Object pToken3) { 172 addElseIf(new Object []{pToken1, pToken2, pToken3}); 173 } 174 public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4) { 175 addElseIf(new Object []{pToken1, pToken2, pToken3, pToken4}); 176 } 177 public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 178 Object pToken5) { 179 addElseIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5}); 180 } 181 public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 182 Object pToken5, Object pToken6) { 183 addElseIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6}); 184 } 185 public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 186 Object pToken5, Object pToken6, Object pToken7) { 187 addElseIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 188 pToken7}); 189 } 190 public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 191 Object pToken5, Object pToken6, Object pToken7, Object pToken8) { 192 addElseIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 193 pToken7, pToken8}); 194 } 195 public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 196 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 197 Object pToken9) { 198 addElseIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 199 pToken7, pToken8, pToken9}); 200 } 201 public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 202 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 203 Object pToken9, Object pToken10) { 204 addElseIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 205 pToken7, pToken8, pToken9, pToken10}); 206 } 207 public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 208 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 209 Object pToken9, Object pToken10, Object pToken11) { 210 addElseIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 211 pToken7, pToken8, pToken9, pToken10, pToken11}); 212 } 213 public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 214 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 215 Object pToken9, Object pToken10, Object pToken11, 216 Object pToken12) { 217 addElseIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 218 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12}); 219 } 220 public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 221 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 222 Object pToken9, Object pToken10, Object pToken11, 223 Object pToken12, Object pToken13) { 224 addElseIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 225 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 226 pToken13}); 227 } 228 public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 229 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 230 Object pToken9, Object pToken10, Object pToken11, 231 Object pToken12, Object pToken13, Object pToken14) { 232 addElseIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 233 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 234 pToken13, pToken14}); 235 } 236 public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 237 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 238 Object pToken9, Object pToken10, Object pToken11, 239 Object pToken12, Object pToken13, Object pToken14, 240 Object pToken15) { 241 addElseIf(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 242 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 243 pToken13, pToken14, pToken15}); 244 } 245 246 public void addIf(boolean pFirst, Object [] pTokens) { 247 if (pFirst) { 248 addIf(pTokens); 249 } else { 250 addElseIf(pTokens); 251 } 252 } 253 public void addIf(boolean pFirst, Object pToken1) { 254 addIf(pFirst, new Object []{pToken1}); 255 } 256 public void addIf(boolean pFirst, Object pToken1, Object pToken2) { 257 addIf(pFirst, new Object []{pToken1, pToken2}); 258 } 259 public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3) { 260 addIf(pFirst, new Object []{pToken1, pToken2, pToken3}); 261 } 262 public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3, 263 Object pToken4) { 264 addIf(pFirst, new Object []{pToken1, pToken2, pToken3, pToken4}); 265 } 266 public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3, 267 Object pToken4, Object pToken5) { 268 addIf(pFirst, new Object []{pToken1, pToken2, pToken3, pToken4, pToken5}); 269 } 270 public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3, 271 Object pToken4, Object pToken5, Object pToken6) { 272 addIf(pFirst, new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6}); 273 } 274 public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3, 275 Object pToken4, Object pToken5, Object pToken6, Object pToken7) { 276 addIf(pFirst, new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 277 pToken7}); 278 } 279 public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3, 280 Object pToken4, Object pToken5, Object pToken6, Object pToken7, 281 Object pToken8) { 282 addIf(pFirst, new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 283 pToken7, pToken8}); 284 } 285 public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3, 286 Object pToken4, Object pToken5, Object pToken6, Object pToken7, 287 Object pToken8, Object pToken9) { 288 addIf(pFirst, new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 289 pToken7, pToken8, pToken9}); 290 } 291 public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3, 292 Object pToken4, Object pToken5, Object pToken6, Object pToken7, 293 Object pToken8, Object pToken9, Object pToken10) { 294 addIf(pFirst, new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 295 pToken7, pToken8, pToken9, pToken10}); 296 } 297 public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3, 298 Object pToken4, Object pToken5, Object pToken6, Object pToken7, 299 Object pToken8, Object pToken9, Object pToken10, Object pToken11) { 300 addIf(pFirst, new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 301 pToken7, pToken8, pToken9, pToken10, pToken11}); 302 } 303 public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3, 304 Object pToken4, Object pToken5, Object pToken6, Object pToken7, 305 Object pToken8, Object pToken9, Object pToken10, Object pToken11, 306 Object pToken12) { 307 addIf(pFirst, new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 308 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12}); 309 } 310 public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3, 311 Object pToken4, Object pToken5, Object pToken6, Object pToken7, 312 Object pToken8, Object pToken9, Object pToken10, Object pToken11, 313 Object pToken12, Object pToken13) { 314 addIf(pFirst, new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 315 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 316 pToken13}); 317 } 318 public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3, 319 Object pToken4, Object pToken5, Object pToken6, Object pToken7, 320 Object pToken8, Object pToken9, Object pToken10, Object pToken11, 321 Object pToken12, Object pToken13, Object pToken14) { 322 addIf(pFirst, new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 323 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 324 pToken13, pToken14}); 325 } 326 public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3, 327 Object pToken4, Object pToken5, Object pToken6, Object pToken7, 328 Object pToken8, Object pToken9, Object pToken10, Object pToken11, 329 Object pToken12, Object pToken13, Object pToken14, Object pToken15) { 330 addIf(pFirst, new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 331 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 332 pToken13, pToken14, pToken15}); 333 } 334 335 public void addElse() { 336 unindent(); 337 addLine("} else {"); 338 indent(); 339 } 340 341 public void addEndIf() { 342 unindent(); 343 addLine("}"); 344 } 345 346 public void addThrowNew(JavaQName pExceptionClass, Object [] pArgs) { 347 addLine("throw new ", pExceptionClass, "(", pArgs, ");"); 348 } 349 public void addThrowNew(JavaQName pExceptionClass, Object pToken1) { 350 addThrowNew(pExceptionClass, new Object []{pToken1}); 351 } 352 public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2) { 353 addThrowNew(pExceptionClass, new Object []{pToken1, pToken2}); 354 } 355 public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2, 356 Object pToken3) { 357 addThrowNew(pExceptionClass, new Object []{pToken1, pToken2, pToken3}); 358 } 359 public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2, 360 Object pToken3, Object pToken4) { 361 addThrowNew(pExceptionClass, new Object []{pToken1, pToken2, pToken3, pToken4}); 362 } 363 public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2, 364 Object pToken3, Object pToken4, Object pToken5) { 365 addThrowNew(pExceptionClass, 366 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5}); 367 } 368 public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2, 369 Object pToken3, Object pToken4, Object pToken5, Object pToken6) { 370 addThrowNew(pExceptionClass, 371 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6}); 372 } 373 public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2, 374 Object pToken3, Object pToken4, Object pToken5, Object pToken6, 375 Object pToken7) { 376 addThrowNew(pExceptionClass, 377 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 378 pToken7}); 379 } 380 public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2, 381 Object pToken3, Object pToken4, Object pToken5, Object pToken6, 382 Object pToken7, Object pToken8) { 383 addThrowNew(pExceptionClass, 384 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 385 pToken7, pToken8}); 386 } 387 public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2, 388 Object pToken3, Object pToken4, Object pToken5, Object pToken6, 389 Object pToken7, Object pToken8, 390 Object pToken9) { 391 addThrowNew(pExceptionClass, 392 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 393 pToken7, pToken8, pToken9}); 394 } 395 public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2, 396 Object pToken3, Object pToken4, Object pToken5, Object pToken6, 397 Object pToken7, Object pToken8, Object pToken9, Object pToken10) { 398 addThrowNew(pExceptionClass, 399 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 400 pToken7, pToken8, pToken9, pToken10}); 401 } 402 public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2, 403 Object pToken3, Object pToken4, Object pToken5, Object pToken6, 404 Object pToken7, Object pToken8, Object pToken9, Object pToken10, 405 Object pToken11) { 406 addThrowNew(pExceptionClass, 407 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 408 pToken7, pToken8, pToken9, pToken10, pToken11}); 409 } 410 public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2, 411 Object pToken3, Object pToken4, Object pToken5, Object pToken6, 412 Object pToken7, Object pToken8, Object pToken9, Object pToken10, 413 Object pToken11, Object pToken12) { 414 addThrowNew(pExceptionClass, 415 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 416 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12}); 417 } 418 public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2, 419 Object pToken3, Object pToken4, Object pToken5, Object pToken6, 420 Object pToken7, Object pToken8, Object pToken9, Object pToken10, 421 Object pToken11, Object pToken12, Object pToken13) { 422 addThrowNew(pExceptionClass, 423 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 424 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 425 pToken13}); 426 } 427 public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2, 428 Object pToken3, Object pToken4, Object pToken5, Object pToken6, 429 Object pToken7, Object pToken8, Object pToken9, Object pToken10, 430 Object pToken11, Object pToken12, Object pToken13, 431 Object pToken14) { 432 addThrowNew(pExceptionClass, 433 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 434 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 435 pToken13, pToken14}); 436 } 437 public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2, 438 Object pToken3, Object pToken4, Object pToken5, Object pToken6, 439 Object pToken7, Object pToken8, Object pToken9, Object pToken10, 440 Object pToken11, Object pToken12, Object pToken13, 441 Object pToken14, Object pToken15) { 442 addThrowNew(pExceptionClass, 443 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 444 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 445 pToken13, pToken14, pToken15}); 446 } 447 448 public void addThrowNew(Class pExceptionClass, Object [] pArgs) { 449 addThrowNew(JavaQNameImpl.getInstance(pExceptionClass), pArgs); 450 } 451 public void addThrowNew(Class pExceptionClass, Object pToken1) { 452 addThrowNew(pExceptionClass, new Object []{pToken1}); 453 } 454 public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2) { 455 addThrowNew(pExceptionClass, new Object []{pToken1, pToken2}); 456 } 457 public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2, 458 Object pToken3) { 459 addThrowNew(pExceptionClass, new Object []{pToken1, pToken2, pToken3}); 460 } 461 public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2, 462 Object pToken3, Object pToken4) { 463 addThrowNew(pExceptionClass, new Object []{pToken1, pToken2, pToken3, pToken4}); 464 } 465 public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2, 466 Object pToken3, Object pToken4, Object pToken5) { 467 addThrowNew(pExceptionClass, 468 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5}); 469 } 470 public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2, 471 Object pToken3, Object pToken4, Object pToken5, Object pToken6) { 472 addThrowNew(pExceptionClass, 473 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6}); 474 } 475 public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2, 476 Object pToken3, Object pToken4, Object pToken5, Object pToken6, 477 Object pToken7) { 478 addThrowNew(pExceptionClass, 479 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 480 pToken7}); 481 } 482 public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2, 483 Object pToken3, Object pToken4, Object pToken5, Object pToken6, 484 Object pToken7, Object pToken8) { 485 addThrowNew(pExceptionClass, 486 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 487 pToken7, pToken8}); 488 } 489 public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2, 490 Object pToken3, Object pToken4, Object pToken5, Object pToken6, 491 Object pToken7, Object pToken8, 492 Object pToken9) { 493 addThrowNew(pExceptionClass, 494 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 495 pToken7, pToken8, pToken9}); 496 } 497 public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2, 498 Object pToken3, Object pToken4, Object pToken5, Object pToken6, 499 Object pToken7, Object pToken8, Object pToken9, Object pToken10) { 500 addThrowNew(pExceptionClass, 501 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 502 pToken7, pToken8, pToken9, pToken10}); 503 } 504 public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2, 505 Object pToken3, Object pToken4, Object pToken5, Object pToken6, 506 Object pToken7, Object pToken8, Object pToken9, Object pToken10, 507 Object pToken11) { 508 addThrowNew(pExceptionClass, 509 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 510 pToken7, pToken8, pToken9, pToken10, pToken11}); 511 } 512 public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2, 513 Object pToken3, Object pToken4, Object pToken5, Object pToken6, 514 Object pToken7, Object pToken8, Object pToken9, Object pToken10, 515 Object pToken11, Object pToken12) { 516 addThrowNew(pExceptionClass, 517 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 518 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12}); 519 } 520 public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2, 521 Object pToken3, Object pToken4, Object pToken5, Object pToken6, 522 Object pToken7, Object pToken8, Object pToken9, Object pToken10, 523 Object pToken11, Object pToken12, Object pToken13) { 524 addThrowNew(pExceptionClass, 525 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 526 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 527 pToken13}); 528 } 529 public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2, 530 Object pToken3, Object pToken4, Object pToken5, Object pToken6, 531 Object pToken7, Object pToken8, Object pToken9, Object pToken10, 532 Object pToken11, Object pToken12, Object pToken13, 533 Object pToken14) { 534 addThrowNew(pExceptionClass, 535 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 536 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 537 pToken13, pToken14}); 538 } 539 public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2, 540 Object pToken3, Object pToken4, Object pToken5, Object pToken6, 541 Object pToken7, Object pToken8, Object pToken9, Object pToken10, 542 Object pToken11, Object pToken12, Object pToken13, 543 Object pToken14, Object pToken15) { 544 addThrowNew(pExceptionClass, 545 new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 546 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 547 pToken13, pToken14, pToken15}); 548 } 549 550 public void addTry() { 551 addLine("try {"); 552 indent(); 553 } 554 public DirectAccessible addCatch(JavaQName pExceptionClass, Object pVar) { 555 unindent(); 556 addLine("} catch (", pExceptionClass, " ", pVar, ") {"); 557 indent(); 558 return new LoopVariable(pVar, pExceptionClass); 559 } 560 public DirectAccessible addCatch(Class pExceptionClass, Object pVar) { 561 return addCatch(JavaQNameImpl.getInstance(pExceptionClass), pVar); 562 } 563 public DirectAccessible addCatch(JavaQName pExceptionClass) { 564 return addCatch(pExceptionClass, getLocalVariableName()); 565 } 566 public DirectAccessible addCatch(Class pExceptionClass) { 567 return addCatch(pExceptionClass, getLocalVariableName()); 568 } 569 public void addFinally() { 570 unindent(); 571 addLine("} finally {"); 572 indent(); 573 } 574 public void addEndTry() { 575 unindent(); 576 addLine("}"); 577 } 578 579 580 public void addFor(Object [] pArgs) { 581 addLine("for (", pArgs, ") {"); 582 indent(); 583 } 584 585 586 public DirectAccessible addForArray(JavaQName pVarClass, Object pVar, Object pArray) { 587 addFor(new Object []{pVarClass, " ", pVar, " = 0; ", 588 pVar, " < (", pArray, ").length; ", 589 pVar, "++"}); 590 return new LoopVariable(pVar, pVarClass); 591 } 592 public DirectAccessible addForArray(Class pVarClass, Object pVar, Object pArray) { 593 return addForArray(JavaQNameImpl.getInstance(pVarClass), pVar, pArray); 594 } 595 public DirectAccessible addForArray(Object pVar, Object pArray) { 596 return addForArray(int.class, pVar, pArray); 597 } 598 public DirectAccessible addForArray(JavaQName pVarClass, Object pArray) { 599 return addForArray(pVarClass, getLocalVariableName(), pArray); 600 } 601 public DirectAccessible addForArray(Class pVarClass, Object pArray) { 602 return addForArray(pVarClass, getLocalVariableName(), pArray); 603 } 604 public DirectAccessible addForArray(Object pArray) { 605 return addForArray(int.class, pArray); 606 } 607 608 public DirectAccessible addForList(JavaQName pVarClass, Object pVar, Object pList) { 609 addFor(new Object []{pVarClass, " ", pVar, " = 0; ", pVar, " < (", pList, 610 ").size(); ", pVar, "++"}); 611 return new LoopVariable(pVar, pVarClass); 612 } 613 public DirectAccessible addForList(Class pVarClass, Object pVar, Object pList) { 614 return addForList(JavaQNameImpl.getInstance(pVarClass), pVar, pList); 615 } 616 public DirectAccessible addForList(Object pVar, Object pList) { 617 return addForList(int.class, pVar, pList); 618 } 619 public DirectAccessible addForList(JavaQName pVarClass, Object pList) { 620 return addForList(pVarClass, getLocalVariableName(), pList); 621 } 622 public DirectAccessible addForList(Class pVarClass, Object pList) { 623 return addForList(pVarClass, getLocalVariableName(), pList); 624 } 625 public DirectAccessible addForList(Object pList) { 626 return addForList(int.class, pList); 627 } 628 629 630 public DirectAccessible addForIterator(JavaQName pVarClass, Object pVar, Object pIterator) { 631 addFor(new Object []{pVarClass, " ", pVar, " = ", pIterator, "; ", pVar, 632 ".hasNext(); "}); 633 return new LoopVariable(pVar, pVarClass); 634 } 635 public DirectAccessible addForIterator(Class pVarClass, Object pVar, Object pIterator) { 636 return addForIterator(JavaQNameImpl.getInstance(pVarClass), pVar, pIterator); 637 } 638 public DirectAccessible addForIterator(Object pVar, Object pIterator) { 639 return addForIterator(Iterator .class, pVar, pIterator); 640 } 641 public DirectAccessible addForIterator(JavaQName pVarClass, Object pIterator) { 642 return addForIterator(pVarClass, getLocalVariableName(), pIterator); 643 } 644 public DirectAccessible addForIterator(Class pVarClass, Object pIterator) { 645 return addForIterator(pVarClass, getLocalVariableName(), pIterator); 646 } 647 public DirectAccessible addForIterator(Object pIterator) { 648 return addForIterator(Iterator .class, pIterator); 649 } 650 651 public DirectAccessible addForEnumeration(JavaQName pVarClass, Object pVar, Object pEnumeration) { 652 addFor(new Object []{pVarClass, " ", pVar, " = ", pEnumeration, "; ", pVar, 653 ".hasMoreElements(); "}); 654 return new LoopVariable(pVar, pVarClass); 655 } 656 public DirectAccessible addForEnumeration(Class pVarClass, Object pVar, Object pEnumeration) { 657 return addForEnumeration(JavaQNameImpl.getInstance(pVarClass), pVar, pEnumeration); 658 } 659 public DirectAccessible addForEnumeration(Object pVar, Object pEnumeration) { 660 return addForEnumeration(Enumeration .class, pVar, pEnumeration); 661 } 662 public DirectAccessible addForEnumeration(JavaQName pVarClass, Object pEnumeration) { 663 return addForEnumeration(pVarClass, getLocalVariableName(), pEnumeration); 664 } 665 public DirectAccessible addForEnumeration(Class pVarClass, Object pEnumeration) { 666 return addForEnumeration(pVarClass, getLocalVariableName(), pEnumeration); 667 } 668 public DirectAccessible addForEnumeration(Object pEnumeration) { 669 return addForEnumeration(Enumeration .class, pEnumeration); 670 } 671 672 public DirectAccessible addForCollection(JavaQName pVarClass, Object pVar, Object pCollection) { 673 return addForIterator(pVarClass, pVar, new Object []{"(", pCollection, ").iterator()"}); 674 } 675 public DirectAccessible addForCollection(Class pVarClass, Object pVar, Object pCollection) { 676 return addForCollection(JavaQNameImpl.getInstance(pVarClass), pVar, pCollection); 677 } 678 public DirectAccessible addForCollection(Object pVar, Object pCollection) { 679 return addForCollection(Iterator .class, pVar, pCollection); 680 } 681 public DirectAccessible addForCollection(JavaQName pVarClass, Object pCollection) { 682 return addForCollection(pVarClass, getLocalVariableName(), pCollection); 683 } 684 public DirectAccessible addForCollection(Class pVarClass, Object pCollection) { 685 return addForCollection(pVarClass, getLocalVariableName(), pCollection); 686 } 687 public DirectAccessible addForCollection(Object pCollection) { 688 return addForCollection(Iterator .class, pCollection); 689 } 690 691 public void addEndFor() { 692 unindent(); 693 addLine("}"); 694 } 695 public void addFor(Object pToken1) { 696 addFor(new Object []{pToken1}); 697 } 698 public void addFor(Object pToken1, Object pToken2) { 699 addFor(new Object []{pToken1, pToken2}); 700 } 701 public void addFor(Object pToken1, Object pToken2, Object pToken3) { 702 addFor(new Object []{pToken1, pToken2, pToken3}); 703 } 704 public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4) { 705 addFor(new Object []{pToken1, pToken2, pToken3, pToken4}); 706 } 707 public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 708 Object pToken5) { 709 addFor(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5}); 710 } 711 public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 712 Object pToken5, Object pToken6) { 713 addFor(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6}); 714 } 715 public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 716 Object pToken5, Object pToken6, Object pToken7) { 717 addFor(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 718 pToken7}); 719 } 720 public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 721 Object pToken5, Object pToken6, Object pToken7, Object pToken8) { 722 addFor(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 723 pToken7, pToken8}); 724 } 725 public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 726 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 727 Object pToken9) { 728 addFor(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 729 pToken7, pToken8, pToken9}); 730 } 731 public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 732 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 733 Object pToken9, Object pToken10) { 734 addFor(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 735 pToken7, pToken8, pToken9, pToken10}); 736 } 737 public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 738 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 739 Object pToken9, Object pToken10, Object pToken11) { 740 addFor(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 741 pToken7, pToken8, pToken9, pToken10, pToken11}); 742 } 743 public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 744 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 745 Object pToken9, Object pToken10, Object pToken11, Object pToken12) { 746 addFor(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 747 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12}); 748 } 749 public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 750 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 751 Object pToken9, Object pToken10, Object pToken11, Object pToken12, 752 Object pToken13) { 753 addFor(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 754 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 755 pToken13}); 756 } 757 public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 758 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 759 Object pToken9, Object pToken10, Object pToken11, Object pToken12, 760 Object pToken13, Object pToken14) { 761 addFor(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 762 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 763 pToken13, pToken14}); 764 } 765 public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 766 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 767 Object pToken9, Object pToken10, Object pToken11, Object pToken12, 768 Object pToken13, Object pToken14, Object pToken15) { 769 addFor(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 770 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 771 pToken13, pToken14, pToken15}); 772 } 773 774 776 public void addWhile(Object [] pExpr) { 777 addLine("while (", pExpr, ") {"); 778 indent(); 779 } 780 782 public void addWhileIterator(Object pIterator) { 783 addWhile(new Object []{"(", pIterator, ").hasNext()"}); 784 } 785 787 public void addEndWhile() { 788 unindent(); 789 addLine("}"); 790 } 791 public void addWhile(Object pToken1) { 792 addWhile(new Object []{pToken1}); 793 } 794 public void addWhile(Object pToken1, Object pToken2) { 795 addWhile(new Object []{pToken1, pToken2}); 796 } 797 public void addWhile(Object pToken1, Object pToken2, Object pToken3) { 798 addWhile(new Object []{pToken1, pToken2, pToken3}); 799 } 800 public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4) { 801 addWhile(new Object []{pToken1, pToken2, pToken3, pToken4}); 802 } 803 public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 804 Object pToken5) { 805 addWhile(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5}); 806 } 807 public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 808 Object pToken5, Object pToken6) { 809 addWhile(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6}); 810 } 811 public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 812 Object pToken5, Object pToken6, Object pToken7) { 813 addWhile(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 814 pToken7}); 815 } 816 public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 817 Object pToken5, Object pToken6, Object pToken7, Object pToken8) { 818 addWhile(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 819 pToken7, pToken8}); 820 } 821 public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 822 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 823 Object pToken9) { 824 addWhile(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 825 pToken7, pToken8, pToken9}); 826 } 827 public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 828 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 829 Object pToken9, Object pToken10) { 830 addWhile(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 831 pToken7, pToken8, pToken9, pToken10}); 832 } 833 public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 834 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 835 Object pToken9, Object pToken10, Object pToken11) { 836 addWhile(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 837 pToken7, pToken8, pToken9, pToken10, pToken11}); 838 } 839 public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 840 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 841 Object pToken9, Object pToken10, Object pToken11, Object pToken12) { 842 addWhile(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 843 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12}); 844 } 845 public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 846 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 847 Object pToken9, Object pToken10, Object pToken11, Object pToken12, 848 Object pToken13) { 849 addWhile(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 850 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 851 pToken13}); 852 } 853 public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 854 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 855 Object pToken9, Object pToken10, Object pToken11, Object pToken12, 856 Object pToken13, Object pToken14) { 857 addWhile(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 858 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 859 pToken13, pToken14}); 860 } 861 public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4, 862 Object pToken5, Object pToken6, Object pToken7, Object pToken8, 863 Object pToken9, Object pToken10, Object pToken11, Object pToken12, 864 Object pToken13, Object pToken14, Object pToken15) { 865 addWhile(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 866 pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, 867 pToken13, pToken14, pToken15}); 868 } 869 870 public void addSwitch(Object [] pTokens) { 871 addLine("switch (", pTokens, ") {"); 872 indent(); 873 indent(); 874 } 875 public void addSwitch(Object pToken1) { 876 addSwitch(new Object []{pToken1}); 877 } 878 public void addSwitch(Object pToken1, Object pToken2) { 879 addSwitch(new Object []{pToken1, pToken2}); 880 } 881 public void addSwitch(Object pToken1, Object pToken2, Object pToken3) { 882 addSwitch(new Object []{pToken1, pToken2, pToken3}); 883 } 884 public void addSwitch(Object pToken1, Object pToken2, Object pToken3, 885 Object pToken4) { 886 addSwitch(new Object []{pToken1, pToken2, pToken3, pToken4}); 887 } 888 public void addSwitch(Object pToken1, Object pToken2, Object pToken3, 889 Object pToken4, Object pToken5) { 890 addSwitch(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5}); 891 } 892 public void addSwitch(Object pToken1, Object pToken2, Object pToken3, 893 Object pToken4, Object pToken5, Object pToken6) { 894 addSwitch(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, 895 pToken6}); 896 } 897 public void addSwitch(Object pToken1, Object pToken2, Object pToken3, 898 Object pToken4, Object pToken5, Object pToken6, 899 Object pToken7) { 900 addSwitch(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, 901 pToken6, pToken7}); 902 } 903 public void addSwitch(Object pToken1, Object pToken2, Object pToken3, 904 Object pToken4, Object pToken5, Object pToken6, 905 Object pToken7, Object pToken8) { 906 addSwitch(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, 907 pToken6, pToken7, pToken8}); 908 } 909 public void addSwitch(Object pToken1, Object pToken2, Object pToken3, 910 Object pToken4, Object pToken5, Object pToken6, 911 Object pToken7, Object pToken8, Object pToken9) { 912 addSwitch(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, 913 pToken6, pToken7, pToken8, pToken9}); 914 } 915 public void addSwitch(Object pToken1, Object pToken2, Object pToken3, 916 Object pToken4, Object pToken5, Object pToken6, 917 Object pToken7, Object pToken8, Object pToken9, 918 Object pToken10) { 919 addSwitch(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, 920 pToken6, pToken7, pToken8, pToken9, pToken10}); 921 } 922 public void addSwitch(Object pToken1, Object pToken2, Object pToken3, 923 Object pToken4, Object pToken5, Object pToken6, 924 Object pToken7, Object pToken8, Object pToken9, 925 Object pToken10, Object pToken11) { 926 addSwitch(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, 927 pToken6, pToken7, pToken8, pToken9, pToken10, 928 pToken11}); 929 } 930 public void addSwitch(Object pToken1, Object pToken2, Object pToken3, 931 Object pToken4, Object pToken5, Object pToken6, 932 Object pToken7, Object pToken8, Object pToken9, 933 Object pToken10, Object pToken11, Object pToken12) { 934 addSwitch(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, 935 pToken6, pToken7, pToken8, pToken9, pToken10, 936 pToken11, pToken12}); 937 } 938 public void addSwitch(Object pToken1, Object pToken2, Object pToken3, 939 Object pToken4, Object pToken5, Object pToken6, 940 Object pToken7, Object pToken8, Object pToken9, 941 Object pToken10, Object pToken11, Object pToken12, 942 Object pToken13) { 943 addSwitch(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, 944 pToken6, pToken7, pToken8, pToken9, pToken10, 945 pToken11, pToken12, pToken13}); 946 } 947 public void addSwitch(Object pToken1, Object pToken2, Object pToken3, 948 Object pToken4, Object pToken5, Object pToken6, 949 Object pToken7, Object pToken8, Object pToken9, 950 Object pToken10, Object pToken11, Object pToken12, 951 Object pToken13, Object pToken14) { 952 addSwitch(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, 953 pToken6, pToken7, pToken8, pToken9, pToken10, 954 pToken11, pToken12, pToken13, pToken14}); 955 } 956 public void addSwitch(Object pToken1, Object pToken2, Object pToken3, 957 Object pToken4, Object pToken5, Object pToken6, 958 Object pToken7, Object pToken8, Object pToken9, 959 Object pToken10, Object pToken11, Object pToken12, 960 Object pToken13, Object pToken14, Object pToken15) { 961 addSwitch(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, 962 pToken6, pToken7, pToken8, pToken9, pToken10, 963 pToken11, pToken12, pToken13, pToken14, pToken15}); 964 } 965 966 public void addCase(Object [] pTokens) { 967 unindent(); 968 addLine("case ", pTokens, ":"); 969 indent(); 970 } 971 public void addCase(Object pToken1) { 972 addCase(new Object []{pToken1}); 973 } 974 public void addCase(Object pToken1, Object pToken2) { 975 addCase(new Object []{pToken1, pToken2}); 976 } 977 public void addCase(Object pToken1, Object pToken2, Object pToken3) { 978 addCase(new Object []{pToken1, pToken2, pToken3}); 979 } 980 public void addCase(Object pToken1, Object pToken2, Object pToken3, 981 Object pToken4) { 982 addCase(new Object []{pToken1, pToken2, pToken3, pToken4}); 983 } 984 public void addCase(Object pToken1, Object pToken2, Object pToken3, 985 Object pToken4, Object pToken5) { 986 addCase(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5}); 987 } 988 public void addCase(Object pToken1, Object pToken2, Object pToken3, 989 Object pToken4, Object pToken5, Object pToken6) { 990 addCase(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6}); 991 } 992 public void addCase(Object pToken1, Object pToken2, Object pToken3, 993 Object pToken4, Object pToken5, Object pToken6, 994 Object pToken7) { 995 addCase(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 996 pToken7}); 997 } 998 public void addCase(Object pToken1, Object pToken2, Object pToken3, 999 Object pToken4, Object pToken5, Object pToken6, 1000 Object pToken7, Object pToken8) { 1001 addCase(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 1002 pToken7, pToken8}); 1003 } 1004 public void addCase(Object pToken1, Object pToken2, Object pToken3, 1005 Object pToken4, Object pToken5, Object pToken6, 1006 Object pToken7, Object pToken8, Object pToken9) { 1007 addCase(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 1008 pToken7, pToken8, pToken9}); 1009 } 1010 public void addCase(Object pToken1, Object pToken2, Object pToken3, 1011 Object pToken4, Object pToken5, Object pToken6, 1012 Object pToken7, Object pToken8, Object pToken9, 1013 Object pToken10) { 1014 addCase(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 1015 pToken7, pToken8, pToken9, pToken10}); 1016 } 1017 public void addCase(Object pToken1, Object pToken2, Object pToken3, 1018 Object pToken4, Object pToken5, Object pToken6, 1019 Object pToken7, Object pToken8, Object pToken9, 1020 Object pToken10, Object pToken11) { 1021 addCase(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 1022 pToken7, pToken8, pToken9, pToken10, pToken11}); 1023 } 1024 public void addCase(Object pToken1, Object pToken2, Object pToken3, 1025 Object pToken4, Object pToken5, Object pToken6, 1026 Object pToken7, Object pToken8, Object pToken9, 1027 Object pToken10, Object pToken11, Object pToken12) { 1028 addCase(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 1029 pToken7, pToken8, pToken9, pToken10, pToken11, 1030 pToken12}); 1031 } 1032 public void addCase(Object pToken1, Object pToken2, Object pToken3, 1033 Object pToken4, Object pToken5, Object pToken6, 1034 Object pToken7, Object pToken8, Object pToken9, 1035 Object pToken10, Object pToken11, Object pToken12, 1036 Object pToken13) { 1037 addCase(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 1038 pToken7, pToken8, pToken9, pToken10, pToken11, 1039 pToken12, pToken13}); 1040 } 1041 public void addCase(Object pToken1, Object pToken2, Object pToken3, 1042 Object pToken4, Object pToken5, Object pToken6, 1043 Object pToken7, Object pToken8, Object pToken9, 1044 Object pToken10, Object pToken11, Object pToken12, 1045 Object pToken13, Object pToken14) { 1046 addCase(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 1047 pToken7, pToken8, pToken9, pToken10, pToken11, 1048 pToken12, pToken13, pToken14}); 1049 } 1050 public void addCase(Object pToken1, Object pToken2, Object pToken3, 1051 Object pToken4, Object pToken5, Object pToken6, 1052 Object pToken7, Object pToken8, Object pToken9, 1053 Object pToken10, Object pToken11, Object pToken12, 1054 Object pToken13, Object pToken14, Object pToken15) { 1055 addCase(new Object []{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, 1056 pToken7, pToken8, pToken9, pToken10, pToken11, 1057 pToken12, pToken13, pToken14, pToken15}); 1058 } 1059 1060 public void addDefault() { 1061 unindent(); 1062 addLine("default:"); 1063 indent(); 1064 } 1065 1066 public void addBreak() { 1067 addLine("break;"); 1068 } 1069 1070 public void addEndSwitch() { 1071 unindent(); 1072 unindent(); 1073 addLine("}"); 1074 } 1075 public String getLocalVariableName() { 1076 return "_" + ++localVariableCounter; 1077 } 1078 1079 protected abstract void writeHeader(IndentationTarget pTarget) 1080 throws IOException ; 1081 1082 public void write(IndentationTarget pTarget) throws IOException { 1083 JavaComment jc = getComment(); 1084 if (jc != null) { 1085 jc.write(pTarget); 1086 pTarget.indent(0); 1087 } 1088 writeHeader(pTarget); 1089 if (!pTarget.isInterface() && !isAbstract()) { 1090 super.write(new IncreasingTarget(pTarget)); 1091 pTarget.indent(0); 1092 pTarget.write("}"); 1093 pTarget.write(); 1094 } 1095 } 1096 1097 public void write(IndentationTarget pTarget, Object pObject) 1098 throws IOException { 1099 if (pObject instanceof LocalJavaFieldDeclaration) { 1100 LJFImpl f = ((LocalJavaFieldDeclaration) pObject).field; 1101 f.writeNoEol(pTarget); 1102 } else { 1103 super.write(pTarget, pObject); 1104 } 1105 } 1106 1107 1110 public LocalJavaField newJavaField(Class pType, String pName) { 1111 return newJavaField(JavaQNameImpl.getInstance(pType), pName); 1112 } 1113 1114 1117 public LocalJavaField newJavaField(JavaQName pType, String pName) { 1118 LJFImpl result = new LJFImpl(pType, pName); 1119 addLine(new LocalJavaFieldDeclaration(result)); 1120 return result; 1121 } 1122 1123 1127 public LocalJavaField newJavaField(JavaQName pType) { 1128 return newJavaField(pType, getLocalVariableName()); 1129 } 1130 1131 1135 public LocalJavaField newJavaField(Class pType) { 1136 return newJavaField(pType, getLocalVariableName()); 1137 } 1138} 1139 | Popular Tags |