net.ctdp.rfdynhud.util
Class AbstractThreeLetterCodeGenerator

java.lang.Object
  extended by net.ctdp.rfdynhud.util.AbstractThreeLetterCodeGenerator
All Implemented Interfaces:
ThreeLetterCodeGenerator
Direct Known Subclasses:
ThreeLetterCodeGeneratorForename1Lastname2, ThreeLetterCodeGeneratorLastname3

public abstract class AbstractThreeLetterCodeGenerator
extends java.lang.Object
implements ThreeLetterCodeGenerator

Standard implementation of the ThreeLetterCodeGenerator.

Author:
Marvin Froehlich (CTDP)

Constructor Summary
AbstractThreeLetterCodeGenerator()
           
 
Method Summary
 java.lang.String generateShortForm(java.lang.String driverName)
          
protected  java.lang.String generateShortFormFromForeAndLastName(java.lang.String driverName, int lastSpacePos)
          This method is called from generateShortForm(String), if and only if the driverName contains a space and one character before it and after it.
 java.lang.String generateThreeLetterCode(java.lang.String driverName)
          
protected abstract  java.lang.String generateThreeLetterCodeFromForeAndLastName(java.lang.String driverName, int lastSpacePos)
          This method is called from generateThreeLetterCode(String), if and only if the driverName contains a space and one character before it and after it.
static ThreeLetterCodeGenerator initThreeLetterCodeGenerator(java.lang.String className)
          Tries to instantiate the class given by name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractThreeLetterCodeGenerator

public AbstractThreeLetterCodeGenerator()
Method Detail

generateThreeLetterCodeFromForeAndLastName

protected abstract java.lang.String generateThreeLetterCodeFromForeAndLastName(java.lang.String driverName,
                                                                               int lastSpacePos)
This method is called from generateThreeLetterCode(String), if and only if the driverName contains a space and one character before it and after it.

Parameters:
driverName - the complete driver's name
lastSpacePos - the last space position in the driverName
Returns:
the generated short form

generateThreeLetterCode

public java.lang.String generateThreeLetterCode(java.lang.String driverName)

Specified by:
generateThreeLetterCode in interface ThreeLetterCodeGenerator

generateShortFormFromForeAndLastName

protected java.lang.String generateShortFormFromForeAndLastName(java.lang.String driverName,
                                                                int lastSpacePos)
This method is called from generateShortForm(String), if and only if the driverName contains a space and one character before it and after it.

Parameters:
driverName - the complete driver's name
lastSpacePos - the last space position in the driverName
Returns:
the generated short form

generateShortForm

public java.lang.String generateShortForm(java.lang.String driverName)

Specified by:
generateShortForm in interface ThreeLetterCodeGenerator

initThreeLetterCodeGenerator

public static final ThreeLetterCodeGenerator initThreeLetterCodeGenerator(java.lang.String className)
Tries to instantiate the class given by name. If it exists, is accessible/instantiatable and implements ThreeLetterCodeGenerator, the instance is returned. Otherwise the default implementation is returned.

Parameters:
className - the class name for the ThreeLetterCodeGenerator
Returns:
the initialized instance.