function Document(file, initialTimestamp, rawText) {
        if (!(this instanceof Document)) {  // error if constructor called without 'new'
            throw new Error("Document constructor must be called with 'new'");
        }
        if (_openDocuments[file.fullPath]) {
            throw new Error("Creating a document when one already exists, for: " + file);
        }
        
        this.file = file;
        this.refreshText(rawText, initialTimestamp);
        
        // This is a good point to clean up any old dangling Documents
        _gcDocuments();
    }
@constructor
Model for the contents of a single file and its current modification state.
See DocumentManager documentation for important usage notes.

Document dispatches these events:

change -- When the text of the editor changes (including due to undo/redo). 

       Passes ({Document}, {ChangeList}), where ChangeList is a linked list (NOT an array)
       of change record objects. Each change record looks like:

           { from: start of change, expressed as {line: <line number>, ch: <character offset>},
             to: end of change, expressed as {line: <line number>, ch: <chracter offset>},
             text: array of lines of text to replace existing text,
             next: next change record in the linked list, or undefined if this is the last record }
     
       The line and ch offsets are both 0-based.

       The ch offset in "from" is inclusive, but the ch offset in "to" is exclusive. For example,
       an insertion of new content (without replacing existing content) is expressed by a range
       where from and to are the same.

       If "from" and "to" are undefined, then this is a replacement of the entire text content.

       IMPORTANT: If you listen for the "change" event, you MUST also addRef() the document 
       (and releaseRef() it whenever you stop listening). You should also listen to the "deleted"
       event.
 
       (FUTURE: this is a modified version of the raw CodeMirror change event format; may want to make 
       it an ordinary array)

deleted -- When the file for this document has been deleted. All views onto the document should
     be closed. The document will no longer be editable or dispatch "change" events.

@param {!FileEntry} file  Need not lie within the project.
@param {!Date} initialTimestamp  File's timestamp when we read it off disk.
@param {!string} rawText  Text content of the file.