Rakesh API

org.rakeshv.tex
Class TransformDocumentParts

java.lang.Object
  extended by org.rakeshv.tex.TransformDocumentParts

public class TransformDocumentParts
extends java.lang.Object

This class provides static methods that do very common transformations to generate part, chapter and section commands for a given ASCII text file.


Field Summary
static boolean HAS_TITLE
          Specify that a part, chapter, or section has an associated title.
static boolean NO_RESET_COUNTER
          Specify that a part, chapter, or section does not need re-numbering.
static boolean NO_TITLE
          Specify that a part, chapter, or section does not have a title.
static boolean RESET_COUNTER
          Specify that a part, chapter, or section needs to be re-numbered when they start with either 1 , I, or i.
 
Constructor Summary
private TransformDocumentParts()
          Default constructor.
 
Method Summary
static java.lang.String generateChapterTags(java.lang.String contents, java.lang.String pattern)
          Generate chapter tags, by replacing all occurances of the identifier (pattern) specified in the document (contents) with LATEX part commands.
static java.lang.String generateChapterTags(java.lang.String contents, java.lang.String pattern, boolean titleFlag)
          Generate chapter tags, by replacing all occurances of the identifier (pattern) specified in the document (contents) with LATEX part commands.
static java.lang.String generateChapterTags(java.lang.String contents, java.lang.String pattern, boolean titleFlag, boolean counterFlag)
          Generate chapter tags, by replacing all occurances of the identifier (pattern) specified in the document (contents) with LATEX part commands.
static java.lang.String generatePartTags(java.lang.String contents, java.lang.String pattern)
          Generate part tags, by replace all occurances of the identifier (pattern) specified in the document (contents) with LATEX part commands.
static java.lang.String generatePartTags(java.lang.String contents, java.lang.String pattern, boolean titleFlag)
          Generate part tags, by replace all occurances of the identifier (pattern) specified in the document (contents) with LATEX part commands.
static java.lang.String generatePartTags(java.lang.String contents, java.lang.String pattern, boolean titleFlag, boolean counterFlag)
          Generate part tags, by replace all occurances of the identifier (pattern) specified in the document (contents) with LATEX part commands.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HAS_TITLE

public static final boolean HAS_TITLE
Specify that a part, chapter, or section has an associated title.

See Also:
Constant Field Values

NO_TITLE

public static final boolean NO_TITLE
Specify that a part, chapter, or section does not have a title.

See Also:
Constant Field Values

RESET_COUNTER

public static final boolean RESET_COUNTER
Specify that a part, chapter, or section needs to be re-numbered when they start with either 1 , I, or i.

See Also:
Constant Field Values

NO_RESET_COUNTER

public static final boolean NO_RESET_COUNTER
Specify that a part, chapter, or section does not need re-numbering.

See Also:
Constant Field Values
Constructor Detail

TransformDocumentParts

private TransformDocumentParts()
Default constructor. This is made private to prevent instantiation.

Method Detail

generatePartTags

public static java.lang.String generatePartTags(java.lang.String contents,
                                                java.lang.String pattern)

Generate part tags, by replace all occurances of the identifier (pattern) specified in the document (contents) with LATEX part commands.

This method just invokes generatePartTags with HAS_TITLE and NO_RESET_COUNTER.

Parameters:
contents - - The document that is being processed.
pattern - - The text that identifies parts in the document.
Returns:
String - The document after adding the part tags.

generatePartTags

public static java.lang.String generatePartTags(java.lang.String contents,
                                                java.lang.String pattern,
                                                boolean titleFlag)

Generate part tags, by replace all occurances of the identifier (pattern) specified in the document (contents) with LATEX part commands.

This method just invokes generatePartTags with NO_RESET_COUNTER.

Parameters:
contents - - The document that is being processed.
pattern - - The text that identifies parts in the document.
titleFlag - - Specify whether the part has a title associated with it or not. Specify preference using HAS_TITLE or NO_TITLE.
Returns:
String - The document after adding the part tags.

generatePartTags

public static java.lang.String generatePartTags(java.lang.String contents,
                                                java.lang.String pattern,
                                                boolean titleFlag,
                                                boolean counterFlag)

Generate part tags, by replace all occurances of the identifier (pattern) specified in the document (contents) with LATEX part commands.

Parameters:
contents - - The document that is being processed.
pattern - - The text that identifies parts in the document.
titleFlag - - Specify whether the part has a title associated with it or not. Specify preference using HAS_TITLE or NO_TITLE.
counterFlag - - Specify whether part counter needs to be reset when part number is 1, I or i. Specify preference using RESET_COUNTER or NO_RESET_COUNTER.
Returns:
String - The document after adding the part tags.

generateChapterTags

public static java.lang.String generateChapterTags(java.lang.String contents,
                                                   java.lang.String pattern)

Generate chapter tags, by replacing all occurances of the identifier (pattern) specified in the document (contents) with LATEX part commands.

For the case where chapters have titles, since the titles may span multiple lines, I assume that there is a blank line separating the chapter from the first paragraph.

This method just invokes generateChapterTags with HAS_TITLE and NO_RESET_COUNTER.

Parameters:
contents - - The document that is being processed.
pattern - - The text that identifies chapters in the document.
Returns:
String - The document after adding the part tags.

generateChapterTags

public static java.lang.String generateChapterTags(java.lang.String contents,
                                                   java.lang.String pattern,
                                                   boolean titleFlag)

Generate chapter tags, by replacing all occurances of the identifier (pattern) specified in the document (contents) with LATEX part commands.

For the case where chapters have titles, since the titles may span multiple lines, I assume that there is a blank line separating the chapter from the first paragraph.

This method just invokes generateChapterTags with NO_RESET_COUNTER.

Parameters:
contents - - The document that is being processed.
pattern - - The text that identifies chapters in the document.
titleFlag - - Specify whether the part has a title associated with it or not. Specify preference using HAS_TITLE or NO_TITLE.
Returns:
String - The document after adding the part tags.

generateChapterTags

public static java.lang.String generateChapterTags(java.lang.String contents,
                                                   java.lang.String pattern,
                                                   boolean titleFlag,
                                                   boolean counterFlag)

Generate chapter tags, by replacing all occurances of the identifier (pattern) specified in the document (contents) with LATEX part commands.

For the case where chapters have titles, since the titles may span multiple lines, I assume that there is a blank line separating the chapter from the first paragraph.

Parameters:
contents - - The document that is being processed.
pattern - - The text that identifies chapters in the document.
titleFlag - - Specify whether the part has a title associated with it or not. Specify preference using HAS_TITLE or NO_TITLE.
counterFlag - - Specify whether chapter counter needs to be reset when chapter number is 1, I or i. Specify preference using RESET_COUNTER or NO_RESET_COUNTER.
Returns:
String - The document after adding the part tags.

Rakesh API

Copyright © 2002-2005 - Rakesh Vidyadharan