Class SourceCode


  • public final class SourceCode
    extends java.lang.Object
    This is a wrapper for a file that will be compiled. It conveniently stores both the file name and the file contents, so that the parser does not have to deal with IO.

    Instances of this class are immutable.

    • Constructor Summary

      Constructors 
      Constructor Description
      SourceCode​(java.lang.String fileName, java.lang.String fileContents)
      Constructs a SourceCode.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getFileContents()  
      java.lang.String getFileName()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SourceCode

        public SourceCode​(@Nullable
                          java.lang.String fileName,
                          @Nullable
                          java.lang.String fileContents)
        Constructs a SourceCode. At least one of fileName and fileContents must be non-null.
        Parameters:
        fileName - the name of the source code file or null if the input does not come from a file
        fileContents - the contents of the source code file or null if the file contents is not yet known (the file has not yet been read)
    • Method Detail

      • getFileName

        public java.lang.String getFileName()
      • getFileContents

        public java.lang.String getFileContents()