Home | History | Annotate | Download | only in lexicalpreservation

Lines Matching refs:node

24 import com.github.javaparser.ast.Node;
41 private static final Map<Node, Boolean> isPhantomNodeCache = synchronizedMap(new IdentityHashMap<>());
45 public void parentChange(Node observedNode, Node previousParent, Node newParent) {
50 static boolean isPhantomNode(Node node) {
51 if (isPhantomNodeCache.containsKey(node)) {
52 return isPhantomNodeCache.get(node);
54 if (node instanceof UnknownType) {
57 boolean res = (node.getParentNode().isPresent() &&
58 !node.getParentNode().get().getRange().get().contains(node.getRange().get())
59 || inPhantomNode(node, LEVELS_TO_EXPLORE));
60 isPhantomNodeCache.put(node, res);
61 node.register(cacheCleaner);
67 * A node contained in a phantom node is also a phantom node. We limit how many levels up we check just for performance reasons.
69 private static boolean inPhantomNode(Node node, int levels) {
70 return node.getParentNode().isPresent() &&
71 (isPhantomNode(node.getParentNode().get())
72 || inPhantomNode(node.getParentNode().get(), levels - 1));