com.google.javascript.rhino.jstype
Class SimpleSourceFile

java.lang.Object
  extended by com.google.javascript.rhino.jstype.SimpleSourceFile
All Implemented Interfaces:
StaticSourceFile

public final class SimpleSourceFile
extends Object
implements StaticSourceFile

A simple implementation of StaticSourceFile for testing.


Constructor Summary
SimpleSourceFile(String name, boolean extern)
           
 
Method Summary
 int getLineOffset(int line)
          Returns the offset of the given line number relative to the file start.
 String getName()
          The name of the file.
 boolean isExtern()
          Returns whether this is an externs file.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleSourceFile

public SimpleSourceFile(String name,
                        boolean extern)
Method Detail

getName

public String getName()
Description copied from interface: StaticSourceFile
The name of the file. Must be unique across all files in the compilation.

Specified by:
getName in interface StaticSourceFile

isExtern

public boolean isExtern()
Description copied from interface: StaticSourceFile
Returns whether this is an externs file.

Specified by:
isExtern in interface StaticSourceFile

getLineOffset

public int getLineOffset(int line)
Description copied from interface: StaticSourceFile
Returns the offset of the given line number relative to the file start. Line number should be 1-based. If the source file doesn't have line information, it should return Integer.MIN_VALUE. The negative offsets will make it more obvious what happened.

Specified by:
getLineOffset in interface StaticSourceFile
Parameters:
line - the line of the input to get the absolute offset of.
Returns:
the absolute offset of the start of the provided line.

toString

public String toString()
Overrides:
toString in class Object