package jetbrains.mps.baseLanguage.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.model.SNode;
import jetbrains.mps.core.aspects.behaviour.SMethodBuilder;
import jetbrains.mps.core.aspects.behaviour.SJavaCompoundTypeImpl;
import jetbrains.mps.core.aspects.behaviour.AccessPrivileges;
import jetbrains.mps.baseLanguage.scopes.MembersPopulatingContext;
import jetbrains.mps.baseLanguage.scopes.ClassifierHierarchyVisitor;
import java.util.List;
import java.util.Arrays;
import org.jetbrains.annotations.NotNull;
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;

public final class IClassifierType__BehaviorDescriptor extends BaseBHDescriptor {
  private static final SAbstractConcept CONCEPT = MetaAdapterFactory.getInterfaceConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x66c71d82c2eb7f7eL, "jetbrains.mps.baseLanguage.structure.IClassifierType");

  public static final SMethod<SNode> getClassifier_id6r77ob2URY9 = new SMethodBuilder<SNode>(new SJavaCompoundTypeImpl((Class<SNode>) ((Class) Object.class))).name("getClassifier").modifiers(12, AccessPrivileges.PUBLIC).concept(CONCEPT).baseMethodId(7405920559687237513L).languageId(0xa443f952ceaf5816L, 0xf3061a5392264cc5L).build2();
  public static final SMethod<Iterable<SNode>> getTypeParameters_id6r77ob2URYe = new SMethodBuilder<Iterable<SNode>>(new SJavaCompoundTypeImpl((Class<Iterable<SNode>>) ((Class) Object.class))).name("getTypeParameters").modifiers(12, AccessPrivileges.PUBLIC).concept(CONCEPT).baseMethodId(7405920559687237518L).languageId(0xa443f952ceaf5816L, 0xf3061a5392264cc5L).build2();
  public static final SMethod<Iterable<SNode>> getMembers_id6r77ob2V1Fr = new SMethodBuilder<Iterable<SNode>>(new SJavaCompoundTypeImpl((Class<Iterable<SNode>>) ((Class) Object.class))).name("getMembers").modifiers(0, AccessPrivileges.PUBLIC).concept(CONCEPT).baseMethodId(7405920559687277275L).languageId(0xa443f952ceaf5816L, 0xf3061a5392264cc5L).build2();
  public static final SMethod<Iterable<SNode>> getVisibleMembers_id5laDzmpBPtZ = new SMethodBuilder<Iterable<SNode>>(new SJavaCompoundTypeImpl((Class<Iterable<SNode>>) ((Class) Object.class))).name("getVisibleMembers").modifiers(0, AccessPrivileges.PUBLIC).concept(CONCEPT).baseMethodId(6145907390641297279L).languageId(0xa443f952ceaf5816L, 0xf3061a5392264cc5L).build2(SMethodBuilder.createJavaParameter((Class<SNode>) ((Class) Object.class), ""));
  public static final SMethod<Void> populateMembers_id6r77ob2USS_ = new SMethodBuilder<Void>(new SJavaCompoundTypeImpl(Void.class)).name("populateMembers").modifiers(0, AccessPrivileges.PUBLIC).concept(CONCEPT).baseMethodId(7405920559687241253L).languageId(0xa443f952ceaf5816L, 0xf3061a5392264cc5L).build2(SMethodBuilder.createJavaParameter(MembersPopulatingContext.class, ""), SMethodBuilder.createJavaParameter((Class<SNode>) ((Class) Object.class), ""));
  public static final SMethod<Void> enumerateTypesHierarchy_id65_8Gi1edLu = new SMethodBuilder<Void>(new SJavaCompoundTypeImpl(Void.class)).name("enumerateTypesHierarchy").modifiers(0, AccessPrivileges.PUBLIC).concept(CONCEPT).baseMethodId(7018053821703707742L).languageId(0xa443f952ceaf5816L, 0xf3061a5392264cc5L).build2(SMethodBuilder.createJavaParameter(ClassifierHierarchyVisitor.class, ""));
  public static final SMethod<Void> enumerateMembers_id65_8Gi2shR6 = new SMethodBuilder<Void>(new SJavaCompoundTypeImpl(Void.class)).name("enumerateMembers").modifiers(0, AccessPrivileges.PUBLIC).concept(CONCEPT).baseMethodId(7018053821724171718L).languageId(0xa443f952ceaf5816L, 0xf3061a5392264cc5L).build2(SMethodBuilder.createJavaParameter(ClassifierHierarchyVisitor.class, ""));
  public static final SMethod<Void> enumerateObjectMembers_id9QjKR8mfZm = new SMethodBuilder<Void>(new SJavaCompoundTypeImpl(Void.class)).name("enumerateObjectMembers").modifiers(0, AccessPrivileges.PUBLIC).concept(CONCEPT).baseMethodId(177416155942158294L).languageId(0xa443f952ceaf5816L, 0xf3061a5392264cc5L).build2(SMethodBuilder.createJavaParameter(ClassifierHierarchyVisitor.class, ""));

  private static final List<SMethod<?>> BH_METHODS = Arrays.<SMethod<?>>asList(getClassifier_id6r77ob2URY9, getTypeParameters_id6r77ob2URYe, getMembers_id6r77ob2V1Fr, getVisibleMembers_id5laDzmpBPtZ, populateMembers_id6r77ob2USS_, enumerateTypesHierarchy_id65_8Gi1edLu, enumerateMembers_id65_8Gi2shR6, enumerateObjectMembers_id9QjKR8mfZm);

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

  /*package*/ static Iterable<SNode> getMembers_id6r77ob2V1Fr(@NotNull SNode __thisNode__) {
    MembersPopulatingContext scope = new MembersPopulatingContext(__thisNode__);
    IClassifierType__BehaviorDescriptor.enumerateTypesHierarchy_id65_8Gi1edLu.invoke(__thisNode__, scope);
    return scope.getMembers();
  }
  /*package*/ static Iterable<SNode> getVisibleMembers_id5laDzmpBPtZ(@NotNull final SNode __thisNode__, final SNode contextNode) {
    // note, code that does ofConcept<> filtering of returned value might be more effective if does filtering first
    // as isVisible() operation might be quite expensive
    return Sequence.fromIterable(IClassifierType__BehaviorDescriptor.getMembers_id6r77ob2V1Fr.invoke(__thisNode__)).where((it) -> (boolean) IClassifierMember__BehaviorDescriptor.isVisible_id5laDzmpBPv8.invoke(it, __thisNode__, contextNode));
  }
  @Deprecated
  /*package*/ static void populateMembers_id6r77ob2USS_(@NotNull SNode __thisNode__, MembersPopulatingContext context, SNode classifier) {
    SNode thisClassifier = IClassifierType__BehaviorDescriptor.getClassifier_id6r77ob2URY9.invoke(__thisNode__);

    if ((thisClassifier != null)) {
      if (context.enterClassifierInternal(__thisNode__)) {
        try {
          IClassifier__BehaviorDescriptor.populateMembers_id6r77ob2USUV.invoke(thisClassifier, context, classifier);
        } finally {
          context.exitClassifierInternal(__thisNode__);
        }
      }
    }
  }
  /*package*/ static void enumerateTypesHierarchy_id65_8Gi1edLu(@NotNull SNode __thisNode__, ClassifierHierarchyVisitor visitor) {
    SNode thisClassifier = IClassifierType__BehaviorDescriptor.getClassifier_id6r77ob2URY9.invoke(__thisNode__);
    if ((thisClassifier != null)) {
      if (visitor.enterClassifierType(__thisNode__)) {
        try {
          IClassifier__BehaviorDescriptor.enumerateSupertypes_id65_8Gi1dKDs.invoke(thisClassifier, visitor);
        } finally {
          visitor.exitClassifierType(__thisNode__);
        }
      }
    }
  }
  /*package*/ static void enumerateMembers_id65_8Gi2shR6(@NotNull SNode __thisNode__, ClassifierHierarchyVisitor visitor) {
    SNode thisClassifier = IClassifierType__BehaviorDescriptor.getClassifier_id6r77ob2URY9.invoke(__thisNode__);
    if ((thisClassifier != null)) {
      IClassifier__BehaviorDescriptor.enumerateMembers_id65_8Gi2s6iV.invoke(thisClassifier, visitor);
    }
  }
  /*package*/ static void enumerateObjectMembers_id9QjKR8mfZm(@NotNull SNode __thisNode__, ClassifierHierarchyVisitor visitor) {
    SNode thisClassifier = IClassifierType__BehaviorDescriptor.getClassifier_id6r77ob2URY9.invoke(__thisNode__);
    if ((thisClassifier != null)) {
      IClassifier__BehaviorDescriptor.enumerateObjectMembers_id9QjKR8ksDs.invoke(thisClassifier, visitor);
    }
  }

  /*package*/ IClassifierType__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 2:
        return (T) ((Iterable<SNode>) getMembers_id6r77ob2V1Fr(node));
      case 3:
        return (T) ((Iterable<SNode>) getVisibleMembers_id5laDzmpBPtZ(node, (SNode) parameters[0]));
      case 4:
        populateMembers_id6r77ob2USS_(node, (MembersPopulatingContext) parameters[0], (SNode) parameters[1]);
        return null;
      case 5:
        enumerateTypesHierarchy_id65_8Gi1edLu(node, (ClassifierHierarchyVisitor) parameters[0]);
        return null;
      case 6:
        enumerateMembers_id65_8Gi2shR6(node, (ClassifierHierarchyVisitor) parameters[0]);
        return null;
      case 7:
        enumerateObjectMembers_id9QjKR8mfZm(node, (ClassifierHierarchyVisitor) parameters[0]);
        return null;
      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;
  }
}
