org.sourcejammer.server.keywords
Class KeywordExpander

java.lang.Object
  |
  +--org.sourcejammer.server.keywords.KeywordExpander
All Implemented Interfaces:
KeywordTags
Direct Known Subclasses:
HistoryExpander

public abstract class KeywordExpander
extends java.lang.Object
implements KeywordTags

Title: SourceJammer Server 1.3 Description: Copyright: Copyright (c) 2002 Company: SourceJammer

Version:
1.0
Author:
Rob MacGrogan

Field Summary
 
Fields inherited from interface org.sourcejammer.server.keywords.KeywordTags
ARCHIVE_NAME, COMMENT_LINE_LEN, COMMENT_LINE_OFFSET, DESCRIPTION, FILE_ID, FILE_LOCATION, FILE_NAME, HIST_COL_COMMENT, HIST_COL_DATE, HIST_COL_TASK, HIST_COL_USER, HIST_COL_VER, HIST_DATE_LEN, HIST_HALF_LINE_LEN, HIST_LINE_COMMENT, HIST_LINE_DATE, HIST_LINE_TASK, HIST_LINE_USER, HIST_LINE_VER, HIST_SEPARATOR, HIST_TASK_LEN, HIST_USER_LEN, HIST_VER_LEN, HISTORY, KEYWORD_INDICATOR, KEYWORD_NAME_VAL_SEP, LAST_COMMENT, LINE_MAX_LENGTH, MODIFIED_DATE, OFF, SPACE, USER_FULL_NAME, USER_NAME, VERSION_ID, VERSION_NUMBER
 
Constructor Summary
KeywordExpander()
           
 
Method Summary
private  int addValue(java.lang.String beginLine, java.lang.String endLine, java.lang.String value, java.util.Vector lines, java.lang.String commentStyle)
          Adds the value to the lines Vector.
abstract  int expand(java.lang.String line, int keywordBeginIndex, java.util.Vector lines, ProjectObjects obj, org.sourcejammer.util.BufferedLineReader reader)
          Expand any keywords in current line.
protected  java.util.Iterator formatLines(java.lang.String commentStyle, java.lang.String unformattedLines, boolean commentFirstLine)
           
 java.lang.String getBeginNewLine(int keywordBeginIndex, java.lang.String line)
           
 java.lang.String getBeginNewLineIndent(int keywordBeginIndex, java.lang.String line, java.lang.String keyword)
           
 int getSeparatorIndex(int keywordBeginIndex, java.lang.String keyword)
           
protected  int replaceKeywordWithValue(int separatorIndex, java.lang.String value, java.util.Vector lines, java.lang.String line, org.sourcejammer.util.BufferedLineReader reader, java.lang.String commentStyle)
          separatorIndex is index of separator char for keyword.
private  int replaceMultiLine(java.lang.String line, int iBeginValueIndex, java.util.Vector lines, java.lang.String value, org.sourcejammer.util.BufferedLineReader reader, java.lang.String commentStyle)
          Replaces multiple lines in text file with keyword value.
private  int replaceSingleLine(java.lang.String line, int iBeginValueIndex, int iValueEndIndex, java.util.Vector lines, java.lang.String value, java.lang.String commentStyle)
          Replaces value in a single line with keyword value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeywordExpander

public KeywordExpander()
Method Detail

expand

public abstract int expand(java.lang.String line,
                           int keywordBeginIndex,
                           java.util.Vector lines,
                           ProjectObjects obj,
                           org.sourcejammer.util.BufferedLineReader reader)
                    throws KeywordExpansionException,
                           java.io.IOException
Expand any keywords in current line.

Returns:
Number of characters in all Strings added to lines Vector.
KeywordExpansionException
java.io.IOException

getSeparatorIndex

public int getSeparatorIndex(int keywordBeginIndex,
                             java.lang.String keyword)

getBeginNewLine

public java.lang.String getBeginNewLine(int keywordBeginIndex,
                                        java.lang.String line)

getBeginNewLineIndent

public java.lang.String getBeginNewLineIndent(int keywordBeginIndex,
                                              java.lang.String line,
                                              java.lang.String keyword)

replaceKeywordWithValue

protected int replaceKeywordWithValue(int separatorIndex,
                                      java.lang.String value,
                                      java.util.Vector lines,
                                      java.lang.String line,
                                      org.sourcejammer.util.BufferedLineReader reader,
                                      java.lang.String commentStyle)
                               throws KeywordExpansionException,
                                      java.io.IOException
separatorIndex is index of separator char for keyword. Look for end of keyword value marker either in line or in a subsequent line returned from reader. Replace keyword value iwth value. Convert to a series of one or m ore lines which are then added to Vector.

KeywordExpansionException
java.io.IOException

replaceMultiLine

private int replaceMultiLine(java.lang.String line,
                             int iBeginValueIndex,
                             java.util.Vector lines,
                             java.lang.String value,
                             org.sourcejammer.util.BufferedLineReader reader,
                             java.lang.String commentStyle)
                      throws KeywordExpansionException,
                             java.io.IOException
Replaces multiple lines in text file with keyword value.

KeywordExpansionException
java.io.IOException

replaceSingleLine

private int replaceSingleLine(java.lang.String line,
                              int iBeginValueIndex,
                              int iValueEndIndex,
                              java.util.Vector lines,
                              java.lang.String value,
                              java.lang.String commentStyle)
                       throws KeywordExpansionException
Replaces value in a single line with keyword value.

KeywordExpansionException

addValue

private int addValue(java.lang.String beginLine,
                     java.lang.String endLine,
                     java.lang.String value,
                     java.util.Vector lines,
                     java.lang.String commentStyle)
              throws KeywordExpansionException
Adds the value to the lines Vector.

KeywordExpansionException

formatLines

protected java.util.Iterator formatLines(java.lang.String commentStyle,
                                         java.lang.String unformattedLines,
                                         boolean commentFirstLine)


Copyright © 2003 Soucejammer project.