drasys.or.util
Class KeyGenerator

java.lang.Object
  |
  +--drasys.or.util.KeyGenerator

public class KeyGenerator
extends java.lang.Object
implements java.util.Enumeration, java.io.Serializable

Generates a sequence of unique strings that can be used as keys. Each character position in the key is selected from a character set assigned to that position.

See Also:
Serialized Form

Constructor Summary
KeyGenerator(int size)
          Construct a KeyGenerator that generates keys with 'size' characters.
KeyGenerator(int size, java.lang.String characterSet)
          Construct a KeyGenerator that generates keys with 'size' characters.
KeyGenerator(java.lang.String[] characterSet)
          Construct a KeyGenerator that generates keys with 'characterSet.length' characters.
 
Method Summary
 boolean hasMoreElements()
          Returns 'true' until the generator starts to repeat.
 java.lang.Object nextElement()
          Gets the next key from the generator.
 java.lang.String nextKey()
          Get the next key from the generator;
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyGenerator

public KeyGenerator(int size)
Construct a KeyGenerator that generates keys with 'size' characters. The default character set for each key position is A-Z.

KeyGenerator

public KeyGenerator(int size,
                    java.lang.String characterSet)
Construct a KeyGenerator that generates keys with 'size' characters. The generator will use 'characterSet' as the character set for all positions.

KeyGenerator

public KeyGenerator(java.lang.String[] characterSet)
Construct a KeyGenerator that generates keys with 'characterSet.length' characters. The generator will use a string from 'characterSet' as the character set for each position. The string 'characterSet[0]' will be the character set for the right most character of the key.
Method Detail

hasMoreElements

public boolean hasMoreElements()
Returns 'true' until the generator starts to repeat.
Specified by:
hasMoreElements in interface java.util.Enumeration

nextElement

public java.lang.Object nextElement()
Gets the next key from the generator.
Specified by:
nextElement in interface java.util.Enumeration

nextKey

public java.lang.String nextKey()
Get the next key from the generator;


Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com