while (child != null) { printNode(child, prefix + node.getMappingPath(), sb); child = child.getSibling();
while (child != null) { println(child, prefix + node.getMappingPath(), deep + 1, sb); child = child.getSibling();
/** * 检查整个树的状况,尽可能报告可能存在的问题 * * @param tree * @param parent * @param prefix */ private void check(MappingNode tree, MappingNode parent, String prefix) { MappingNode child = parent.getLeftMostChild(); MappingNode sibling = null; while (child != null) { if (sibling != null) { if (child.compareTo(sibling) == 0) { logger.error("mapping conflicts: '" + child.getMapping().getDefinition() + "' conflicts with '" + sibling.getMapping().getDefinition() + "' in '" + prefix + "'; here is the mapping tree, " + "you can find the conflict in it:\n" + PrinteHelper.list(tree)); throw new IllegalArgumentException("mapping conflicts: '" + child.getMapping().getDefinition() + "' conflicts with '" + sibling.getMapping().getDefinition() + "' in '" + prefix + "'"); } } check(tree, child, prefix + child.getMapping().getDefinition()); sibling = child; child = child.getSibling(); } } }
while (child != null) { printNode(child, prefix + node.getMappingPath(), sb); child = child.getSibling();
while (child != null) { println(child, prefix + node.getMappingPath(), deep + 1, sb); child = child.getSibling();
/** * 检查整个树的状况,尽可能报告可能存在的问题 * * @param tree * @param parent * @param prefix */ private void check(MappingNode tree, MappingNode parent, String prefix) { MappingNode child = parent.getLeftMostChild(); MappingNode sibling = null; while (child != null) { if (sibling != null) { if (child.compareTo(sibling) == 0) { logger.error("mapping conflicts: '" + child.getMapping().getDefinition() + "' conflicts with '" + sibling.getMapping().getDefinition() + "' in '" + prefix + "'; here is the mapping tree, " + "you can find the conflict in it:\n" + PrinteHelper.list(tree)); throw new IllegalArgumentException("mapping conflicts: '" + child.getMapping().getDefinition() + "' conflicts with '" + sibling.getMapping().getDefinition() + "' in '" + prefix + "'"); } } check(tree, child, prefix + child.getMapping().getDefinition()); sibling = child; child = child.getSibling(); } } }