Class Range


  • public final class Range
    extends java.lang.Object
    Represents a contiguous region of characters in the compiler output.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.Comparator<Range> DEPENDENCY_ORDER_COMPARATOR
      Sorts Ranges so that a Range will be preceded by any Ranges that enclose it.
      (package private) int end  
      (package private) int endColumn  
      (package private) int endLine  
      static java.util.Comparator<Range> SOURCE_ORDER_COMPARATOR
      Sorts Ranges into the order in which they would appear in the source code based on start position and end position.
      (package private) com.google.gwt.dev.jjs.SourceInfo sourceInfo  
      (package private) int start  
      (package private) int startColumn  
      (package private) int startLine  
    • Constructor Summary

      Constructors 
      Constructor Description
      Range​(int start, int end)
      Constructor.
      Range​(int start, int end, int startLine, int startColumn, int endLine, int endColumn, com.google.gwt.dev.jjs.SourceInfo sourceInfo)
      A range whose start and end are specified both as character positions and as line numbers and columns.
      Range​(int start, int end, com.google.gwt.dev.jjs.SourceInfo sourceInfo)
      Constructor.
    • Field Detail

      • DEPENDENCY_ORDER_COMPARATOR

        public static final java.util.Comparator<Range> DEPENDENCY_ORDER_COMPARATOR
        Sorts Ranges so that a Range will be preceded by any Ranges that enclose it.
      • SOURCE_ORDER_COMPARATOR

        public static final java.util.Comparator<Range> SOURCE_ORDER_COMPARATOR
        Sorts Ranges into the order in which they would appear in the source code based on start position and end position.
      • end

        final int end
      • endColumn

        final int endColumn
      • endLine

        final int endLine
      • start

        final int start
      • startColumn

        final int startColumn
      • startLine

        final int startLine
      • sourceInfo

        final com.google.gwt.dev.jjs.SourceInfo sourceInfo
    • Constructor Detail

      • Range

        public Range​(int start,
                     int end)
        Constructor.
        Parameters:
        start - must be non-negative
        end - must be greater than or equal to start
      • Range

        public Range​(int start,
                     int end,
                     com.google.gwt.dev.jjs.SourceInfo sourceInfo)
        Constructor.
        Parameters:
        start - must be non-negative
        end - must be greater than or equal to start
      • Range

        public Range​(int start,
                     int end,
                     int startLine,
                     int startColumn,
                     int endLine,
                     int endColumn,
                     com.google.gwt.dev.jjs.SourceInfo sourceInfo)
        A range whose start and end are specified both as character positions and as line numbers and columns. Everything is zero-based (similar to Java arrays). The ending position must be greater or equal to the starting position.
        Parameters:
        start - must be non-negative
        end - must be greater than or equal to start
    • Method Detail

      • contains

        public boolean contains​(Range o)
        Return true if the given Range lies wholly within the Range.
      • createNormalizedCopy

        public Range createNormalizedCopy​(int baseStart,
                                          int baseStartLine)
        Creates a Range copy whose start position and line number have been rebased relative to some base position.

        For example a range that starts at byte 5342 when normalized against a base start of 5000 will now start at byte 342.

      • createOffsetCopy

        public Range createOffsetCopy​(int positionOffset,
                                      int lineOffset)
        Creates a Range copy whose start position and line number have been moved by some known offset size.

        For example a range that starts at byte 342 when moved by an offset of 5000 will now start at byte 5342.

      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • getEnd

        public int getEnd()
      • getEndColumn

        public int getEndColumn()
      • getEndLine

        public int getEndLine()
      • getSourceInfo

        public com.google.gwt.dev.jjs.SourceInfo getSourceInfo()
      • getStart

        public int getStart()
      • getStartColumn

        public int getStartColumn()
      • getStartLine

        public int getStartLine()
      • hashCode

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

        public int length()
      • toString

        public java.lang.String toString()
        For debugging use only.
        Overrides:
        toString in class java.lang.Object
      • withNewEnd

        public Range withNewEnd​(int newEnd,
                                int newEndLine,
                                int newEndColumn)
        Returns a copy with the end moved.