de.java2html.converter
Class JavaSource2TeXConverter

java.lang.Object
  extended by de.java2html.converter.AbstractJavaSourceConverter
      extended by de.java2html.converter.JavaSource2TeXConverter
All Implemented Interfaces:
IJavaSourceConverter

public class JavaSource2TeXConverter
extends AbstractJavaSourceConverter

Algorithm and stuff for converting a JavaSource object to to a TeX string representation (experimental!). For questions, suggestions, bug-reports, enhancement-requests etc. I may be contacted at: markus@jave.de The Java2html home page is located at: http://www.java2html.de


Field Summary
protected static java.lang.String BLOCK_HEADER
           
protected static java.lang.String DOCUMENT_BLOCK_SEPARATOR
          Block seperator for between two blocks of converted source code
protected static java.lang.String DOCUMENT_FOOTER
          Document header
protected static java.lang.String DOCUMENT_HEADER
          Document header
protected static java.lang.String[] WHITESPACES
           
 
Constructor Summary
JavaSource2TeXConverter()
           
 
Method Summary
 void convert(JavaSource source, JavaSourceConversionOptions options, java.io.BufferedWriter writer)
          Converts the parsed source code to HTML by adding color information, adding line breaks and replacing characters as needed for HTML.
protected static char[] floatToCharArray(float f)
           
 java.lang.String getBlockSeparator(JavaSourceConversionOptions options)
          Returns the code that has to be placed between two blocks of converted code.
 java.lang.String getDocumentFooter(JavaSourceConversionOptions options)
          Returns a footer for the result document.
 java.lang.String getDocumentHeader(JavaSourceConversionOptions options, java.lang.String title)
          Returns a header for the result document.
protected static java.lang.String leftSpace(int num, int max)
           
static void main(java.lang.String[] args)
           
protected  void toTeX(JavaSourceRun run, java.io.BufferedWriter writer)
           
protected static java.lang.String whiteSpace(int size)
           
 void writeLineNumber(java.io.BufferedWriter writer, int lineNumber, int lineCount)
           
 
Methods inherited from class de.java2html.converter.AbstractJavaSourceConverter
convert, getDefaultFileExtension, getMetaData, writeBlockSeparator, writeDocumentFooter, writeDocumentHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOCUMENT_HEADER

protected static final java.lang.String DOCUMENT_HEADER
Document header

See Also:
Constant Field Values

DOCUMENT_FOOTER

protected static final java.lang.String DOCUMENT_FOOTER
Document header

See Also:
Constant Field Values

DOCUMENT_BLOCK_SEPARATOR

protected static final java.lang.String DOCUMENT_BLOCK_SEPARATOR
Block seperator for between two blocks of converted source code

See Also:
Constant Field Values

BLOCK_HEADER

protected static final java.lang.String BLOCK_HEADER

WHITESPACES

protected static final java.lang.String[] WHITESPACES
Constructor Detail

JavaSource2TeXConverter

public JavaSource2TeXConverter()
Method Detail

floatToCharArray

protected static final char[] floatToCharArray(float f)

getDocumentHeader

public java.lang.String getDocumentHeader(JavaSourceConversionOptions options,
                                          java.lang.String title)
Description copied from class: AbstractJavaSourceConverter
Returns a header for the result document. This one will be placed before the first block of converted code. Subclasses can return an empty String ("") if there is none neccessary.

Specified by:
getDocumentHeader in class AbstractJavaSourceConverter

getDocumentFooter

public java.lang.String getDocumentFooter(JavaSourceConversionOptions options)
Description copied from class: AbstractJavaSourceConverter
Returns a footer for the result document. This one will be placed behind the last block of converted code. Subclasses can return an empty String ("") if there is none neccessary.

Specified by:
getDocumentFooter in class AbstractJavaSourceConverter

getBlockSeparator

public java.lang.String getBlockSeparator(JavaSourceConversionOptions options)
Description copied from class: AbstractJavaSourceConverter
Returns the code that has to be placed between two blocks of converted code. Subclasses can return an empty String ("") if there is none neccessary.

Specified by:
getBlockSeparator in class AbstractJavaSourceConverter

convert

public void convert(JavaSource source,
                    JavaSourceConversionOptions options,
                    java.io.BufferedWriter writer)
             throws java.io.IOException
Converts the parsed source code to HTML by adding color information, adding line breaks and replacing characters as needed for HTML. Also adds a table with line numbers etc.

Specified by:
convert in class AbstractJavaSourceConverter
Throws:
java.io.IOException

writeLineNumber

public void writeLineNumber(java.io.BufferedWriter writer,
                            int lineNumber,
                            int lineCount)
                     throws java.io.IOException
Throws:
java.io.IOException

toTeX

protected void toTeX(JavaSourceRun run,
                     java.io.BufferedWriter writer)
              throws java.io.IOException
Throws:
java.io.IOException

whiteSpace

protected static final java.lang.String whiteSpace(int size)

leftSpace

protected static final java.lang.String leftSpace(int num,
                                                  int max)

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Throws:
java.io.IOException