Package com.github.javaparser.utils
Class PositionUtils
java.lang.Object
com.github.javaparser.utils.PositionUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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>
voidsortByBeginPosition(NodeList<T> nodes)
static <T extends Node>
voidsortByBeginPosition(List<T> nodes)
static <T extends Node>
voidsortByBeginPosition(List<T> nodes, boolean ignoringAnnotations)
-
Method Details
-
sortByBeginPosition
-
sortByBeginPosition
-
sortByBeginPosition
-
areInOrder
-
areInOrder
-
getLastAnnotation
-
nodeContains
Compare the position of two nodes. Optionally include annotations within the range checks. This method takes into account whether the nodes are within the same compilation unit.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.
-