com.google.javascript.jscomp.testing
Class SimpleSourceExcerptProvider

java.lang.Object
  extended by com.google.javascript.jscomp.testing.SimpleSourceExcerptProvider
All Implemented Interfaces:
SourceExcerptProvider

public class SimpleSourceExcerptProvider
extends 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
SimpleSourceExcerptProvider(String source)
           
 
Method Summary
 String getSourceLine(String sourceName, int lineNumber)
          Get the line indicated by the line number.
 Region getSourceRegion(String sourceName, int lineNumber)
          Get a region around the indicated line number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSourceExcerptProvider

public SimpleSourceExcerptProvider(String source)
Method Detail

getSourceLine

public String getSourceLine(String sourceName,
                            int lineNumber)
Description copied from interface: SourceExcerptProvider
Get the line indicated by the line number. This call will return only the specific line.

Specified by:
getSourceLine in interface SourceExcerptProvider
lineNumber - the line number, 1 being the first line of the file
Returns:
the line indicated, or null if it does not exist

getSourceRegion

public Region getSourceRegion(String sourceName,
                              int lineNumber)
Description copied from interface: SourceExcerptProvider
Get 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:
getSourceRegion in interface SourceExcerptProvider
lineNumber - 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