Class SimpleSourceExcerptProvider
- java.lang.Object
-
- com.google.javascript.jscomp.testing.SimpleSourceExcerptProvider
-
- All Implemented Interfaces:
SourceExcerptProvider
public class SimpleSourceExcerptProvider extends java.lang.Object implements SourceExcerptProvider
A simple source excerpt provider for testing.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.javascript.jscomp.SourceExcerptProvider
SourceExcerptProvider.ExcerptFormatter, SourceExcerptProvider.SourceExcerpt
-
-
Constructor Summary
Constructors Constructor Description SimpleSourceExcerptProvider(java.lang.String source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetSourceLine(java.lang.String sourceName, int lineNumber)Get the line indicated by the line number.RegiongetSourceRegion(java.lang.String sourceName, int lineNumber)Get a region around the indicated line number.
-
-
-
Method Detail
-
getSourceLine
public java.lang.String getSourceLine(java.lang.String sourceName, int lineNumber)Description copied from interface:SourceExcerptProviderGet the line indicated by the line number. This call will return only the specific line.- Specified by:
getSourceLinein interfaceSourceExcerptProviderlineNumber- the line number, 1 being the first line of the file- Returns:
- the line indicated, or
nullif it does not exist
-
getSourceRegion
public Region getSourceRegion(java.lang.String sourceName, int lineNumber)
Description copied from interface:SourceExcerptProviderGet a region around the indicated line number. The exact definition of a region is implementation specific, but it must contain the line indicated by the line number. A region must not start or end by a carriage return.- Specified by:
getSourceRegionin interfaceSourceExcerptProviderlineNumber- the line number, 1 being the first line of the file- Returns:
- the region around the line number indicated, or
null if it does not exist
-
-