package jetbrains.mps.lang.editor.behavior;

/*Generated by MPS */

import jetbrains.mps.core.aspects.behaviour.BaseBHDescriptor;
import org.jetbrains.mps.openapi.language.SAbstractConcept;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.core.aspects.behaviour.api.SMethod;
import org.jetbrains.mps.openapi.language.SEnumerationLiteral;
import jetbrains.mps.core.aspects.behaviour.SMethodBuilder;
import jetbrains.mps.core.aspects.behaviour.SJavaCompoundTypeImpl;
import jetbrains.mps.core.aspects.behaviour.AccessPrivileges;
import org.jetbrains.mps.openapi.model.SNode;
import java.util.List;
import java.util.Arrays;
import org.jetbrains.annotations.NotNull;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations;
import java.util.Objects;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SEnumOperations;
import jetbrains.mps.internal.collections.runtime.Sequence;
import jetbrains.mps.core.aspects.behaviour.api.SConstructor;
import org.jetbrains.annotations.Nullable;
import jetbrains.mps.core.aspects.behaviour.api.BHMethodNotFoundException;
import org.jetbrains.mps.openapi.language.SProperty;

public final class CellActionMapImportSelectorByActionId__BehaviorDescriptor extends BaseBHDescriptor {
  private static final SAbstractConcept CONCEPT = MetaAdapterFactory.getConcept(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x4f883d0411451703L, "jetbrains.mps.lang.editor.structure.CellActionMapImportSelectorByActionId");

  public static final SMethod<SEnumerationLiteral> getActionId_id3XXPjz_5Jxc = new SMethodBuilder<SEnumerationLiteral>(new SJavaCompoundTypeImpl((Class<SEnumerationLiteral>) ((Class) Object.class))).name("getActionId").modifiers(0, AccessPrivileges.PUBLIC).concept(CONCEPT).baseMethodId(4575047236816664652L).languageId(0xa83a7ff23bde13baL, 0x18bc659203a64e29L).build2();
  public static final SMethod<Boolean> selectsActionId_id3XXPjz_pJfc = new SMethodBuilder<Boolean>(new SJavaCompoundTypeImpl(Boolean.TYPE)).name("selectsActionId").modifiers(8, AccessPrivileges.PUBLIC).concept(CONCEPT).baseMethodId(4575047236821906380L).languageId(0xa83a7ff23bde13baL, 0x18bc659203a64e29L).build2(SMethodBuilder.createJavaParameter((Class<SEnumerationLiteral>) ((Class) Object.class), ""));
  public static final SMethod<CheckingResult> checkPresenceOfImportee_id3XXPjz_qqny = new SMethodBuilder<CheckingResult>(new SJavaCompoundTypeImpl(CheckingResult.class)).name("checkPresenceOfImportee").modifiers(8, AccessPrivileges.PUBLIC).concept(CONCEPT).baseMethodId(4575047236822083042L).languageId(0xa83a7ff23bde13baL, 0x18bc659203a64e29L).build2(SMethodBuilder.createJavaParameter((Class<SNode>) ((Class) Object.class), ""));
  public static final SMethod<SNode> getNavigatableNodeWithin_id5Sx2dSLnDj7 = new SMethodBuilder<SNode>(new SJavaCompoundTypeImpl((Class<SNode>) ((Class) Object.class))).name("getNavigatableNodeWithin").modifiers(8, AccessPrivileges.PUBLIC).concept(CONCEPT).baseMethodId(6782712264200721607L).languageId(0xa83a7ff23bde13baL, 0x18bc659203a64e29L).build2(SMethodBuilder.createJavaParameter((Class<SNode>) ((Class) Object.class), ""));

  private static final List<SMethod<?>> BH_METHODS = Arrays.<SMethod<?>>asList(getActionId_id3XXPjz_5Jxc, selectsActionId_id3XXPjz_pJfc, checkPresenceOfImportee_id3XXPjz_qqny, getNavigatableNodeWithin_id5Sx2dSLnDj7);

  private static void ___init___(@NotNull SNode __thisNode__) {
  }

