コード例 #1
0
 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);
   }
 }
コード例 #2
0
 private void visitChildren(INode node) {
   for (INode child : node.getChildren()) {
     child.accept(this);
   }
 }
コード例 #3
0
 INode findNodeInSchema(INode startingNode, List<String> pathSteps) {
   FindNodeWithVirtualNodesVisitor visitor = new FindNodeWithVirtualNodesVisitor(pathSteps);
   startingNode.accept(visitor);
   return visitor.getResult();
 }