package jetbrains.mps.baseLanguage.findUsages; /*Generated by MPS */ import jetbrains.mps.ide.findusages.findalgorithm.finders.GeneratedFinder; import org.jetbrains.mps.openapi.language.SAbstractConcept; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import org.jetbrains.mps.openapi.model.SNode; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations; import org.jetbrains.mps.openapi.module.SearchScope; import java.util.List; import org.jetbrains.mps.openapi.util.ProgressMonitor; import jetbrains.mps.internal.collections.runtime.ListSequence; import jetbrains.mps.baseLanguage.search.ClassifierSuccessors; import jetbrains.mps.internal.collections.runtime.Sequence; import jetbrains.mps.baseLanguage.behavior.Classifier__BehaviorDescriptor; import jetbrains.mps.internal.collections.runtime.IWhereFilter; import jetbrains.mps.baseLanguage.behavior.BaseMethodDeclaration__BehaviorDescriptor; import jetbrains.mps.internal.collections.runtime.IVisitor; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; import org.jetbrains.annotations.Nullable; import org.jetbrains.mps.openapi.model.SNodeReference; public class DerivedMethods_Finder extends GeneratedFinder { public DerivedMethods_Finder() { } @Override public String getDescription() { return "Derived Methods"; } @Override public String getLongDescription() { return ""; } @Override public SAbstractConcept getSConcept() { return MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b21dL, "jetbrains.mps.baseLanguage.structure.InstanceMethodDeclaration"); } @Override public boolean isApplicable(SNode node) { return SNodeOperations.isInstanceOf(SNodeOperations.getParent(node), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101d9d3ca30L, "jetbrains.mps.baseLanguage.structure.Classifier")); } @Override protected void doFind(SNode node, SearchScope scope, final List<SNode> _results, ProgressMonitor monitor) { monitor.start(getDescription(), 0); try { SNode classifier = (SNode) SNodeOperations.getParent(node); final SNode instanceMethod = node; for (SNode derivedClassifier : ListSequence.fromList(ClassifierSuccessors.getInstance().getDerivedClassifiers(classifier, scope))) { Sequence.fromIterable(Classifier__BehaviorDescriptor.methods_id4_LVZ3pBKCn.invoke(derivedClassifier)).where(new IWhereFilter<SNode>() { public boolean accept(SNode it) { return (boolean) BaseMethodDeclaration__BehaviorDescriptor.hasSameSignature_idhEwIB0z.invoke(instanceMethod, it); } }).visitAll(new IVisitor<SNode>() { public void visit(SNode it) { ListSequence.fromList(_results).addElement(it); } }); if (SNodeOperations.isInstanceOf(derivedClassifier, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfc367070a5L, "jetbrains.mps.baseLanguage.structure.EnumClass"))) { for (SNode enumConstant : ListSequence.fromList(SLinkOperations.getChildren(SNodeOperations.cast(derivedClassifier, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfc367070a5L, "jetbrains.mps.baseLanguage.structure.EnumClass")), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfc367070a5L, 0xfc367503acL, "enumConstant")))) { ListSequence.fromList(SLinkOperations.getChildren(enumConstant, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfc367388b3L, 0x6d60019ab157734L, "method"))).where(new IWhereFilter<SNode>() { public boolean accept(SNode it) { return (boolean) BaseMethodDeclaration__BehaviorDescriptor.hasSameSignature_idhEwIB0z.invoke(instanceMethod, it); } }).visitAll(new IVisitor<SNode>() { public void visit(SNode it) { ListSequence.fromList(_results).addElement(it); } }); } } } if (SNodeOperations.isInstanceOf(classifier, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfc367070a5L, "jetbrains.mps.baseLanguage.structure.EnumClass"))) { for (SNode enumConstant : ListSequence.fromList(SLinkOperations.getChildren(SNodeOperations.cast(classifier, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfc367070a5L, "jetbrains.mps.baseLanguage.structure.EnumClass")), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfc367070a5L, 0xfc367503acL, "enumConstant")))) { ListSequence.fromList(SLinkOperations.getChildren(enumConstant, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfc367388b3L, 0x6d60019ab157734L, "method"))).where(new IWhereFilter<SNode>() { public boolean accept(SNode it) { return (boolean) BaseMethodDeclaration__BehaviorDescriptor.hasSameSignature_idhEwIB0z.invoke(instanceMethod, it); } }).visitAll(new IVisitor<SNode>() { public void visit(SNode it) { ListSequence.fromList(_results).addElement(it); } }); } } } finally { monitor.done(); } } @Nullable @Override public SNodeReference getDeclarationNode() { return buildNodePointer(FindUsagesDescriptor.DECLARING_MODEL, "4151347580001021181"); } }