MCPcopy Index your code
hub / github.com/benfry/processing4 / getChildRecursive

Method getChildRecursive

core/src/processing/data/XML.java:499–522  ·  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

497 * @author processing.org
498 */
499 protected XML getChildRecursive(String[] items, int offset) {
500 // if it's a number, do an index instead
501 if (Character.isDigit(items[offset].charAt(0))) {
502 XML kid = getChild(Integer.parseInt(items[offset]));
503 if (offset == items.length-1) {
504 return kid;
505 } else {
506 return kid.getChildRecursive(items, offset+1);
507 }
508 }
509 int childCount = getChildCount();
510 for (int i = 0; i < childCount; i++) {
511 XML kid = getChild(i);
512 String kidName = kid.getName();
513 if (kidName != null && kidName.equals(items[offset])) {
514 if (offset == items.length-1) {
515 return kid;
516 } else {
517 return kid.getChildRecursive(items, offset+1);
518 }
519 }
520 }
521 return null;
522 }
523
524
525 /**

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