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.BehaviorRegistry;
import jetbrains.mps.smodel.language.ConceptRegistry;
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.SModifiersImpl;
import jetbrains.mps.core.aspects.behaviour.AccessPrivileges;
import java.util.Set;
import java.util.List;
import java.util.Arrays;
import org.jetbrains.annotations.NotNull;
import jetbrains.mps.internal.collections.runtime.SetSequence;
import java.util.HashSet;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations;
import jetbrains.mps.lang.core.behavior.BaseConcept__BehaviorDescriptor;
import jetbrains.mps.internal.collections.runtime.ListSequence;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SConceptOperations;
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.persistence.PersistenceFacade;
import jetbrains.mps.smodel.SModelUtil_new;
import jetbrains.mps.smodel.SReference;
public final class TypeVariableDeclaration__BehaviorDescriptor extends BaseBHDescriptor {
private static final SAbstractConcept CONCEPT = MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x1024639ed74L, "jetbrains.mps.baseLanguage.structure.TypeVariableDeclaration");
private static final BehaviorRegistry REGISTRY = ConceptRegistry.getInstance().getBehaviorRegistry();
public static final SMethod<SNode> getConcreteUpperBound_id3LgQEacCviw = new SMethodBuilder<SNode>(new SJavaCompoundTypeImpl((Class<SNode>) ((Class) Object.class))).name("getConcreteUpperBound").modifiers(SModifiersImpl.create(0, AccessPrivileges.PUBLIC)).concept(CONCEPT).id("3LgQEacCviw").registry(REGISTRY).build();
/*package*/ static final SMethod<SNode> getConcreteUpperBound_id3LgQEacCu07 = new SMethodBuilder<SNode>(new SJavaCompoundTypeImpl((Class<SNode>) ((Class) Object.class))).name("getConcreteUpperBound").modifiers(SModifiersImpl.create(0, AccessPrivileges.PRIVATE)).concept(CONCEPT).id("3LgQEacCu07").registry(REGISTRY).build(SMethodBuilder.createJavaParameter((Class<Set<SNode>>) ((Class) Object.class), ""));
public static final SMethod<String> getPresentation_idhEwIMiw = new SMethodBuilder<String>(new SJavaCompoundTypeImpl(String.class)).name("getPresentation").modifiers(SModifiersImpl.create(8, AccessPrivileges.PUBLIC)).concept(CONCEPT).id("hEwIMiw").registry(REGISTRY).build();
/*package*/ static final SMethod<SNode> getTypeWithConcreteUpperBounds_id3LgQEacCu0b = new SMethodBuilder<SNode>(new SJavaCompoundTypeImpl((Class<SNode>) ((Class) Object.class))).name("getTypeWithConcreteUpperBounds").modifiers(SModifiersImpl.create(1, AccessPrivileges.PRIVATE)).concept(CONCEPT).id("3LgQEacCu0b").registry(REGISTRY).build(SMethodBuilder.createJavaParameter((Class<SNode>) ((Class) Object.class), ""), SMethodBuilder.createJavaParameter((Class<Set<SNode>>) ((Class) Object.class), ""));
private static final List<SMethod<?>> BH_METHODS = Arrays.<SMethod<?>>asList(getConcreteUpperBound_id3LgQEacCviw, getConcreteUpperBound_id3LgQEacCu07, getPresentation_idhEwIMiw, getTypeWithConcreteUpperBounds_id3LgQEacCu0b);
private static void ___init___(@NotNull SNode __thisNode__) {
}
/*package*/ static SNode getConcreteUpperBound_id3LgQEacCviw(@NotNull SNode __thisNode__) {
return TypeVariableDeclaration__BehaviorDescriptor.getConcreteUpperBound_id3LgQEacCu07.invoke(__thisNode__, SetSequence.fromSet(new HashSet<SNode>()));
}
/*package*/ static SNode getConcreteUpperBound_id3LgQEacCu07(@NotNull SNode __thisNode__, Set<SNode> visitedVars) {
if (SetSequence.fromSet(visitedVars).contains(__thisNode__)) {
return _quotation_createNode_ct7zh2_a0a0a1();
}
SetSequence.fromSet(visitedVars).addElement(__thisNode__);
if ((SLinkOperations.getTarget(__thisNode__, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x1024639ed74L, 0x11ae375bda0L, "bound")) != null)) {
return TypeVariableDeclaration__BehaviorDescriptor.getTypeWithConcreteUpperBounds_id3LgQEacCu0b.invoke(SNodeOperations.asSConcept(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x1024639ed74L, "jetbrains.mps.baseLanguage.structure.TypeVariableDeclaration")), SLinkOperations.getTarget(__thisNode__, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x1024639ed74L, 0x11ae375bda0L, "bound")), visitedVars);
} else {
return _quotation_createNode_ct7zh2_a0a0c0b();
}
}
/*package*/ static String getPresentation_idhEwIMiw(@NotNull SNode __thisNode__) {
StringBuffer buff = new StringBuffer();
buff.append(SPropertyOperations.getString(SNodeOperations.cast(SNodeOperations.getParent(__thisNode__), MetaAdapterFactory.getInterfaceConcept(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, "jetbrains.mps.lang.core.structure.INamedConcept")), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name")));
buff.append(".");
buff.append(SPropertyOperations.getString(__thisNode__, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name")));
if ((SLinkOperations.getTarget(__thisNode__, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x1024639ed74L, 0x11ae375bda0L, "bound")) != null)) {
buff.append(" extends ").append(BaseConcept__BehaviorDescriptor.getPresentation_idhEwIMiw.invoke(SLinkOperations.getTarget(__thisNode__, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x1024639ed74L, 0x11ae375bda0L, "bound"))));
}
for (SNode bound : ListSequence.fromList(SLinkOperations.getChildren(__thisNode__, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x1024639ed74L, 0x11ae913a476L, "auxBounds")))) {
buff.append(" & ").append(BaseConcept__BehaviorDescriptor.getPresentation_idhEwIMiw.invoke(bound));
}
return buff.toString();
}
/*package*/ static SNode getTypeWithConcreteUpperBounds_id3LgQEacCu0b(@NotNull SAbstractConcept __thisConcept__, SNode inputType, Set<SNode> visitedVars) {
if (SNodeOperations.isInstanceOf(inputType, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x102467229d8L, "jetbrains.mps.baseLanguage.structure.TypeVariableReference"))) {
return TypeVariableDeclaration__BehaviorDescriptor.getConcreteUpperBound_id3LgQEacCu07.invoke(SLinkOperations.getTarget(SNodeOperations.cast(SNodeOperations.copyNode(inputType), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x102467229d8L, "jetbrains.mps.baseLanguage.structure.TypeVariableReference")), MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x102467229d8L, 0x1024673a581L, "typeVariableDeclaration")), visitedVars);
}
SNode javaType = Type__BehaviorDescriptor.getJavaType_idhEwIzO1.invoke(inputType);
if (SNodeOperations.isInstanceOf(javaType, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, "jetbrains.mps.baseLanguage.structure.ClassifierType"))) {
SNode result = SConceptOperations.createNewNode(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, "jetbrains.mps.baseLanguage.structure.ClassifierType"));
SLinkOperations.setTarget(result, MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, 0x101de490babL, "classifier"), SLinkOperations.getTarget(SNodeOperations.cast(javaType, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, "jetbrains.mps.baseLanguage.structure.ClassifierType")), MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, 0x101de490babL, "classifier")));
return result;
} else {
return SNodeOperations.copyNode(javaType);
}
}
/*package*/ TypeVariableDeclaration__BehaviorDescriptor() {
super(REGISTRY);
}
@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) ((SNode) getConcreteUpperBound_id3LgQEacCviw(node));
case 1:
return (T) ((SNode) getConcreteUpperBound_id3LgQEacCu07(node, (Set<SNode>) parameters[0]));
case 2:
return (T) ((String) getPresentation_idhEwIMiw(node));
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) {
case 3:
return (T) ((SNode) getTypeWithConcreteUpperBounds_id3LgQEacCu0b(concept, (SNode) parameters[0], (Set<SNode>) parameters[1]));
default:
throw new BHMethodNotFoundException(this, method);
}
}
@NotNull
@Override
public List<SMethod<?>> getDeclaredMethods() {
return BH_METHODS;
}
@NotNull
@Override
public SAbstractConcept getConcept() {
return CONCEPT;
}
private static SNode _quotation_createNode_ct7zh2_a0a0a1() {
PersistenceFacade facade = PersistenceFacade.getInstance();
SNode quotedNode_1 = null;
quotedNode_1 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0x101de48bf9eL, "ClassifierType"), null, null, false);
quotedNode_1.setReference(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, 0x101de490babL, "classifier"), SReference.create(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, 0x101de490babL, "classifier"), quotedNode_1, facade.createModelReference("6354ebe7-c22a-4a0f-ac54-50b52ab9b065/java:java.lang(JDK/)"), facade.createNodeId("~Object")));
return quotedNode_1;
}
private static SNode _quotation_createNode_ct7zh2_a0a0c0b() {
PersistenceFacade facade = PersistenceFacade.getInstance();
SNode quotedNode_1 = null;
quotedNode_1 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0x101de48bf9eL, "ClassifierType"), null, null, false);
quotedNode_1.setReference(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, 0x101de490babL, "classifier"), SReference.create(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, 0x101de490babL, "classifier"), quotedNode_1, facade.createModelReference("6354ebe7-c22a-4a0f-ac54-50b52ab9b065/java:java.lang(JDK/)"), facade.createNodeId("~Object")));
return quotedNode_1;
}
}