rvl.swv
Interface FileInterface

All Known Implementing Classes:
LaTeXFile, ODTFile

public interface FileInterface

This interface specifies the methods needed to read source files and write result files for StatWeave.


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 code reference..
 java.lang.String getCodeLine()
          Return one line from a code chunk.
 java.lang.String getExpr()
          Return the expression given in current expr tag, or the label in a recallCode, recallOutput, or recallFig 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()
          Return the next line from the source file.
 java.lang.String getOptions()
          Return the options list for latest tag.
 StatWeave getParent()
          Access the parent
 java.lang.String getPosition()
          Return a string that describes somehow the current position in the source file
 Tag nextTag()
          Return the next tag type found in the file
 void readSourceFile(java.lang.String fileName)
          Read the specified source file (most likely into a buffer).
 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)
          Set the parent object for this instance
 void writeResults(int mopUp)
          Write the results to the results file (a call to parent.getConfig("sys.baseName") may help figure out the right name.)
 

Method Detail

setParent

void setParent(StatWeave parent)
Set the parent object for this instance


getParent

StatWeave getParent()
Access the parent


getFigFormats

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

Note the required integer constants are defined in FigFile


readSourceFile

void readSourceFile(java.lang.String fileName)
Read the specified source file (most likely into a buffer). Implementations are responsible for closing this file.


getLine

java.lang.String getLine()
Return the next line from the source file. May be needed by a SyntaxInterface when options continue to the next line. If no SyntaxInterface is used just have this return null.


getPosition

java.lang.String getPosition()
Return a string that describes somehow the current position in the source file


writeResults

void writeResults(int mopUp)
Write the results to the results file (a call to parent.getConfig("sys.baseName") may help figure out the right name.)

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)


nextTag

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


getLang

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

Needed when tag is chunk, langOpts, or expr


getExpr

java.lang.String getExpr()
Return the expression given in current expr tag, or the label in a recallCode, recallOutput, or recallFig tag


getOptions

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

Needed when tag is chunk, globalOpts, or langOpts


getCodeLine

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. Note that in either case, the label can be obtained using .substring(9).

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


getLabel

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

Needed when the tag is coderef, recallFig, recallCode, recallOutput or when getCodeLine returns a code reference. (When the tag is chunk, the label, if any, should be included in the list returned by getOptions().)


getArgs

java.util.Vector<java.lang.String> getArgs()
Return the arguments specified in a code reference..


saveBookmark

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.


replaceBookmark

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.


embedPlots

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