edu.byu.ece.edif.core
Class BasicStringIncrementer

java.lang.Object
  extended by edu.byu.ece.edif.core.BasicStringIncrementer

public class BasicStringIncrementer
extends java.lang.Object

Provides methods for "incrementing" a String value. Incrementing is a convenient way of creating unique String names in a deterministic manner.


Constructor Summary
BasicStringIncrementer()
           
 
Method Summary
static char incrementDigit(char c)
          This method will perform an "increment" on a character.
static java.lang.String incrementString(java.lang.String str)
          Provide a new String
static java.lang.String incrementString(java.lang.String str, int origLength)
          Increment a string by appending a "_" + num to the end of it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicStringIncrementer

public BasicStringIncrementer()
Method Detail

incrementDigit

public static char incrementDigit(char c)
This method will perform an "increment" on a character. This method will sequence from 'a' to 'z' and then from '0' to '9'. After reaching '9', this method will return back to 'a'. This method will return 0 if the character is invalid.

This method is case insensitive and will return a lower case incremented character.

Parameters:
c - The character to increment.
Returns:
The incremented character

incrementString

public static java.lang.String incrementString(java.lang.String str)
Provide a new String

Returns:
An incremented version of the passed in String object

incrementString

public static java.lang.String incrementString(java.lang.String str,
                                               int origLength)
Increment a string by appending a "_" + num to the end of it. If there is already an "_" at the end, the number is simply incremented. The original length of the string should be passed in so that the method will be able to determine if the "_" has already been added by this method or not.

Parameters:
str - the String to increment
origLength - the original length of the string to increment
Returns:
an incremented version of the string