edu.mit.csail.sdg.alloy4
Class UniqueNameGenerator

java.lang.Object
  extended by edu.mit.csail.sdg.alloy4.UniqueNameGenerator

public final class UniqueNameGenerator
extends java.lang.Object

This generates unique names based on names provided by the caller.

Thread Safety: Safe.


Constructor Summary
UniqueNameGenerator()
          Construct a UniqueNameGenerator with a blank history.
 
Method Summary
 void clear()
          Clear the history of previously generated names.
 boolean hasSeen(java.lang.String name)
          Queries whether the provided name has been "seen" or not.
 java.lang.String make(java.lang.String name)
          Generate a unique name based on the input name.
 java.lang.String seen(java.lang.String name)
          Regard the provided name as "seen".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UniqueNameGenerator

public UniqueNameGenerator()
Construct a UniqueNameGenerator with a blank history.

Method Detail

seen

public java.lang.String seen(java.lang.String name)
Regard the provided name as "seen".

For convenience, it returns the argument as the return value.


hasSeen

public boolean hasSeen(java.lang.String name)
Queries whether the provided name has been "seen" or not.


clear

public void clear()
Clear the history of previously generated names.


make

public java.lang.String make(java.lang.String name)
Generate a unique name based on the input name.

Specifically: if the name has not been generated/seen already by this generator, then it is returned as is. Otherwise, we append ' to it until the name becomes unique.