rvl.swv
Class ODTFile

java.lang.Object
  extended by rvl.swv.ODTFile
All Implemented Interfaces:
FileInterface

public class ODTFile
extends java.lang.Object
implements FileInterface

This class defines the FileInterface for a ODT file.

The following format-specific options are implemented:


Constructor Summary
ODTFile()
          Default constructor
 
Method Summary
 void embedPlots(java.lang.String sig, FigFile ff, int[] pages)
          Replace bookmark with specified figure(s) in ff
 java.util.Vector<java.lang.String> getArgs()
          Return the arguments specified in a coderef tag.
 java.lang.String getCodeLine()
          Return one line from a code chunk.
 java.lang.String getExpr()
          Return the expression given in the current expr tag
 int[] getFigFormats()
          Return acceptable graphics formats -- null if no graphics supported.
 java.lang.String getLabel()
          Return the label specified in the latest tag.
 java.lang.String getLang()
          Return the language associated with latest tag
 java.lang.String getLine()
          Read one line from source file (NOT NEEDED since no syntax interface)
 java.lang.String getOptions()
          Return the options list for latest tag.
 StatWeave getParent()
          Access the StatWeave instance that we are serving
 java.lang.String getPosition()
          Return the current line number in the form "line #".
 Tag nextTag()
          Return the next tag type found in the file
 void readSourceFile(java.lang.String fileName)
          Read the specified source file.
 void replaceBookmark(java.lang.String sig, java.lang.String text, Tag context)
          Find the given bookmark previously saved with signature sig, and replace it with text.
 void saveBookmark(java.lang.String sig)
          Replace the current tagged region of the source file with the specified sig.
 void setParent(StatWeave parent)
          Save the StatWeave instance that we are serving
 void writeResults(int mopUp)
          Write the results to the output file derived from sys.basename.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ODTFile

public ODTFile()
Default constructor

Method Detail

setParent

public void setParent(StatWeave parent)
Save the StatWeave instance that we are serving

Specified by:
setParent in interface FileInterface

getParent

public StatWeave getParent()
Access the StatWeave instance that we are serving

Specified by:
getParent in interface FileInterface

getFigFormats

public int[] getFigFormats()
Return acceptable graphics formats -- null if no graphics supported.

Note: most required integer constants are defined in FigFile

Specified by:
getFigFormats in interface FileInterface

readSourceFile

public void readSourceFile(java.lang.String fileName)
Read the specified source file. For this impl., we also figure out which syntax (SyntaxInterface) to use. We will just set up an input stream and read it line-by-line. We need to close it later when all is done.

Specified by:
readSourceFile in interface FileInterface

writeResults

public void writeResults(int mopUp)
Write the results to the output file derived from sys.basename.

Finally, clean up intermediate files as directed by the mopUp argument, which should have a value of 0, 1, or 2. 0 means leave all intermediate files; 2 means erase all intermediate files and leave only essential ones; and 1 is somewhere in between (e.g. keep graphics files)

Specified by:
writeResults in interface FileInterface

nextTag

public Tag nextTag()
Return the next tag type found in the file

Specified by:
nextTag in interface FileInterface

getLine

public java.lang.String getLine()
Read one line from source file (NOT NEEDED since no syntax interface)

Specified by:
getLine in interface FileInterface

getPosition

public java.lang.String getPosition()
Return the current line number in the form "line #".

Specified by:
getPosition in interface FileInterface

getCodeLine

public java.lang.String getCodeLine()
Return one line from a code chunk.

If it is actually a code reference, return the string !coderef label or !coderef *label, where label is the label provided. (Use the * form to force the code reference to be displayed regardless of the value of the option showref.)

Return null when the end of the code chunk is reached.

Specified by:
getCodeLine in interface FileInterface

getLang

public java.lang.String getLang()
Return the language associated with latest tag

Needed when tag is chunk, langOpts, or expr

Specified by:
getLang in interface FileInterface

getExpr

public java.lang.String getExpr()
Return the expression given in the current expr tag

Specified by:
getExpr in interface FileInterface

getOptions

public java.lang.String getOptions()
Return the options list for latest tag.

Needed when tag is chunk, globalOpts, langOpts, recallFig, recallCode, or recallOutput.

Specified by:
getOptions in interface FileInterface

getLabel

public java.lang.String getLabel()
Return the label specified in the latest tag.

Needed when the tag is recallFig, recallCode, recallOutput. (When the tag is chunk, the label, if any, should be included in the list returned by getOptions().)

Specified by:
getLabel in interface FileInterface

getArgs

public java.util.Vector<java.lang.String> getArgs()
Return the arguments specified in a coderef tag.

Specified by:
getArgs in interface FileInterface

saveBookmark

public void saveBookmark(java.lang.String sig)
Replace the current tagged region of the source file with the specified sig. This provides a place-holder for results to be incorporated later.

Specified by:
saveBookmark in interface FileInterface

replaceBookmark

public void replaceBookmark(java.lang.String sig,
                            java.lang.String text,
                            Tag context)
Find the given bookmark previously saved with signature sig, and replace it with text. The context argument is a reminder of what kind of content is being added. Implementation may call StatWeave's getOption() method and expect to retrieve the options in effect for the text being inserted.

Specified by:
replaceBookmark in interface FileInterface

embedPlots

public void embedPlots(java.lang.String sig,
                       FigFile ff,
                       int[] pages)
Replace bookmark with specified figure(s) in ff

Specified by:
embedPlots in interface FileInterface