]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/rules/SectionName.java
(refs #7250) Merging master, minor CHR bugfixes
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / rules / SectionName.java
1 package org.simantics.scl.compiler.elaboration.rules;
2
3 import gnu.trove.map.hash.THashMap;
4
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),
10     
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);
17     
18     public final SectionRole forwardRole;
19     public final SectionRole backwardRole;
20     
21     private SectionName(SectionRole forwardRole, SectionRole backwardRole) {
22         this.forwardRole = forwardRole;
23         this.backwardRole = backwardRole;
24     }
25
26     private static final THashMap<String,SectionName> SECTION_NAME_MAP = 
27             new THashMap<String,SectionName>();
28     
29     static {
30         for(SectionName sectionName : values())
31             SECTION_NAME_MAP.put(sectionName.name(), sectionName);
32     }
33     
34     public static SectionName getSectionName(String name) {
35         return SECTION_NAME_MAP.get(name);
36     }
37 }