ca.cbc.sportwire.util
Class RegexMap

java.lang.Object
  |
  +--ca.cbc.sportwire.util.RegexMap

public class RegexMap
extends java.lang.Object

RegexMap.java: A Map class that is created from an array of three-part strings key,pattern,replacement to produce a map of key values to Perl5 pattern/replacement pairs (remember that the commas must be escaped in the property file!)

Created: Tue Mar 26 20:06:43 2002
 $Log: RegexMap.java,v $
 Revision 1.2  2002/04/04 01:46:09  garym
 Skeletal translation of TSN to SportsML

 Revision 1.1  2002/03/28 02:22:19  garym
 Added RegexMap util and CDATA traps in the TSN-feed


 

Version:
$Id: RegexMap.java,v 1.2 2002/04/04 01:46:09 garym Exp $
Author:
Gary Lawrence Murphy

Inner Class Summary
(package private)  class RegexMap.RegexPair
           
 
Field Summary
(package private) static org.apache.log4j.Category cat
           
private  java.util.Map map
           
private static org.apache.oro.text.regex.Perl5Compiler perl
           
private static java.lang.String PROPERTY_PATTERN
           
private static org.apache.oro.text.regex.Pattern propertyPattern
           
 
Constructor Summary
RegexMap(java.util.List tuples)
          RegexMap constructor requires a list of tuple strings of the form key,pattern,replacement
 
Method Summary
 java.util.List getKeys()
           
 java.util.List getKeys(java.lang.String key)
           
 java.lang.String process(java.lang.String key, java.lang.String source)
          process: if there is a pattern/replacement indexed by the key, the pair is applied to the source string.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

cat

static org.apache.log4j.Category cat

PROPERTY_PATTERN

private static final java.lang.String PROPERTY_PATTERN

perl

private static org.apache.oro.text.regex.Perl5Compiler perl

propertyPattern

private static org.apache.oro.text.regex.Pattern propertyPattern

map

private java.util.Map map
Constructor Detail

RegexMap

public RegexMap(java.util.List tuples)
         throws java.lang.Exception
RegexMap constructor requires a list of tuple strings of the form key,pattern,replacement
Parameters:
tuples - a List value
Method Detail

process

public java.lang.String process(java.lang.String key,
                                java.lang.String source)
process: if there is a pattern/replacement indexed by the key, the pair is applied to the source string. Pairs are compiled on-demand.
Parameters:
key - a String value
source - a String value
Returns:
a String value

getKeys

public java.util.List getKeys()

getKeys

public java.util.List getKeys(java.lang.String key)