package jetbrains.mps.baseLanguage.constraints;

/*Generated by MPS */

import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.internal.collections.runtime.ListSequence;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import jetbrains.mps.baseLanguage.behavior.ClassifierMember__BehaviorDescriptor;
import org.jetbrains.mps.openapi.language.SInterfaceConcept;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import org.jetbrains.mps.openapi.language.SConcept;

public class ConstraintsUtil {
  public static boolean isInNonStaticClasssifierContext(SNode node) {
    if (!(isInsideOfClassifier(node))) {
      return false;
    }
    return ListSequence.fromList(SNodeOperations.getNodeAncestors(node, CONCEPTS.ClassifierMember$At, true)).where((it) -> !((boolean) ClassifierMember__BehaviorDescriptor.isStaticClassifierMember_id7MS72Gc8avw.invoke(it))).isNotEmpty();
  }

  public static boolean isInsideOfClassifier(SNode node) {
    return (SNodeOperations.getNodeAncestor(node, CONCEPTS.Classifier$Ix, true, false) != null);
  }

  private static final class CONCEPTS {
    /*package*/ static final SInterfaceConcept ClassifierMember$At = MetaAdapterFactory.getInterfaceConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x112574373bdL, "jetbrains.mps.baseLanguage.structure.ClassifierMember");
    /*package*/ static final SConcept Classifier$Ix = MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101d9d3ca30L, "jetbrains.mps.baseLanguage.structure.Classifier");
  }
}
