Package net.hydromatic.morel.compile
Class NameGenerator
- java.lang.Object
-
- net.hydromatic.morel.compile.NameGenerator
-
public class NameGenerator extends Object
Generates unique names.Also keeps track of how many times each given name has been used in this program, so that a new occurrence of a name can be given a fresh ordinal.
-
-
Field Summary
Fields Modifier and Type Field Description private intidprivate Map<String,AtomicInteger>nameCounts
-
Constructor Summary
Constructors Constructor Description NameGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringget()Generates a name that is unique in this program.intinc(String name)Returns the number of times that "name" has been used for a variable.
-
-
-
Field Detail
-
id
private int id
-
nameCounts
private final Map<String,AtomicInteger> nameCounts
-
-