org.suigeneris.jrcs.rcs.text
Class KeywordFormatter

java.lang.Object
  extended by org.suigeneris.jrcs.rcs.text.KeywordFormatter
Direct Known Subclasses:
KeywordAndValueFormatter, KeywordOnlyFormatter, ValueOnlyFormatter

public abstract class KeywordFormatter
extends java.lang.Object

Generic formatter for the RCS keywords. It is intended as an helper class to replace the use of gnu.regexp. This class is NOT threadsafe.

Author:
Stephane Bailliez, Juancarlo Anez

Field Summary
private  java.text.Format Author_FORMAT
           
protected  java.util.regex.Pattern AUTHOR_RE
           
private  java.text.Format Date_FORMAT
           
protected  java.util.regex.Pattern DATE_RE
           
private static java.lang.String DOLLAR
           
private  java.text.Format Header_FORMAT
           
protected  java.util.regex.Pattern HEADER_RE
           
private  java.text.Format Id_FORMAT
           
protected  java.util.regex.Pattern ID_RE
           
private static KeywordFormatter K_FORMATTER
           
private static KeywordFormatter KV_FORMATTER
           
private  java.text.Format Locker_FORMAT
           
protected  java.util.regex.Pattern LOCKER_RE
           
protected  java.util.regex.Pattern LOG_RE
           
protected  java.util.regex.Pattern NAME_RE
           
private  java.text.Format RCSFile_FORMAT
           
protected  java.util.regex.Pattern RCSFILE_RE
           
private  java.text.Format Revision_FORMAT
           
protected  java.util.regex.Pattern REVISION_RE
           
private  java.text.Format Source_FORMAT
           
protected  java.util.regex.Pattern SOURCE_RE
           
private  java.text.Format State_FORMAT
           
protected  java.util.regex.Pattern STATE_RE
           
private static KeywordFormatter V_FORMATTER
           
 
Constructor Summary
KeywordFormatter()
           
 
Method Summary
 java.text.Format getAuthorFormat()
           
 java.text.Format getDateFormat()
           
 java.text.Format getHeaderFormat()
           
 java.text.Format getIdFormat()
           
static KeywordFormatter getKeywordAndValueFormatter()
           
static KeywordFormatter getKeywordOnlyFormatter()
           
 java.text.Format getLockerFormat()
           
 java.text.Format getRCSFileFormat()
           
 java.text.Format getRevisionFormat()
           
 java.text.Format getSourceFormat()
           
 java.text.Format getStateFormat()
           
static KeywordFormatter getValueOnlyFormatter()
           
protected  java.lang.String remove(java.lang.String text)
          Remove all RCS keywords match.
 java.lang.String reset(java.lang.String text)
          Reinitialize all RCS keywords match.
private  java.lang.String substitute(java.lang.String input, java.util.regex.Pattern pattern, java.lang.String substitution)
          Helper method for substitution that will substitute all matches of a given pattern.
 java.lang.String update(java.lang.String text, java.lang.Object[] revisionInfo)
          update the given text made of RCS keywords with the appropriate revision info.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOLLAR

private static final java.lang.String DOLLAR
See Also:
Constant Field Values

Header_FORMAT

private final java.text.Format Header_FORMAT

Id_FORMAT

private final java.text.Format Id_FORMAT

RCSFile_FORMAT

private final java.text.Format RCSFile_FORMAT

Revision_FORMAT

private final java.text.Format Revision_FORMAT

Date_FORMAT

private final java.text.Format Date_FORMAT

Author_FORMAT

private final java.text.Format Author_FORMAT

State_FORMAT

private final java.text.Format State_FORMAT

Locker_FORMAT

private final java.text.Format Locker_FORMAT

Source_FORMAT

private final java.text.Format Source_FORMAT

ID_RE

protected final java.util.regex.Pattern ID_RE

HEADER_RE

protected final java.util.regex.Pattern HEADER_RE

SOURCE_RE

protected final java.util.regex.Pattern SOURCE_RE

RCSFILE_RE

protected final java.util.regex.Pattern RCSFILE_RE

REVISION_RE

protected final java.util.regex.Pattern REVISION_RE

DATE_RE

protected final java.util.regex.Pattern DATE_RE

AUTHOR_RE

protected final java.util.regex.Pattern AUTHOR_RE

STATE_RE

protected final java.util.regex.Pattern STATE_RE

LOCKER_RE

protected final java.util.regex.Pattern LOCKER_RE

NAME_RE

protected final java.util.regex.Pattern NAME_RE

LOG_RE

protected final java.util.regex.Pattern LOG_RE

V_FORMATTER

private static final KeywordFormatter V_FORMATTER

K_FORMATTER

private static final KeywordFormatter K_FORMATTER

KV_FORMATTER

private static final KeywordFormatter KV_FORMATTER
Constructor Detail

KeywordFormatter

public KeywordFormatter()
Method Detail

update

public java.lang.String update(java.lang.String text,
                               java.lang.Object[] revisionInfo)
update the given text made of RCS keywords with the appropriate revision info.

Parameters:
text - the input text containing the RCS keywords.
revisionInfo - the revision information.
Returns:
the formatted text with the RCS keywords.

reset

public java.lang.String reset(java.lang.String text)
Reinitialize all RCS keywords match.

Parameters:
text - the text to look for RCS keywords.
Returns:
the text with initialized RCS keywords.

remove

protected java.lang.String remove(java.lang.String text)
Remove all RCS keywords match.

Parameters:
text - the text to look for RCS keywords.
Returns:
the text with removed RCS keywords.

substitute

private final java.lang.String substitute(java.lang.String input,
                                          java.util.regex.Pattern pattern,
                                          java.lang.String substitution)
Helper method for substitution that will substitute all matches of a given pattern.

Parameters:
input - the text to look for substitutions.
pattern - the pattern to replace in the input text.
substitution - the string to use as a replacement for the pattern.
Returns:
the text with the subsituted value.

getAuthorFormat

public java.text.Format getAuthorFormat()

getDateFormat

public java.text.Format getDateFormat()

getHeaderFormat

public java.text.Format getHeaderFormat()

getIdFormat

public java.text.Format getIdFormat()

getLockerFormat

public java.text.Format getLockerFormat()

getRCSFileFormat

public java.text.Format getRCSFileFormat()

getRevisionFormat

public java.text.Format getRevisionFormat()

getSourceFormat

public java.text.Format getSourceFormat()

getStateFormat

public java.text.Format getStateFormat()

getKeywordOnlyFormatter

public static KeywordFormatter getKeywordOnlyFormatter()

getKeywordAndValueFormatter

public static KeywordFormatter getKeywordAndValueFormatter()

getValueOnlyFormatter

public static KeywordFormatter getValueOnlyFormatter()


Copyright © 1999-2006 Juancarlo Añez, Caracas, Venezuela.
Some rights reserved
. http://www.suigeneris.org/jrcs