Class Pos


  • public class Pos
    extends java.lang.Object
    Position of a parse-tree node.
    • Constructor Summary

      Constructors 
      Constructor Description
      Pos​(int startLine, int startColumn, int endLine, int endColumn)
      Creates a Pos.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      int hashCode()  
      Pos plus​(Pos pos)  
      Pos plusAll​(java.lang.Iterable<Pos> poses)  
      Pos plusAll​(java.util.List<? extends AstNode> nodes)  
      static <E> Pos sum​(java.lang.Iterable<E> elements, java.util.function.Function<E,​Pos> fn)  
      static Pos sum​(java.lang.Iterable<Pos> poses)
      Combines an iterable of parser positions to create a position which spans from the beginning of the first to the end of the last.
      private static Pos sum​(java.lang.Iterable<Pos> poses, int line, int column, int endLine, int endColumn)
      Computes the parser position which is the sum of an array of parser positions and of a parser position represented by (line, column, endLine, endColumn).
      static Pos sum​(java.util.List<? extends AstNode> nodes)  
      private static Pos sum_​(java.util.List<Pos> positions)
      Combines a list of parser positions to create a position which spans from the beginning of the first to the end of the last.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • ZERO

        public static final Pos ZERO
      • startLine

        public final int startLine
      • startColumn

        public final int startColumn
      • endLine

        public final int endLine
      • endColumn

        public final int endColumn
    • Constructor Detail

      • Pos

        public Pos​(int startLine,
                   int startColumn,
                   int endLine,
                   int endColumn)
        Creates a Pos.
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • sum

        public static Pos sum​(java.lang.Iterable<Pos> poses)
        Combines an iterable of parser positions to create a position which spans from the beginning of the first to the end of the last.
      • sum

        public static <E> Pos sum​(java.lang.Iterable<E> elements,
                                  java.util.function.Function<E,​Pos> fn)
      • sum

        public static Pos sum​(java.util.List<? extends AstNode> nodes)
      • sum_

        private static Pos sum_​(java.util.List<Pos> positions)
        Combines a list of parser positions to create a position which spans from the beginning of the first to the end of the last.
      • sum

        private static Pos sum​(java.lang.Iterable<Pos> poses,
                               int line,
                               int column,
                               int endLine,
                               int endColumn)
        Computes the parser position which is the sum of an array of parser positions and of a parser position represented by (line, column, endLine, endColumn).
        Parameters:
        poses - Array of parser positions
        line - Start line
        column - Start column
        endLine - End line
        endColumn - End column
        Returns:
        Sum of parser positions
      • plus

        public Pos plus​(Pos pos)
      • plusAll

        public Pos plusAll​(java.lang.Iterable<Pos> poses)
      • plusAll

        public Pos plusAll​(@Nonnull
                           java.util.List<? extends AstNode> nodes)