package jetbrains.mps.lang.editor.menus.substitute.testLanguage.constraints;
/*Generated by MPS */
import jetbrains.mps.smodel.runtime.base.BaseConstraintsDescriptor;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.smodel.runtime.ConstraintFunction;
import jetbrains.mps.smodel.runtime.ConstraintContext_CanBeParent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import jetbrains.mps.smodel.runtime.CheckingNodeContext;
import jetbrains.mps.smodel.runtime.ConstraintContext_CanBeAncestor;
import org.jetbrains.mps.openapi.model.SNode;
import org.jetbrains.mps.openapi.language.SAbstractConcept;
import org.jetbrains.mps.openapi.language.SContainmentLink;
import jetbrains.mps.smodel.SNodePointer;
public class TestSubstituteParentWithConstraints_Constraints extends BaseConstraintsDescriptor {
public TestSubstituteParentWithConstraints_Constraints() {
super(MetaAdapterFactory.getConcept(0xcb6d57037c8e46a9L, 0xb993c1373dc0942fL, 0x9c8de75f2cc6e9aL, "jetbrains.mps.lang.editor.menus.substitute.testLanguage.structure.TestSubstituteParentWithConstraints"));
}
@Override
protected ConstraintFunction<ConstraintContext_CanBeParent, Boolean> calculateCanBeParentConstraint() {
return new ConstraintFunction<ConstraintContext_CanBeParent, Boolean>() {
@NotNull
public Boolean invoke(@NotNull ConstraintContext_CanBeParent context, @Nullable CheckingNodeContext checkingNodeContext) {
boolean result = staticCanBeAParent(context.getNode(), context.getChildNode(), context.getChildConcept(), context.getLink());
if (!(result) && checkingNodeContext != null) {
checkingNodeContext.setBreakingNode(canBeParentBreakingPoint);
}
return result;
}
};
}
@Override
protected ConstraintFunction<ConstraintContext_CanBeAncestor, Boolean> calculateCanBeAncestorConstraint() {
return new ConstraintFunction<ConstraintContext_CanBeAncestor, Boolean>() {
@NotNull
public Boolean invoke(@NotNull ConstraintContext_CanBeAncestor context, @Nullable CheckingNodeContext checkingNodeContext) {
boolean result = staticCanBeAnAncestor(context.getNode(), context.getChildNode(), context.getChildConcept(), context.getParentNode(), context.getLink());
if (!(result) && checkingNodeContext != null) {
checkingNodeContext.setBreakingNode(canBeRootBreakingPoint);
}
return result;
}
};
}
private static boolean staticCanBeAParent(SNode node, SNode childNode, SAbstractConcept childConcept, SContainmentLink link) {
if (eq_sxfanc_a0a0e(link, MetaAdapterFactory.getContainmentLink(0xcb6d57037c8e46a9L, 0xb993c1373dc0942fL, 0x9c8de75f2cc6e9aL, 0x9c8de75f2cc6e9cL, "childCanBeParent"))) {
return eq_sxfanc_a0a0a0e(childConcept, MetaAdapterFactory.getConcept(0xcb6d57037c8e46a9L, 0xb993c1373dc0942fL, 0x9c8de75f2ccf9b4L, "jetbrains.mps.lang.editor.menus.substitute.testLanguage.structure.TestSubstituteChildWithConstraints1"));
}
if (eq_sxfanc_a0b0e(link, MetaAdapterFactory.getContainmentLink(0xcb6d57037c8e46a9L, 0xb993c1373dc0942fL, 0x9c8de75f2cc6e9aL, 0x9c8de75f2d23240L, "childWrapperCanBeParent"))) {
return eq_sxfanc_a0a0b0e(childConcept, MetaAdapterFactory.getConcept(0xcb6d57037c8e46a9L, 0xb993c1373dc0942fL, 0x9c8de75f2d21687L, "jetbrains.mps.lang.editor.menus.substitute.testLanguage.structure.TestSubstituteChildWithConstraintsWrapper1"));
}
return true;
}
private static boolean staticCanBeAnAncestor(SNode node, SNode childNode, SAbstractConcept childConcept, SNode parentNode, SContainmentLink link) {
return neq_sxfanc_a0a0a0f(childConcept, MetaAdapterFactory.getConcept(0xcb6d57037c8e46a9L, 0xb993c1373dc0942fL, 0x9c8de75f2ceddc8L, "jetbrains.mps.lang.editor.menus.substitute.testLanguage.structure.TestSubstituteChildWithConstraints3")) && neq_sxfanc_a0a0a0f_0(childConcept, MetaAdapterFactory.getConcept(0xcb6d57037c8e46a9L, 0xb993c1373dc0942fL, 0x9c8de75f2d41c8eL, "jetbrains.mps.lang.editor.menus.substitute.testLanguage.structure.TestSubstituteChildWithConstraintsWrapper3")) && neq_sxfanc_a0a0a5(childConcept, MetaAdapterFactory.getConcept(0xcb6d57037c8e46a9L, 0xb993c1373dc0942fL, 0x73096e13d1e2b4e1L, "jetbrains.mps.lang.editor.menus.substitute.testLanguage.structure.TestSubstituteGrandChildWithConstraintsProhibited"));
}
private static boolean eq_sxfanc_a0a0a0e(Object a, Object b) {
return (a != null ? a.equals(b) : a == b);
}
private static boolean eq_sxfanc_a0a0e(Object a, Object b) {
return (a != null ? a.equals(b) : a == b);
}
private static boolean eq_sxfanc_a0a0b0e(Object a, Object b) {
return (a != null ? a.equals(b) : a == b);
}
private static boolean eq_sxfanc_a0b0e(Object a, Object b) {
return (a != null ? a.equals(b) : a == b);
}
private static boolean neq_sxfanc_a0a0a5(Object a, Object b) {
return !(((a != null ? a.equals(b) : a == b)));
}
private static boolean neq_sxfanc_a0a0a0f(Object a, Object b) {
return !(((a != null ? a.equals(b) : a == b)));
}
private static boolean neq_sxfanc_a0a0a0f_0(Object a, Object b) {
return !(((a != null ? a.equals(b) : a == b)));
}
private static SNodePointer canBeParentBreakingPoint = new SNodePointer("r:0cba60fc-aa17-42ba-b3ca-69b0d1a86fe9(jetbrains.mps.lang.editor.menus.substitute.testLanguage.constraints)", "1227128029536583138");
private static SNodePointer canBeRootBreakingPoint = new SNodePointer("r:0cba60fc-aa17-42ba-b3ca-69b0d1a86fe9(jetbrains.mps.lang.editor.menus.substitute.testLanguage.constraints)", "1227128029536583118");
}