/** * Traverses through the child trees. * @return true, if no cyclic references are found (everything seems to be OK), otherwise false. */ public boolean checkCyclicReferences() { return checkCyclicReferences(0); }
private boolean checkCyclicReferences(final int depth) { if (depth > MAX_DEPTH) { // Maximum of allowed depth exceeded. return false; } if (this.children == null) { return true; } for (final GanttTask child : this.children) { if (((GanttTaskImpl) child).checkCyclicReferences(depth + 1) == false) { return false; } } return true; }