public final class PositionUtils extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
areInOrder(Node a,
Node b) |
static boolean |
areInOrder(Node a,
Node b,
boolean ignoringAnnotations) |
static AnnotationExpr |
getLastAnnotation(Node node) |
static boolean |
nodeContains(Node container,
Node other,
boolean ignoringAnnotations)
Compare the position of two nodes.
|
static <T extends Node> |
sortByBeginPosition(List<T> nodes) |
static <T extends Node> |
sortByBeginPosition(List<T> nodes,
boolean ignoringAnnotations) |
static <T extends Node> |
sortByBeginPosition(NodeList<T> nodes) |
public static <T extends Node> void sortByBeginPosition(List<T> nodes, boolean ignoringAnnotations)
public static AnnotationExpr getLastAnnotation(Node node)
public static boolean nodeContains(Node container, Node other, boolean ignoringAnnotations)
Note that this performs a "strict contains", where the container must extend beyond the other node in both directions (otherwise it would count as an overlap, rather than "contain").
If `ignoringAnnotations` is false, annotations on the container are ignored. For this reason, where `container == other`, the raw `other` may extend beyond the sans-annotations `container` thus return false.
Copyright © 2007–2023. All rights reserved.