Files
DynamicC/languages/dynamicc/source_gen/dynamicc/intentions/IntentionsDescriptor.java
2019-12-19 00:49:58 +01:00

86 lines
3.2 KiB
Java

package dynamicc.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 = concept;
switch (conceptIndex.index(cncpt)) {
case 0:
if (true) {
// concept
intentions = new IntentionFactory[2];
intentions[0] = new AddReturnType_Intention();
intentions[1] = new RemoveReturnType_Intention();
}
break;
case 1:
if (true) {
// concept
intentions = new IntentionFactory[4];
intentions[0] = new MakeStrong_Intention();
intentions[1] = new MakeWeak_Intention();
intentions[2] = new UseTypeFromC_Intention();
intentions[3] = new NotUseTypeFromC_Intention();
}
break;
case 2:
if (true) {
// concept
intentions = new IntentionFactory[4];
intentions[0] = new MakeNullable_Intention();
intentions[1] = new MakeNonNullable_Intention();
intentions[2] = new AddAssignment_Intention();
intentions[3] = new RemoveAssignment_Intention();
}
break;
default:
}
myCached.put(concept, intentions);
return Arrays.asList(intentions);
}
@NotNull
@Override
public Collection<IntentionFactory> getAllIntentions() {
IntentionFactory[] rv = new IntentionFactory[10];
rv[0] = new MakeStrong_Intention();
rv[1] = new MakeWeak_Intention();
rv[2] = new MakeNullable_Intention();
rv[3] = new MakeNonNullable_Intention();
rv[4] = new UseTypeFromC_Intention();
rv[5] = new NotUseTypeFromC_Intention();
rv[6] = new AddReturnType_Intention();
rv[7] = new RemoveReturnType_Intention();
rv[8] = new AddAssignment_Intention();
rv[9] = new RemoveAssignment_Intention();
return Arrays.asList(rv);
}
private static final ConceptSwitchIndex conceptIndex = new ConceptSwitchIndexBuilder().put(MetaIdFactory.conceptId(0xa6d9727f49824bf8L, 0xabdd083fea5126abL, 0x26ea02d22ae503deL), MetaIdFactory.conceptId(0xa6d9727f49824bf8L, 0xabdd083fea5126abL, 0x3a6fd2de0c335c33L), MetaIdFactory.conceptId(0xa6d9727f49824bf8L, 0xabdd083fea5126abL, 0x3a6fd2de0c335c2eL)).seal();
}