]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/rules/SectionName.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / rules / SectionName.java
diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/rules/SectionName.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/rules/SectionName.java
new file mode 100644 (file)
index 0000000..90564c2
--- /dev/null
@@ -0,0 +1,37 @@
+package org.simantics.scl.compiler.elaboration.rules;
+
+import gnu.trove.map.hash.THashMap;
+
+public enum SectionName {
+    when(SectionRole.MATCH, SectionRole.MATCH),
+    where(SectionRole.ENFORCE, SectionRole.ENFORCE),
+    from(SectionRole.MATCH, SectionRole.ENFORCE),
+    to(SectionRole.ENFORCE, SectionRole.MATCH),
+    
+    fromCondition(SectionRole.MATCH, SectionRole.IGNORE),
+    toCondition(SectionRole.IGNORE, SectionRole.MATCH),
+    fromEnforce(SectionRole.ENFORCE, SectionRole.IGNORE),
+    toEnforce(SectionRole.IGNORE, SectionRole.ENFORCE),
+    fromDefault(SectionRole.ENFORCE_FIRST_TIME, SectionRole.IGNORE),
+    toDefault(SectionRole.IGNORE, SectionRole.ENFORCE_FIRST_TIME);
+    
+    public final SectionRole forwardRole;
+    public final SectionRole backwardRole;
+    
+    private SectionName(SectionRole forwardRole, SectionRole backwardRole) {
+        this.forwardRole = forwardRole;
+        this.backwardRole = backwardRole;
+    }
+
+    private static final THashMap<String,SectionName> SECTION_NAME_MAP = 
+            new THashMap<String,SectionName>();
+    
+    static {
+        for(SectionName sectionName : values())
+            SECTION_NAME_MAP.put(sectionName.name(), sectionName);
+    }
+    
+    public static SectionName getSectionName(String name) {
+        return SECTION_NAME_MAP.get(name);
+    }
+}