Source:
<code>public FormIndex walk(){ FormIndex currentIndex = step(parentIndex, true); while(indexInScope(currentIndex)){ boolean relevant = fem.isIndexRelevant(currentIndex); if(!relevant){ currentIndex = step(currentIndex, false); break; } JSONObject obj = new JSONObject(); PromptToJson.parseQuestionType(fem, obj); <START> obj.put("relevant", relevant ? 1 : 0); <END> if(obj.get("type").equals("sub-group")){ Walker walker; if(obj.has("caption") && obj.get("caption") != JSONObject.NULL ){ JSONArray childObject = new JSONArray(); walker = new Walker(childObject, currentIndex, fec, fem); obj.put("children", childObject); } else{ walker = new Walker(compiler, currentIndex, fec, fem); } compiler.put(obj); currentIndex = walker.walk(); } else if(obj.get("type").equals("repeat-juncture")){ JSONArray children = new JSONArray(); for(int i = 0; i < fem.getForm().getNumRepetitions(currentIndex); i++){ JSONObject subEvent = new JSONObject(); FormIndex ix = fem.getForm().descendIntoRepeat(currentIndex, i); JSONArray subChildren = new JSONArray(); subEvent.put("type", "sub-group"); subEvent.put("ix", ix); JSONArray repetitionsArray = obj.getJSONArray("repetitions"); subEvent.put("caption", repetitionsArray.get(i)); subEvent.put("repeatable", true); subEvent.put("uuid", ix.getReference()).hashCode(); Walker walker = new Walker(subChildren, ix, fec, fem); walker.walk(); subEvent.put("children", subChildren); children.put(subEvent); } obj.put("children", children); compiler.put(obj); currentIndex = step(currentIndex, true); } else{ compiler.put(obj); currentIndex = step(currentIndex, true); } } return currentIndex; }</code><technical_language>relevant is true</technical_language>

Target:
public FormIndex walk() { FormIndex currentIndex = step(parentIndex, true); while (indexInScope(currentIndex)) { boolean relevant = fem.isIndexRelevant(currentIndex); if (!relevant) { currentIndex = step(currentIndex, false); break; } JSONObject obj = new JSONObject(); PromptToJson.parseQuestionType(fem, obj); if (obj.get("type").equals("sub-group")) { Walker walker; if (obj.has("caption") && obj.get("caption") != JSONObject.NULL) { JSONArray childObject = new JSONArray(); walker = new Walker(childObject, currentIndex, fec, fem); obj.put("children", childObject); } else { walker = new Walker(compiler, currentIndex, fec, fem); } compiler.put(obj); currentIndex = walker.walk(); } else if (obj.get("type").equals("repeat-juncture")) { JSONArray children = new JSONArray(); for (int i = 0; i < fem.getForm().getNumRepetitions(currentIndex); i++) { JSONObject subEvent = new JSONObject(); FormIndex ix = fem.getForm().descendIntoRepeat(currentIndex, i); JSONArray subChildren = new JSONArray(); subEvent.put("type", "sub-group"); subEvent.put("ix", ix); JSONArray repetitionsArray = obj.getJSONArray("repetitions"); subEvent.put("caption", repetitionsArray.get(i)); subEvent.put("repeatable", true); subEvent.put("uuid", ix.getReference()).hashCode(); Walker walker = new Walker(subChildren, ix, fec, fem); walker.walk(); subEvent.put("children", subChildren); children.put(subEvent); } obj.put("children", children); compiler.put(obj); currentIndex = step(currentIndex, true); } else { compiler.put(obj); currentIndex = step(currentIndex, true); } } return currentIndex; }