private Blaming findBlaming(TemplateObject parent, Expression blamed, int recursionDepth) { // Just in case a loop ever gets into the AST somehow, try not fill the stack and such: if (recursionDepth > 50) return null; int paramCnt = parent.getParameterCount(); for (int i = 0; i < paramCnt; i++) { Object paramValue = parent.getParameterValue(i); if (paramValue == blamed) { Blaming blaming = new Blaming(); blaming.blamer = parent; blaming.roleOfblamed = parent.getParameterRole(i); return blaming; } else if (paramValue instanceof TemplateObject) { Blaming blaming = findBlaming((TemplateObject) paramValue, blamed, recursionDepth + 1); if (blaming != null) return blaming; } } return null; }
private Blaming findBlaming(TemplateObject parent, Expression blamed, int recursionDepth) { // Just in case a loop ever gets into the AST somehow, try not fill the stack and such: if (recursionDepth > 50) return null; int paramCnt = parent.getParameterCount(); for (int i = 0; i < paramCnt; i++) { Object paramValue = parent.getParameterValue(i); if (paramValue == blamed) { Blaming blaming = new Blaming(); blaming.blamer = parent; blaming.roleOfblamed = parent.getParameterRole(i); return blaming; } else if (paramValue instanceof TemplateObject) { Blaming blaming = findBlaming((TemplateObject) paramValue, blamed, recursionDepth + 1); if (blaming != null) return blaming; } } return null; }
private Blaming findBlaming(TemplateObject parent, Expression blamed, int recursionDepth) { // Just in case a loop ever gets into the AST somehow, try not fill the stack and such: if (recursionDepth > 50) return null; int paramCnt = parent.getParameterCount(); for (int i = 0; i < paramCnt; i++) { Object paramValue = parent.getParameterValue(i); if (paramValue == blamed) { Blaming blaming = new Blaming(); blaming.blamer = parent; blaming.roleOfblamed = parent.getParameterRole(i); return blaming; } else if (paramValue instanceof TemplateObject) { Blaming blaming = findBlaming((TemplateObject) paramValue, blamed, recursionDepth + 1); if (blaming != null) return blaming; } } return null; }