  /*package*/ static SEnumerationLiteral getActionId_id3XXPjz_5Jxc(@NotNull SNode __thisNode__) {
    return SPropertyOperations.getEnum(__thisNode__, PROPS.actionId$xvlu);
  }
  /*package*/ static boolean selectsActionId_id3XXPjz_pJfc(@NotNull SNode __thisNode__, SEnumerationLiteral id) {
    return Objects.equals(CellActionMapImportSelectorByActionId__BehaviorDescriptor.getActionId_id3XXPjz_5Jxc.invoke(__thisNode__), id);
  }
  /*package*/ static CheckingResult checkPresenceOfImportee_id3XXPjz_qqny(@NotNull SNode __thisNode__, SNode actionMap) {
    SEnumerationLiteral actionId = CellActionMapImportSelectorByActionId__BehaviorDescriptor.getActionId_id3XXPjz_5Jxc.invoke(__thisNode__);
    return ((boolean) CellActionMapDeclaration__BehaviorDescriptor.containsItemOfType_id2pg2GNQgnKJ.invoke(actionMap, actionId) ? CheckingResult.success() : CheckingResult.failure("Action map " + SPropertyOperations.getString(actionMap, PROPS.name$MnvL) + " does not define or import " + SEnumOperations.getMemberPresentation(actionId)));
  }
  /*package*/ static SNode getNavigatableNodeWithin_id5Sx2dSLnDj7(@NotNull SNode __thisNode__, SNode actionMap) {
    // navigate to the action item of the matching type
    return Sequence.fromIterable(CellActionMapDeclaration__BehaviorDescriptor.collectItemsOfType_id5Sx2dSLnOI$.invoke(actionMap, CellActionMapImportSelectorByActionId__BehaviorDescriptor.getActionId_id3XXPjz_5Jxc.invoke(__thisNode__))).last();
  }

  /*package*/ CellActionMapImportSelectorByActionId__BehaviorDescriptor() {
  }

  @Override
  protected void initNode(@NotNull SNode node, @NotNull SConstructor constructor, @Nullable Object[] parameters) {
    ___init___(node);
  }

  @Override
  protected <T> T invokeSpecial0(@NotNull SNode node, @NotNull SMethod<T> method, @Nullable Object[] parameters) {
    int methodIndex = BH_METHODS.indexOf(method);
    if (methodIndex < 0) {
      throw new BHMethodNotFoundException(this, method);
    }
    switch (methodIndex) {
      case 0:
        return (T) ((SEnumerationLiteral) getActionId_id3XXPjz_5Jxc(node));
      case 1:
        return (T) ((Boolean) selectsActionId_id3XXPjz_pJfc(node, (SEnumerationLiteral) parameters[0]));
      case 2:
        return (T) ((CheckingResult) checkPresenceOfImportee_id3XXPjz_qqny(node, (SNode) parameters[0]));
      case 3:
        return (T) ((SNode) getNavigatableNodeWithin_id5Sx2dSLnDj7(node, (SNode) parameters[0]));
      default:
        throw new BHMethodNotFoundException(this, method);
    }
  }

  @Override
  protected <T> T invokeSpecial0(@NotNull SAbstractConcept concept, @NotNull SMethod<T> method, @Nullable Object[] parameters) {
    int methodIndex = BH_METHODS.indexOf(method);
    if (methodIndex < 0) {
      throw new BHMethodNotFoundException(this, method);
    }
    switch (methodIndex) {
      default:
        throw new BHMethodNotFoundException(this, method);
    }
  }

  @NotNull
  @Override
  public List<SMethod<?>> getDeclaredMethods() {
    return BH_METHODS;
  }

  @NotNull
  @Override
  public SAbstractConcept getConcept() {
    return CONCEPT;
  }

  private static final class PROPS {
    /*package*/ static final SProperty actionId$xvlu = MetaAdapterFactory.getProperty(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x4f883d0411451703L, 0x4f883d0411451706L, "actionId");
    /*package*/ static final SProperty name$MnvL = MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name");
  }
}
