info.informatica.text.mapper
Class SingleTextMapper

java.lang.Object
  extended by info.informatica.text.mapper.SingleTextMapper
All Implemented Interfaces:
TextMapper
Direct Known Subclasses:
IdentityMapper, LeftMountMapper, LeftReplaceMapper, RegexpMapper, RegexpReplaceMapper, RightMountMapper, RightReplaceMapper

public abstract class SingleTextMapper
extends Object
implements TextMapper

Abstract base class for most text mappers

Version:
1.03
Author:
amengual at informatica dot info

Constructor Summary
SingleTextMapper()
           
 
Method Summary
 void addMapping(String a, String b)
          Adds a mapping rule between a and b
 void init(Reader re)
          Initialize the mapper
 void init(String initString)
          Deprecated.  
 String map(String canon)
          Maps arg to another String and returns it.
abstract  String map(String canon, String unmatch)
          Maps arg to another String and returns it.
 String map(String canon, String unmatch, String def)
          Maps arg to another String and returns it.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleTextMapper

public SingleTextMapper()
Method Detail

init

public void init(String initString)
          throws IOException,
                 MapperException
Deprecated. 

Initialize the mapper

Specified by:
init in interface TextMapper
Parameters:
initString - the String used to initialize the map
Throws:
IOException
MapperException

init

public void init(Reader re)
          throws IOException,
                 MapperException
Initialize the mapper

Specified by:
init in interface TextMapper
Parameters:
re - the stream reader used to initialize the map
Throws:
IOException
MapperException

addMapping

public void addMapping(String a,
                       String b)
Description copied from interface: TextMapper
Adds a mapping rule between a and b

Specified by:
addMapping in interface TextMapper

map

public String map(String canon)
Description copied from interface: TextMapper
Maps arg to another String and returns it.

Specified by:
map in interface TextMapper
Parameters:
canon - the String to be mapped
Returns:
the String in the "Range Set" resulting from the map, or null if arg was not in the Domain Set (or if the mapping result was null itself).

map

public abstract String map(String canon,
                           String unmatch)
Description copied from interface: TextMapper
Maps arg to another String and returns it.

Specified by:
map in interface TextMapper
Parameters:
canon - the String to be mapped
unmatch - the String to be returned if the argument does not match any mapping.
Returns:
the String in the "Range Set" resulting from the map, or unmatch if arg was not contained in the Domain Set, and the mapper therefore did not know how to map.

map

public String map(String canon,
                  String unmatch,
                  String def)
Description copied from interface: TextMapper
Maps arg to another String and returns it.

Specified by:
map in interface TextMapper
Parameters:
canon - the String to be mapped
unmatch - the String to be returned if the argument does not match any mapping.
def - the value to be returned if the argument maps to null.
Returns:
the String in the "Range Set" resulting from the map, or unmatch if arg was not contained in the Domain Set of the mapper, or def if the mapper returned null.