MCPcopy Create free account
hub / github.com/PCGen/pcgen / buildDependMap

Method buildDependMap

code/src/java/pcgen/core/bonus/BonusObj.java:413–506  ·  view source on GitHub ↗
(String aString)

Source from the content-addressed store, hash-verified

411 public abstract String getBonusHandled();
412
413 private void buildDependMap(String aString)
414 {
415 addImpliedDependenciesFor(aString);
416
417 // First whack out all the () pairs to find variable names
418 while (aString.lastIndexOf('(') >= 0)
419 {
420 final int x = CoreUtility.innerMostStringStart(aString);
421 final int y = CoreUtility.innerMostStringEnd(aString);
422
423 if (y < x)
424 {
425 return;
426 }
427
428 final String bString = aString.substring(x + 1, y);
429 buildDependMap(bString);
430 aString = aString.substring(0, x)
431 + aString.substring(y + 1);
432 }
433
434 if (aString.indexOf('(') >= 0 || aString.indexOf(')') >= 0 || aString.indexOf('%') >= 0)
435 {
436 return;
437 }
438
439 // We now have the substring we want to work on
440 final StringTokenizer cTok = new StringTokenizer(aString, ".,");
441
442 while (cTok.hasMoreTokens())
443 {
444 final String controlString = cTok.nextToken();
445
446 // skip flow control tags
447 if ("IF".equals(controlString) || "THEN".equals(controlString) || "ELSE".equals(controlString)
448 || "GT".equals(controlString) || "GTEQ".equals(controlString) || "EQ".equals(controlString)
449 || "LTEQ".equals(controlString) || "LT".equals(controlString))
450 {
451 continue;
452 }
453
454 // Now remove math strings: + - / *
455 // and comparison strings: > = <
456 // remember, a StringTokenizer will tokenize
457 // on any of the found delimiters
458 final StringTokenizer mTok = new StringTokenizer(controlString, "+-/*>=<\"");
459
460 while (mTok.hasMoreTokens())
461 {
462 String newString = mTok.nextToken();
463 String testString = newString;
464 boolean found = false;
465
466 // now Check for MIN or MAX
467 while (!found)
468 {
469 if (newString.contains("MAX"))
470 {

Callers 1

setValueMethod · 0.95

Calls 11

innerMostStringStartMethod · 0.95
innerMostStringEndMethod · 0.95
hasMoreTokensMethod · 0.80
nextTokenMethod · 0.80
lastIndexOfMethod · 0.65
indexOfMethod · 0.65
equalsMethod · 0.65
containsMethod · 0.65
isEmptyMethod · 0.65
putMethod · 0.65

Tested by

no test coverage detected