org.lexevs.dao.database.prefix
Class CyclingCharDbPrefixGenerator

java.lang.Object
  extended by org.lexevs.dao.database.prefix.CyclingCharDbPrefixGenerator
All Implemented Interfaces:
NextDatabasePrefixGenerator, org.springframework.beans.factory.InitializingBean

public class CyclingCharDbPrefixGenerator
extends java.lang.Object
implements org.springframework.beans.factory.InitializingBean, NextDatabasePrefixGenerator

The Class CyclingCharDbPrefixGenerator.

Author:
Kevin Peterson

Field Summary
static char[] ALPHABET
          The ALPHABET.
static char FIRST_CHARACTER
          The FIRS t_ character.
static char LAST_CHARACTER
          The LAS t_ character.
 
Constructor Summary
CyclingCharDbPrefixGenerator()
           
 
Method Summary
protected  char[] adjustLength(char[] chars)
          Adjust length.
 void afterPropertiesSet()
           
protected  boolean doesPrefixAlreadyExistInDatabase(java.lang.String prefix)
           
protected  char findNextChar(char charToFind)
          Find next char.
 java.lang.String generateNextDatabasePrefix(java.lang.String currentIdentifier)
          Generate next database prefix.
protected  char[] generateStartingCyclingPrefix()
          Generate starting cycling prefix.
 int getPrefixLengthLimit()
          Gets the prefix length limit.
 PrefixResolver getPrefixResolver()
          Gets the prefix resolver.
 Registry getRegistry()
           
protected  char[] incrementByOne(char[] chars)
          Increment by one.
protected  boolean isInCycle(char[] chars)
          Checks if is in cycle.
static void main(java.lang.String[] args)
           
protected  boolean needsExtraChar(char[] chars)
          Needs extra char.
 void setPrefixLengthLimit(int prefixLengthLimit)
          Sets the prefix length limit.
 void setPrefixResolver(PrefixResolver prefixResolver)
          Sets the prefix resolver.
 void setRegistry(Registry registry)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALPHABET

public static char[] ALPHABET
The ALPHABET.


FIRST_CHARACTER

public static char FIRST_CHARACTER
The FIRS t_ character.


LAST_CHARACTER

public static char LAST_CHARACTER
The LAS t_ character.

Constructor Detail

CyclingCharDbPrefixGenerator

public CyclingCharDbPrefixGenerator()
Method Detail

main

public static void main(java.lang.String[] args)

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

generateNextDatabasePrefix

public java.lang.String generateNextDatabasePrefix(java.lang.String currentIdentifier)
Description copied from interface: NextDatabasePrefixGenerator
Generate next database prefix.

Specified by:
generateNextDatabasePrefix in interface NextDatabasePrefixGenerator
Parameters:
currentIdentifier - the current identitfier
Returns:
the string

doesPrefixAlreadyExistInDatabase

protected boolean doesPrefixAlreadyExistInDatabase(java.lang.String prefix)

incrementByOne

protected char[] incrementByOne(char[] chars)
Increment by one.

Parameters:
chars - the chars
Returns:
the char[]

isInCycle

protected boolean isInCycle(char[] chars)
Checks if is in cycle.

Parameters:
chars - the chars
Returns:
true, if is in cycle

generateStartingCyclingPrefix

protected char[] generateStartingCyclingPrefix()
Generate starting cycling prefix.

Returns:
the char[]

adjustLength

protected char[] adjustLength(char[] chars)
Adjust length.

Parameters:
chars - the chars
Returns:
the char[]

needsExtraChar

protected boolean needsExtraChar(char[] chars)
Needs extra char.

Parameters:
chars - the chars
Returns:
true, if successful

findNextChar

protected char findNextChar(char charToFind)
Find next char.

Parameters:
charToFind - the char to find
Returns:
the char

setPrefixLengthLimit

public void setPrefixLengthLimit(int prefixLengthLimit)
Sets the prefix length limit.

Parameters:
prefixLengthLimit - the new prefix length limit

getPrefixLengthLimit

public int getPrefixLengthLimit()
Gets the prefix length limit.

Returns:
the prefix length limit

getPrefixResolver

public PrefixResolver getPrefixResolver()
Gets the prefix resolver.

Returns:
the prefix resolver

setPrefixResolver

public void setPrefixResolver(PrefixResolver prefixResolver)
Sets the prefix resolver.

Parameters:
prefixResolver - the new prefix resolver

getRegistry

public Registry getRegistry()

setRegistry

public void setRegistry(Registry registry)

Copyright: (c) 2004-2006 Mayo Foundation for Medical Education and Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the triple-shield Mayo logo are trademarks and service marks of MFMER.