Skip to content

Commit c5da448

Browse files
committed
Use non-deprecated methods of Node
1 parent bb03c0b commit c5da448

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src/main/java/net/sourceforge/pmd/util/fxdesigner/util/AstTraversalUtil.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ private AstTraversalUtil() {
3434

3535
public static Node getRoot(Node n) {
3636
return n == null ? null
37-
: n.jjtGetParent() == null
38-
? n : getRoot(n.jjtGetParent());
37+
: n.getParent() == null
38+
? n : getRoot(n.getParent());
3939
}
4040

4141
/**
@@ -86,7 +86,7 @@ public static Optional<Node> mapToMyTree(final Node myRoot, final Node node, Tex
8686
* @param newRoot Not null
8787
*/
8888
public static Optional<Node> findOldNodeInNewAst(final Node oldSelection, final Node newRoot) {
89-
if (oldSelection.jjtGetParent() == null) {
89+
if (oldSelection.getParent() == null) {
9090
return Optional.of(newRoot);
9191
}
9292

@@ -98,10 +98,10 @@ public static Optional<Node> findOldNodeInNewAst(final Node oldSelection, final
9898

9999
for (Node step : toIterable(pathFromOldRoot)) {
100100

101-
int n = step.jjtGetChildIndex();
101+
int n = step.getIndexInParent();
102102

103-
if (n >= 0 && n < currentNewNode.jjtGetNumChildren()) {
104-
currentNewNode = currentNewNode.jjtGetChild(n);
103+
if (n >= 0 && n < currentNewNode.getNumChildren()) {
104+
currentNewNode = currentNewNode.getChild(n);
105105
} else {
106106
return Optional.empty();
107107
}
@@ -115,7 +115,7 @@ public static Optional<Node> findOldNodeInNewAst(final Node oldSelection, final
115115
* Returns an iterator over the parents of the given node, in innermost to outermost order.
116116
*/
117117
public static Iterator<Node> parentIterator(Node deepest, boolean includeSelf) {
118-
return iteratorFrom(deepest, n -> n.jjtGetParent() != null, Node::jjtGetParent, includeSelf);
118+
return iteratorFrom(deepest, n -> n.getParent() != null, Node::getParent, includeSelf);
119119
}
120120

121121
/**

src/main/java/net/sourceforge/pmd/util/fxdesigner/util/codearea/PmdCoordinatesSystem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ private static Node findNodeRec(Node subject, TextPos2D target) {
134134
private static Node binarySearchInChildren(Node parent, TextPos2D target) {
135135

136136
int low = 0;
137-
int high = parent.jjtGetNumChildren() - 1;
137+
int high = parent.getNumChildren() - 1;
138138

139139
while (low <= high) {
140140
int mid = (low + high) / 2;
141-
Node child = parent.jjtGetChild(mid);
141+
Node child = parent.getChild(mid);
142142
int cmp = startPosition(child).compareTo(target);
143143

144144
if (cmp < 0) {

src/main/java/net/sourceforge/pmd/util/fxdesigner/util/controls/ASTTreeItem.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ static ASTTreeItem buildRoot(Node n) {
127127
/** Builds an ASTTreeItem recursively from a node. */
128128
private static ASTTreeItem buildRootImpl(Node n, MutableInt idx) {
129129
ASTTreeItem item = new ASTTreeItem(n, idx.getAndIncrement());
130-
if (n.jjtGetNumChildren() > 0) {
131-
for (int i = 0; i < n.jjtGetNumChildren(); i++) {
132-
item.getChildren().add(buildRootImpl(n.jjtGetChild(i), idx));
130+
if (n.getNumChildren() > 0) {
131+
for (int i = 0; i < n.getNumChildren(); i++) {
132+
item.getChildren().add(buildRootImpl(n.getChild(i), idx));
133133
}
134134
}
135135
return item;

src/main/java/net/sourceforge/pmd/util/fxdesigner/util/controls/NodeParentageCrumbBar.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public void setFocusNode(final Node newSelection, DataHolder options) {
192192
@SuppressWarnings("unchecked")
193193
TreeItem<Node> userData = (TreeItem<Node>) child.getUserData();
194194
userData.setValue(cur);
195-
cur = cur.jjtGetParent();
195+
cur = cur.getParent();
196196
}
197197
}
198198
}
@@ -208,7 +208,7 @@ public void setFocusNode(final Node newSelection, DataHolder options) {
208208
private void setDeepestNode(Node node, Function<Node, Double> widthEstimator) {
209209
TreeItem<Node> deepest = new TreeItem<>(node);
210210
TreeItem<Node> current = deepest;
211-
Node parent = node.jjtGetParent();
211+
Node parent = node.getParent();
212212
double pathLength = widthEstimator.apply(node);
213213

214214
final double maxPathLength = getWidth() * 0.9;
@@ -218,7 +218,7 @@ private void setDeepestNode(Node node, Function<Node, Double> widthEstimator) {
218218
newItem.getChildren().add(current);
219219
current = newItem;
220220
pathLength += widthEstimator.apply(parent);
221-
parent = current.getValue().jjtGetParent();
221+
parent = current.getValue().getParent();
222222
}
223223

224224
if (pathLength >= maxPathLength

0 commit comments

Comments
 (0)