anl.aida.data
Class AliasGenerator

java.lang.Object
  extended by anl.aida.data.AliasGenerator

public class AliasGenerator
extends java.lang.Object

Generates unique sequential strings each time getNextAlias is called. The strings are produced in a sequence that runs from [0] to [n].

Version:
$Revision$ $Date$

Field Summary
private  int alias
           
private  java.util.Set<java.lang.Integer> usedAlias
           
 
Constructor Summary
AliasGenerator()
           
 
Method Summary
 java.lang.String getNextAlias()
          Gets the next alias in the sequence.
static void main(java.lang.String[] args)
           
 void markAliasUsed(java.lang.String alias)
          Marks the specified alias as used so it won't be created again.
 java.lang.String[] splitAlias(java.lang.String str)
          Splits the specified string into the alias and the rest of the string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

alias

private int alias

usedAlias

private java.util.Set<java.lang.Integer> usedAlias
Constructor Detail

AliasGenerator

public AliasGenerator()
Method Detail

getNextAlias

public java.lang.String getNextAlias()
Gets the next alias in the sequence.

Returns:
the next alias in the sequence.

markAliasUsed

public void markAliasUsed(java.lang.String alias)
Marks the specified alias as used so it won't be created again. This is used to insure that any aliases that are created from the outside are not re-created here.

Parameters:
alias - the alias to mark.

splitAlias

public java.lang.String[] splitAlias(java.lang.String str)
Splits the specified string into the alias and the rest of the string.

Parameters:
str - the string to remove the alias from.
Returns:
an array whose first element is the alias and whose second element is the remaining string.

main

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