Class Range

java.lang.Object
com.google.gwt.core.ext.soyc.Range

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

    Fields
    Modifier and Type
    Field
    Description
    static final Comparator<Range>
    Sorts Ranges so that a Range will be preceded by any Ranges that enclose it.
    (package private) final int
     
    (package private) final int
     
    (package private) final int
     
    static final Comparator<Range>
    Sorts Ranges into the order in which they would appear in the source code based on start position and end position.
    (package private) final com.google.gwt.dev.jjs.SourceInfo
     
    (package private) final int
     
    (package private) final int
     
    (package private) final int
     
  • 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.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Return true if the given Range lies wholly within the Range.
    createNormalizedCopy(int baseStart, int baseStartLine)
    Creates a Range copy whose start position and line number have been rebased relative to some base position.
    createOffsetCopy(int positionOffset, int lineOffset)
    Creates a Range copy whose start position and line number have been moved by some known offset size.
    boolean
     
    int
     
    int
     
    int
     
    com.google.gwt.dev.jjs.SourceInfo
     
    int
     
    int
     
    int
     
    int
     
    int
     
    For debugging use only.
    withNewEnd(int newEnd, int newEndLine, int newEndColumn)
    Returns a copy with the end moved.

    Methods inherited from class java.lang.Object

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

    • DEPENDENCY_ORDER_COMPARATOR

      public static final 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 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 Details

    • 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 Details

    • 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(Object obj)
      Overrides:
      equals in class 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 Object
    • length

      public int length()
    • toString

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

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