1 package org.simantics.scl.compiler.types.util;
3 import gnu.trove.map.hash.THashMap;
5 public class TypeUnparsingContext {
7 THashMap<Object, String> names;
9 public boolean showSkeletons;
11 public TypeUnparsingContext() {
12 this.names = new THashMap<Object, String>();
16 public TypeUnparsingContext(TypeUnparsingContext parent) {
17 this.names = new THashMap<Object, String>(parent.names);
18 this.nameId = parent.nameId;
21 public String getName(Object var) {
22 String name = names.get(var);
24 name = idToName(nameId++);
30 private static final int alphabetCount = 'z'-'a'+1;
32 private static String idToName(int id) {
33 String name = Character.toString((char)('a' + id % alphabetCount));
36 name = idToName(id-1) + name;