1 package org.simantics.scl.compiler.types.util;
3 import gnu.trove.map.hash.THashMap;
5 public class TypeUnparsingContext {
7 THashMap<Object, String> names;
10 public TypeUnparsingContext() {
11 this.names = new THashMap<Object, String>();
15 public TypeUnparsingContext(TypeUnparsingContext parent) {
16 this.names = new THashMap<Object, String>(parent.names);
17 this.nameId = parent.nameId;
20 public String getName(Object var) {
21 String name = names.get(var);
23 name = idToName(nameId++);
29 private static final int alphabetCount = 'z'-'a'+1;
31 private static String idToName(int id) {
32 String name = Character.toString((char)('a' + id % alphabetCount));
35 name = idToName(id-1) + name;