1 package org.simantics.scl.compiler.elaboration.rules;
3 import gnu.trove.map.hash.THashMap;
5 public enum SectionName {
6 when(SectionRole.MATCH, SectionRole.MATCH),
7 where(SectionRole.ENFORCE, SectionRole.ENFORCE),
8 from(SectionRole.MATCH, SectionRole.ENFORCE),
9 to(SectionRole.ENFORCE, SectionRole.MATCH),
11 fromCondition(SectionRole.MATCH, SectionRole.IGNORE),
12 toCondition(SectionRole.IGNORE, SectionRole.MATCH),
13 fromEnforce(SectionRole.ENFORCE, SectionRole.IGNORE),
14 toEnforce(SectionRole.IGNORE, SectionRole.ENFORCE),
15 fromDefault(SectionRole.ENFORCE_FIRST_TIME, SectionRole.IGNORE),
16 toDefault(SectionRole.IGNORE, SectionRole.ENFORCE_FIRST_TIME);
18 public final SectionRole forwardRole;
19 public final SectionRole backwardRole;
21 private SectionName(SectionRole forwardRole, SectionRole backwardRole) {
22 this.forwardRole = forwardRole;
23 this.backwardRole = backwardRole;
26 private static final THashMap<String,SectionName> SECTION_NAME_MAP =
27 new THashMap<String,SectionName>();
30 for(SectionName sectionName : values())
31 SECTION_NAME_MAP.put(sectionName.name(), sectionName);
34 public static SectionName getSectionName(String name) {
35 return SECTION_NAME_MAP.get(name);