private void visitNode(INode node) { if (result != null) { return; } if (logger.isDebugEnabled()) logger.debug("Visiting node: " + node.getLabel() + " with path steps: " + pathSteps); if (node.isVirtual()) { if (logger.isDebugEnabled()) logger.debug("Node is virtual. Visiting children"); visitChildren(node); return; } String firstStepLabel = pathSteps.get(0); if (!node.getLabel().equals(firstStepLabel)) { return; } if (logger.isDebugEnabled()) logger.debug("Match found, removing step " + pathSteps.get(0)); pathSteps.remove(0); if (pathSteps.isEmpty()) { if (logger.isDebugEnabled()) logger.debug("Steps empty, node found"); this.result = node; return; } for (INode child : node.getChildren()) { child.accept(this); } }
private void visitChildren(INode node) { for (INode child : node.getChildren()) { child.accept(this); } }