public class NameManager implements INameManager {
private Set namePool = new HashSet();
public String generateName(String nameType) {
if (!namePool.contains(nameType)) {
namePool.add(nameType);
return nameType;
}
int i = 1;
while (namePool.contains(nameType + i)) {
i++;
}
namePool.add(nameType + i);
return nameType + i;
}