Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java @ 21651:f4cd6b1c2efc
Truffle: remove NodeUtil.findNodeInstancesShallow
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Mon, 01 Jun 2015 13:49:38 +0200 |
parents | 45ed86c4d127 |
children |
comparison
equal
deleted
inserted
replaced
21650:45ed86c4d127 | 21651:f4cd6b1c2efc |
---|---|
477 } | 477 } |
478 }); | 478 }); |
479 return nodeList; | 479 return nodeList; |
480 } | 480 } |
481 | 481 |
482 /** | |
483 * Like {@link #findAllNodeInstances(Node, Class)} but do not visit children of found nodes. | |
484 */ | |
485 public static <T> List<T> findNodeInstancesShallow(final Node root, final Class<T> clazz) { | |
486 final List<T> nodeList = new ArrayList<>(); | |
487 root.accept(new NodeVisitor() { | |
488 public boolean visit(Node node) { | |
489 if (clazz.isInstance(node)) { | |
490 nodeList.add(clazz.cast(node)); | |
491 return false; | |
492 } | |
493 return true; | |
494 } | |
495 }); | |
496 return nodeList; | |
497 } | |
498 | |
499 public static int countNodes(Node root) { | 482 public static int countNodes(Node root) { |
500 return countNodes(root, NodeCountFilter.NO_FILTER); | 483 return countNodes(root, NodeCountFilter.NO_FILTER); |
501 } | 484 } |
502 | 485 |
503 public static int countNodes(Node root, NodeCountFilter filter) { | 486 public static int countNodes(Node root, NodeCountFilter filter) { |