Class Position

    • Field Detail

      • line

        public final int line
      • column

        public final int column
      • HOME

        public static final Position HOME
        The first position in the file
    • Constructor Detail

      • Position

        public Position​(int line,
                        int column)
    • Method Detail

      • pos

        public static Position pos​(int line,
                                   int column)
        Convenient factory method.
      • withColumn

        public Position withColumn​(int column)
      • withLine

        public Position withLine​(int line)
      • right

        public Position right​(int characters)
        Returns:
        a position that is "characters" characters more to the right than this position.
      • nextLine

        public Position nextLine()
        Returns:
        a position that is on the start of the next line from this position.
      • valid

        public boolean valid()
        Check if the position is usable. Does not know what it is pointing at, so it can't check if the position is after the end of the source.
      • invalid

        public boolean invalid()
      • isAfter

        public boolean isAfter​(Position position)
      • isAfterOrEqual

        public boolean isAfterOrEqual​(Position position)
      • isBefore

        public boolean isBefore​(Position position)
      • isBeforeOrEqual

        public boolean isBeforeOrEqual​(Position position)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object