org.apache.commons.jrcs.rcs
Class KeywordsFormat

java.lang.Object
  extended by org.apache.commons.jrcs.rcs.KeywordsFormat

final class KeywordsFormat
extends java.lang.Object

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

Field Summary
(package private)  java.text.Format Author_FORMAT
           
private  Pattern AUTHOR_RE
           
(package private)  java.text.Format Date_FORMAT
           
private  Pattern DATE_RE
           
(package private)  java.text.Format Header_FORMAT
           
private  Pattern HEADER_RE
           
(package private)  java.text.Format Id_FORMAT
           
private  Pattern ID_RE
           
(package private)  java.text.Format Locker_FORMAT
           
private  Pattern LOCKER_RE
           
private  Perl5Matcher matcher
          the matcher used for replacement
(package private)  java.text.Format RCSFile_FORMAT
           
private  Pattern RCSFILE_RE
           
(package private)  java.text.Format Revision_FORMAT
           
private  Pattern REVISION_RE
           
(package private)  java.text.Format Source_FORMAT
           
private  Pattern SOURCE_RE
           
(package private)  java.text.Format State_FORMAT
           
private  Pattern STATE_RE
           
private  StringSubstitution subst
          the substitution instance to be reused
 
Constructor Summary
KeywordsFormat()
           
 
Method Summary
(package private)  java.lang.String reset(java.lang.String text)
          Reinitialize all RCS keywords match.
private  java.lang.String substitute(java.lang.String input, Pattern pattern, java.lang.String substitution)
          Helper method for substitution that will substitute all matches of a given pattern.
(package private)  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

Header_FORMAT

final java.text.Format Header_FORMAT

Id_FORMAT

final java.text.Format Id_FORMAT

RCSFile_FORMAT

final java.text.Format RCSFile_FORMAT

Revision_FORMAT

final java.text.Format Revision_FORMAT

Date_FORMAT

final java.text.Format Date_FORMAT

Author_FORMAT

final java.text.Format Author_FORMAT

State_FORMAT

final java.text.Format State_FORMAT

Locker_FORMAT

final java.text.Format Locker_FORMAT

Source_FORMAT

final java.text.Format Source_FORMAT

ID_RE

private final Pattern ID_RE

HEADER_RE

private final Pattern HEADER_RE

SOURCE_RE

private final Pattern SOURCE_RE

RCSFILE_RE

private final Pattern RCSFILE_RE

REVISION_RE

private final Pattern REVISION_RE

DATE_RE

private final Pattern DATE_RE

AUTHOR_RE

private final Pattern AUTHOR_RE

STATE_RE

private final Pattern STATE_RE

LOCKER_RE

private final Pattern LOCKER_RE

subst

private final StringSubstitution subst
the substitution instance to be reused


matcher

private final Perl5Matcher matcher
the matcher used for replacement

Constructor Detail

KeywordsFormat

KeywordsFormat()
Method Detail

update

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

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.

substitute

private final java.lang.String substitute(java.lang.String input,
                                          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.


Copyright 2002 the Apache Software Foundation
Copyright ? 1999-2001 Juancarlo A?ez, Caracas, Venezuela.
All rights reserved
. http://www.suigeneris.org/jrcs