rvl.swv
Class StatWeave

java.lang.Object
  extended by rvl.swv.StatWeave

public class StatWeave
extends java.lang.Object

StatWeave is the main class for weaving and tangling source files. It constructs an instance of FileInterface for the required file type, plus one or more instances of EngineInterface as needed based on the statistical engine(s) required to process the source file.

The main(java.lang.String[]) method provides a command-line interface that reads options and the source filename from the command line. The main work is done by weave(java.lang.String, java.lang.String, boolean), which is called by main(java.lang.String[]) but could also be called by, say, a GUI.

To use this class, we also require that a configuration file be defined; its default name is statweave.cfg on Windows systems, and .statweave on all other platforms. StatWeave looks for this file in the home directory.


Field Summary
 java.io.PrintStream errStream
           
 
Constructor Summary
StatWeave(java.lang.String cfgFile)
          Constructor
 
Method Summary
 void error(java.lang.String msg, int errCode)
          Called by interface classes to report an error.
 java.lang.String getConfig(java.lang.String property)
          Return specified configuration property with specified key.
 double getDim(java.lang.String optName, double dfault)
          Returns a dimension in inches for named option.
 java.lang.String getDir()
          return directory of source file
 java.lang.String getOption(java.lang.String optName)
          Return the specified option from currentOpts
 java.lang.String getOption(java.lang.String optName, java.lang.String dfault)
          Return the specified option from currentOpts.
 boolean isTrue(java.lang.String optName)
          Returns true if option named optname starts with T
 boolean isWeaving()
          return true if weaving, false if tangling
static void main(java.lang.String[] args)
          Command-line interface
static void message(java.lang.String msg)
          Display a non-error message
 void tangle(java.lang.String fileName)
          Main routine for tangling a file.
static void warning(java.lang.String msg)
          Called by interface classes to report a warning
 void weave(java.lang.String fileName)
          Main routine for weaving a file.
 void weave(java.lang.String fileName, java.lang.String resultName, boolean weaving)
          Main routine for weaving a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

errStream

public java.io.PrintStream errStream
Constructor Detail

StatWeave

public StatWeave(java.lang.String cfgFile)
Constructor

Method Detail

message

public static void message(java.lang.String msg)
Display a non-error message


warning

public static void warning(java.lang.String msg)
Called by interface classes to report a warning


error

public void error(java.lang.String msg,
                  int errCode)
Called by interface classes to report an error. A recommended exit code is also provided


getOption

public java.lang.String getOption(java.lang.String optName)
Return the specified option from currentOpts


getOption

public java.lang.String getOption(java.lang.String optName,
                                  java.lang.String dfault)
Return the specified option from currentOpts. If it is null, return the value of dfault


isTrue

public boolean isTrue(java.lang.String optName)
Returns true if option named optname starts with T


getDim

public double getDim(java.lang.String optName,
                     double dfault)
Returns a dimension in inches for named option. Option may end in "in", "cm", "mm", "pt", "px", or nothing. If nothing, we guess the units based on the value. Note: px units are considered same as pt If option doesn't exist, dfault is returned


getConfig

public java.lang.String getConfig(java.lang.String property)
Return specified configuration property with specified key. (Actually, if there was a --custom option, this returns a customization property instead, if it exists.)


isWeaving

public boolean isWeaving()
return true if weaving, false if tangling


getDir

public java.lang.String getDir()
return directory of source file


weave

public void weave(java.lang.String fileName,
                  java.lang.String resultName,
                  boolean weaving)
Main routine for weaving a file. Call with the source filename.


weave

public void weave(java.lang.String fileName)
Main routine for weaving a file. Call with the source filename.


tangle

public void tangle(java.lang.String fileName)
Main routine for tangling a file. Call with the source filename.


main

public static void main(java.lang.String[] args)
Command-line interface