package org.jetbrains.mps.samples.IfAndUnless.intentions; /*Generated by MPS */ import jetbrains.mps.intentions.AbstractIntentionAspectDescriptor; import jetbrains.mps.openapi.intentions.IntentionFactory; import java.util.Map; import org.jetbrains.mps.openapi.language.SAbstractConcept; import java.util.HashMap; import org.jetbrains.annotations.Nullable; import java.util.Collection; import org.jetbrains.annotations.NotNull; import java.util.Arrays; import jetbrains.mps.lang.smodel.ConceptSwitchIndex; import jetbrains.mps.lang.smodel.ConceptSwitchIndexBuilder; import jetbrains.mps.smodel.adapter.ids.MetaIdFactory; public final class IntentionsDescriptor extends AbstractIntentionAspectDescriptor { private static final IntentionFactory[] EMPTY_ARRAY = new IntentionFactory[0]; private Map<SAbstractConcept, IntentionFactory[]> myCached = new HashMap<SAbstractConcept, IntentionFactory[]>(); public IntentionsDescriptor() { } @Nullable public Collection<IntentionFactory> getIntentions(@NotNull SAbstractConcept concept) { if (myCached.containsKey(concept)) { return Arrays.asList(myCached.get(concept)); } IntentionFactory[] intentions = EMPTY_ARRAY; SAbstractConcept cncpt_d0f = concept; switch (index_hphjzv_d0f.index(cncpt_d0f)) { case 0: if (true) { // Concept: MyIfStatement intentions = new IntentionFactory[1]; intentions[0] = new ConvertMyIfToIf_Intention(); } break; case 1: if (true) { // Concept: Statement intentions = new IntentionFactory[1]; intentions[0] = new SurroundWithUnless_Intention(); } break; case 2: if (true) { // Concept: UnlessStatement intentions = new IntentionFactory[2]; intentions[0] = new UnwrapUnlessBlock_Intention(); intentions[1] = new TurnToIfStatement_Intention(); } break; default: } myCached.put(concept, intentions); return Arrays.asList(intentions); } @NotNull @Override public Collection<IntentionFactory> getAllIntentions() { IntentionFactory[] rv = new IntentionFactory[4]; rv[0] = new UnwrapUnlessBlock_Intention(); rv[1] = new TurnToIfStatement_Intention(); rv[2] = new ConvertMyIfToIf_Intention(); rv[3] = new SurroundWithUnless_Intention(); return Arrays.asList(rv); } private static final ConceptSwitchIndex index_hphjzv_d0f = new ConceptSwitchIndexBuilder().put(MetaIdFactory.conceptId(0x67b828fd8fbc4496L, 0xb7f78b64ac097c62L, 0xd403d58ad448ccaL), MetaIdFactory.conceptId(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b215L), MetaIdFactory.conceptId(0x67b828fd8fbc4496L, 0xb7f78b64ac097c62L, 0x57547b70f36dc0dL)).seal(); }