Package com.google.gwt.core.ext.soyc
Class Range
- java.lang.Object
-
- com.google.gwt.core.ext.soyc.Range
-
public final class Range extends java.lang.ObjectRepresents a contiguous region of characters in the compiler output.
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Comparator<Range>DEPENDENCY_ORDER_COMPARATORSorts Ranges so that a Range will be preceded by any Ranges that enclose it.(package private) intend(package private) intendColumn(package private) intendLinestatic java.util.Comparator<Range>SOURCE_ORDER_COMPARATORSorts 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.SourceInfosourceInfo(package private) intstart(package private) intstartColumn(package private) intstartLine
-
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(Range o)Returntrueif the given Range lies wholly within the Range.RangecreateNormalizedCopy(int baseStart, int baseStartLine)Creates a Range copy whose start position and line number have been rebased relative to some base position.RangecreateOffsetCopy(int positionOffset, int lineOffset)Creates a Range copy whose start position and line number have been moved by some known offset size.booleanequals(java.lang.Object obj)intgetEnd()intgetEndColumn()intgetEndLine()com.google.gwt.dev.jjs.SourceInfogetSourceInfo()intgetStart()intgetStartColumn()intgetStartLine()inthashCode()intlength()java.lang.StringtoString()For debugging use only.RangewithNewEnd(int newEnd, int newEndLine, int newEndColumn)Returns a copy with the end moved.
-
-
-
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-negativeend- must be greater than or equal tostart
-
Range
public Range(int start, int end, com.google.gwt.dev.jjs.SourceInfo sourceInfo)Constructor.- Parameters:
start- must be non-negativeend- must be greater than or equal tostart
-
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-negativeend- must be greater than or equal tostart
-
-
Method Detail
-
contains
public boolean contains(Range o)
Returntrueif 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:
equalsin classjava.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:
hashCodein classjava.lang.Object
-
length
public int length()
-
toString
public java.lang.String toString()
For debugging use only.- Overrides:
toStringin classjava.lang.Object
-
withNewEnd
public Range withNewEnd(int newEnd, int newEndLine, int newEndColumn)
Returns a copy with the end moved.
-
-