org.biomage.tools.helpers
Class StringOutputHelpers

java.lang.Object
  extended by org.biomage.tools.helpers.StringOutputHelpers

public class StringOutputHelpers
extends java.lang.Object

Description: Class that provides static helper metheds for outputting strings.


Field Summary
protected static java.lang.String cppBodyIndent
           
protected static java.lang.String javaBodyIndent
           
static java.lang.String NEWLINE
          Description: The environment specific new line.
static java.lang.String oneIndent
          Description: Size of indentation.
protected static int verbose
          Description: The verboseness level.
 
Constructor Summary
StringOutputHelpers()
           
 
Method Summary
static java.lang.String createPackageDir(java.lang.String fullOutputDir, java.lang.String packageDirName)
          Description: Creates the directory for the package.
static java.lang.String initialCap(java.lang.String string)
          Description: Takes the string and returns a new string based on the input but with the first letter capitalized.
static java.lang.String initialLower(java.lang.String string)
          Description: Takes the string and returns a new string based on the input but with the first letter in lower case.
static void setVerbose(int level)
          Description: Looks for verboseness argument to set the level of output.
protected static java.util.Vector wrapString(java.lang.String string, int lineLength, int firstLineOffset)
          Description: Takes the input string and breaks it into appropriate sized pieces.
protected static void writeCommentBody(java.io.FileWriter writer, java.util.Vector commentLines, java.lang.String keyWord, java.lang.String delimIndent)
          Description: Writes out the body of a comment.
protected static void writeCPPComment(java.io.FileWriter writer, java.lang.String comment, int indentLevel, java.lang.String keyWord, boolean startComment, boolean endComment)
          Description: Takes the comment, formats it for C++ and outputs it.
static void writeDTDComment(java.io.FileWriter writer, java.lang.String comment, java.lang.String keyWord, boolean startComment, boolean endComment)
          Description: Takes the comment, formats it for JavaDoc and outputs it.
static void writeHeader(java.io.FileWriter writer, java.io.File header)
          Description: Writes the header information out to the file.
static void writeJavaComment(java.io.FileWriter writer, java.lang.String comment, int indentLevel, java.lang.String keyWord, boolean startComment, boolean endComment)
          Description: Takes the comment, formats it for JavaDoc and outputs it.
static void writeOutput(java.lang.String mess, int level)
          Description: The verboseness level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEWLINE

public static final java.lang.String NEWLINE
Description: The environment specific new line.


oneIndent

public static java.lang.String oneIndent
Description: Size of indentation.


javaBodyIndent

protected static java.lang.String javaBodyIndent

cppBodyIndent

protected static java.lang.String cppBodyIndent

verbose

protected static int verbose
Description: The verboseness level.

Constructor Detail

StringOutputHelpers

public StringOutputHelpers()
Method Detail

setVerbose

public static void setVerbose(int level)
Description: Looks for verboseness argument to set the level of output.

Parameters:
args: - list of command line arguments.


writeOutput

public static void writeOutput(java.lang.String mess,
                               int level)
Description: The verboseness level.


initialCap

public static java.lang.String initialCap(java.lang.String string)
Description: Takes the string and returns a new string based on the input but with the first letter capitalized.

Parameters:
string: - string to copy and return the copy with the first letter capitalized.

Returns:
a string with the first letter capitalized.


initialLower

public static java.lang.String initialLower(java.lang.String string)
                                     throws java.lang.Exception
Description: Takes the string and returns a new string based on the input but with the first letter in lower case.

Parameters:
string: - string to copy and return the copy with the first letter in lower case.

Returns:
a string with the first letter in lower case.

Throws:
java.lang.Exception

writeJavaComment

public static void writeJavaComment(java.io.FileWriter writer,
                                    java.lang.String comment,
                                    int indentLevel,
                                    java.lang.String keyWord,
                                    boolean startComment,
                                    boolean endComment)
                             throws java.lang.Exception
Description: Takes the comment, formats it for JavaDoc and outputs it.

Parameters:
writer: - used to write the comment to the file.
comment: - main string to write to the document.
indentLevel: - how far to indent.
keyWord: - JavaDoc keyword to prepend to the first line.
startComment: - Add lines to begin the comment.
endComment: - end the comment.

Throws:
java.lang.Exception

writeCPPComment

protected static void writeCPPComment(java.io.FileWriter writer,
                                      java.lang.String comment,
                                      int indentLevel,
                                      java.lang.String keyWord,
                                      boolean startComment,
                                      boolean endComment)
                               throws java.lang.Exception
Description: Takes the comment, formats it for C++ and outputs it.

Parameters:
writer: - used to write the comment to the file.
comment: - main string to write to the document.
indentLevel: - how far to indent.
keyWord: - JavaDoc keyword to prepend to the first line.
startComment: - Add lines to begin the comment.
endComment: - end the commetn.

Throws:
java.lang.Exception

writeDTDComment

public static void writeDTDComment(java.io.FileWriter writer,
                                   java.lang.String comment,
                                   java.lang.String keyWord,
                                   boolean startComment,
                                   boolean endComment)
                            throws java.lang.Exception
Description: Takes the comment, formats it for JavaDoc and outputs it.

Parameters:
writer: - used to write the comment to the file.
comment: - main string to write to the document.
keyWord: - keyword to prepend to the first line.
startComment: - Add lines to begin the comment.
endComment: - end the comment.

Throws:
java.lang.Exception

writeCommentBody

protected static void writeCommentBody(java.io.FileWriter writer,
                                       java.util.Vector commentLines,
                                       java.lang.String keyWord,
                                       java.lang.String delimIndent)
                                throws java.lang.Exception
Description: Writes out the body of a comment.

Parameters:
writer: - used to write the comment to the filethe string to wrap.
commentLines: - the comment broken into lines.
keyWord: - prependeed to first line.
delimIndent: - how far and format of the indent.

Throws:
java.lang.Exception

wrapString

protected static java.util.Vector wrapString(java.lang.String string,
                                             int lineLength,
                                             int firstLineOffset)
                                      throws java.lang.Exception
Description: Takes the input string and breaks it into appropriate sized pieces.

Parameters:
string: - the string to wrap.
lineLength: - length to use as basis of wrapping.
firstLineOffset: - how much less room for the first line.

Returns:
a Vector that has the original String broken into appropriate sized pieces.

Throws:
java.lang.Exception

writeHeader

public static void writeHeader(java.io.FileWriter writer,
                               java.io.File header)
                        throws java.lang.Exception
Description: Writes the header information out to the file.

Parameters:
writer: - FileWriter to used to write to the file.
header: - File for the header information.

Throws:
java.lang.Exception

createPackageDir

public static java.lang.String createPackageDir(java.lang.String fullOutputDir,
                                                java.lang.String packageDirName)
                                         throws java.lang.Exception
Description: Creates the directory for the package.

Parameters:
fullOutputDir: - the full path for the project.
packageDirName: - the directory that needs to exist.

Returns:
the modified fullOutputDir.

Throws:
java.lang.Exception