AstNode.PositionComparator (rhino 1.7.7.2 API)
Date: 2017-09-27

org.mozilla.javascript.ast

## Class AstNode.PositionComparator

- java.lang.Object
- - org.mozilla.javascript.ast.AstNode.PositionComparator

- All Implemented Interfaces:
    java.io.Serializable, java.util.Comparator<AstNode>
  Enclosing class:
    AstNode

      public static class AstNode.PositionComparator
      extends java.lang.Object
      implements java.util.Comparator<AstNode>, java.io.Serializable

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PositionComparator()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compare(AstNode n1, AstNode n2)` Sorts nodes by (relative) start position.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Comparator

      `comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

- - ### Constructor Detail

    - #### PositionComparator

          public PositionComparator()

  - ### Method Detail

    - #### compare

          public int compare(AstNode n1,
                             AstNode n2)

      Sorts nodes by (relative) start position. The start positions are relative to their parent, so this comparator is only meaningful for comparing siblings.
      Specified by:
        `compare` in interface `java.util.Comparator<AstNode>`