MCPcopy Index your code
hub / github.com/processing/processing / getChildRecursive

Method getChildRecursive

core/src/processing/data/XML.java:486–509  ·  view source on GitHub ↗

Internal helper function for getChild(String). @param items result of splitting the query on slashes @param offset where in the items[] array we're currently looking @return matching element or null if no match @author processing.org

(String[] items, int offset)

Source from the content-addressed store, hash-verified

484 * @author processing.org
485 */
486 protected XML getChildRecursive(String[] items, int offset) {
487 // if it's a number, do an index instead
488 if (Character.isDigit(items[offset].charAt(0))) {
489 XML kid = getChild(Integer.parseInt(items[offset]));
490 if (offset == items.length-1) {
491 return kid;
492 } else {
493 return kid.getChildRecursive(items, offset+1);
494 }
495 }
496 int childCount = getChildCount();
497 for (int i = 0; i < childCount; i++) {
498 XML kid = getChild(i);
499 String kidName = kid.getName();
500 if (kidName != null && kidName.equals(items[offset])) {
501 if (offset == items.length-1) {
502 return kid;
503 } else {
504 return kid.getChildRecursive(items, offset+1);
505 }
506 }
507 }
508 return null;
509 }
510
511
512 /**

Callers 1

getChildMethod · 0.95

Calls 5

getChildMethod · 0.95
getChildCountMethod · 0.95
getNameMethod · 0.95
parseIntMethod · 0.80
equalsMethod · 0.45

Tested by

no test coverage detected