X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Felaboration%2Frules%2FSectionName.java;fp=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Felaboration%2Frules%2FSectionName.java;h=90564c2b81c02cbc92fc8a990f470f26b98f026f;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git 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 index 000000000..90564c2b8 --- /dev/null +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/rules/SectionName.java @@ -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 SECTION_NAME_MAP = + new THashMap(); + + static { + for(SectionName sectionName : values()) + SECTION_NAME_MAP.put(sectionName.name(), sectionName); + } + + public static SectionName getSectionName(String name) { + return SECTION_NAME_MAP.get(name); + } +}