Jet.Tipster
Class ExternalDocument

java.lang.Object
  extended byJet.Tipster.Document
      extended byJet.Tipster.ExternalDocument

public class ExternalDocument
extends Document

a Document associated with a file. The document may either by closed (information resides only on the file) or open (information resides on file and in object in memory).


Constructor Summary
ExternalDocument(java.lang.String format, java.lang.String fileName)
          creates a new external document associated with file 'fileName'.
ExternalDocument(java.lang.String format, java.lang.String directory, java.lang.String fileName)
           
 
Method Summary
 java.lang.String directory()
          returns the directory associated with the document, or 'null' if there is no directory (if the fileName contains the full path).
 java.lang.String fileName()
          returns the file name associated with the document.
 java.lang.String format()
          returns the format of the file holding this document: 'sgml' or 'pos'.
 java.lang.String fullFileName()
          the full file name, including both the directory and the file name within the directory
 boolean isOpen()
          returns 'true' if the file has been opened.
 boolean open()
          opens the externalDocument: reads the contents of the file, filling the text and annotations of the document.
 void save()
          saves the Document to the directory/fileName used for opening the Document.
 void saveAs(java.lang.String directory, java.lang.String fileName)
          saves the Document to file 'fileName' in directory 'directory'.
 void saveIn(java.lang.String directory)
          saves the Document to the originally specified fileName in directory 'directory'.
 void setAllTags(boolean allTags)
          if allTags == true, specifies that all SGML tags are to be converted to annotations when this document is opened.
 void setEmptyTags(java.lang.String[] tags)
          specify a list of empty tags -- tags which do not have any corresponding close tags and so should be converted to empty Annotations.
 void setSGMLtags(java.lang.String[] tags)
          sets the list of SGML tags which are to be converted to annotations when this document is opened.
 
Methods inherited from class Jet.Tipster.Document
addAnnotation, annotate, annotateWithTag, annotateWithTag, annotationsAt, annotationsAt, annotationsOfType, annotationsOfType, append, append, charAt, clear, clearAnnotations, getAnnotationTypes, getNextAnnotationId, length, main, normalizedText, normalizedText, removeAnnotation, removeAnnotationsOfType, setCharAt, setSGMLindent, setSGMLwrapMargin, setText, text, text, text, tokenAt, writeSGML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalDocument

public ExternalDocument(java.lang.String format,
                        java.lang.String fileName)
creates a new external document associated with file 'fileName'. The format of the file is given by 'format'. At present on the format 'sgml' (a file with SGML markup which is to be converted to annotations) is recognized.


ExternalDocument

public ExternalDocument(java.lang.String format,
                        java.lang.String directory,
                        java.lang.String fileName)
Method Detail

setSGMLtags

public void setSGMLtags(java.lang.String[] tags)
sets the list of SGML tags which are to be converted to annotations when this document is opened. Applicable only to documents of format 'sgml'.


setAllTags

public void setAllTags(boolean allTags)
if allTags == true, specifies that all SGML tags are to be converted to annotations when this document is opened. Applicable only to documents of format 'sgml'.


setEmptyTags

public void setEmptyTags(java.lang.String[] tags)
specify a list of empty tags -- tags which do not have any corresponding close tags and so should be converted to empty Annotations.


open

public boolean open()
opens the externalDocument: reads the contents of the file, filling the text and annotations of the document. Returns true if the Document was successfully opened, or was already open; returns false if there was an error in opening the file.


save

public void save()
saves the Document to the directory/fileName used for opening the Document. The document must be open.


saveIn

public void saveIn(java.lang.String directory)
saves the Document to the originally specified fileName in directory 'directory'.


saveAs

public void saveAs(java.lang.String directory,
                   java.lang.String fileName)
saves the Document to file 'fileName' in directory 'directory'.


isOpen

public boolean isOpen()
returns 'true' if the file has been opened.


format

public java.lang.String format()
returns the format of the file holding this document: 'sgml' or 'pos'.


directory

public java.lang.String directory()
returns the directory associated with the document, or 'null' if there is no directory (if the fileName contains the full path).


fileName

public java.lang.String fileName()
returns the file name associated with the document.


fullFileName

public java.lang.String fullFileName()
the full file name, including both the directory and the file name within the directory