Beispiel #1
0
 public void collectRequired(Iterable<SModule> pool) {
   Set<SModuleReference> allRequired =
       SetSequence.fromSetWithValues(
           new HashSet<SModuleReference>(),
           Sequence.fromIterable(MapSequence.fromMap(allDeps).values())
               .translate(
                   new ITranslator2<ModulesCluster.ModuleDeps, SModuleReference>() {
                     public Iterable<SModuleReference> translate(ModulesCluster.ModuleDeps dep) {
                       return dep.required;
                     }
                   }));
   List<SModule> available = Sequence.fromIterable(pool).toListSequence();
   int atSize;
   do {
     atSize = MapSequence.fromMap(allDeps).count();
     for (Iterator<SModule> it = ListSequence.fromList(available).iterator(); it.hasNext(); ) {
       SModule mod = it.next();
       SModuleReference mr = mod.getModuleReference();
       if (SetSequence.fromSet(allRequired).contains(mr)) {
         primAdd(mod);
         SetSequence.fromSet(allRequired)
             .addSequence(ListSequence.fromList(MapSequence.fromMap(allDeps).get(mr).required));
         it.remove();
       }
     }
   } while (atSize < MapSequence.fromMap(allDeps).count());
 }
 public void doExecute(@NotNull final AnActionEvent event, final Map<String, Object> _params) {
   try {
     for (SModel model :
         Sequence.fromIterable(
             ((MPSProject) MapSequence.fromMap(_params).get("mpsProject")).getProjectModels())) {
       if (!(model instanceof RefactorableSModelDescriptor)) {
         continue;
       }
       if (SModelStereotype.isStubModelStereotype(SModelStereotype.getStereotype(model))) {
         continue;
       }
       UpdateRefactoringVersions_Action.this.updateModelVersion(
           (RefactorableSModelDescriptor) model, _params);
     }
     for (SModel model :
         Sequence.fromIterable(
             ((MPSProject) MapSequence.fromMap(_params).get("mpsProject")).getProjectModels())) {
       if (!(model instanceof EditableSModelDescriptor)) {
         continue;
       }
       if (SModelStereotype.isStubModelStereotype(SModelStereotype.getStereotype(model))) {
         continue;
       }
       UpdateRefactoringVersions_Action.this.updateImportVersions(
           (EditableSModelDescriptor) model, _params);
     }
     SModelRepository.getInstance().saveAll();
   } catch (Throwable t) {
     LOG.error("User's action execute method failed. Action:" + "UpdateRefactoringVersions", t);
   }
 }
Beispiel #3
0
 public Iterable<SNode> getAvailableElements(@Nullable String prefix) {
   List<SNode> result = new ArrayList<SNode>();
   ListSequence.fromList(result)
       .addSequence(
           Sequence.fromIterable(scope.getAvailableElements(prefix))
               .where(
                   new IWhereFilter<SNode>() {
                     public boolean accept(SNode it) {
                       return it.isInstanceOfConcept(kindConceptFqName);
                     }
                   }));
   ListSequence.fromList(result)
       .addSequence(
           Sequence.fromIterable(parentScope.getAvailableElements(prefix))
               .where(
                   new IWhereFilter<SNode>() {
                     public boolean accept(SNode it) {
                       return it.isInstanceOfConcept(kindConceptFqName);
                     }
                   })
               .where(
                   new IWhereFilter<SNode>() {
                     public boolean accept(SNode it) {
                       return !(it.isInstanceOfConcept(hidingRootConceptFqName))
                           || !(SetSequence.fromSet(names).contains(it.getName()));
                     }
                   }));
   return result;
 }
 private Iterable<SNode> getOperatorContainers() {
   Iterable<SNode> visibleContainers =
       ListSequence.fromList(
               SModelOperations.getRoots(
                   myModel,
                   "jetbrains.mps.baseLanguage.overloadedOperators.structure.ContainerImport"))
           .where(
               new IWhereFilter<SNode>() {
                 public boolean accept(SNode it) {
                   return (SLinkOperations.getTarget(it, "container", false) != null);
                 }
               })
           .select(
               new ISelector<SNode, SNode>() {
                 public SNode select(SNode it) {
                   return SLinkOperations.getTarget(it, "container", false);
                 }
               });
   if (Sequence.fromIterable(visibleContainers).isEmpty()) {
     visibleContainers =
         SModelOperations.getRootsIncludingImported(
             myModel,
             "jetbrains.mps.baseLanguage.overloadedOperators.structure.OverloadedOperatorContainer");
   }
   return Sequence.fromIterable(visibleContainers)
       .translate(
           new ITranslator2<SNode, SNode>() {
             public Iterable<SNode> translate(SNode it) {
               return SLinkOperations.getTargets(it, "operators", true);
             }
           });
 }
 public static Scope virtual_getProjectStructureScope_3734116213129936182(
     SNode thisNode, final SNode kind) {
   if (SConceptOperations.isSubConceptOf(
           kind, "jetbrains.mps.build.mps.structure.BuildMps_AbstractModule")
       || SConceptOperations.isSubConceptOf(
           kind, "jetbrains.mps.build.mps.structure.BuildMps_IdeaPlugin")
       || SConceptOperations.isSubConceptOf(
           kind, "jetbrains.mps.build.mps.structure.BuildMps_Group")) {
     return new CompositeScope(
         Sequence.fromIterable(
                 BuildProject_Behavior.call_getVisibleProjects_1224588814561807665(
                     BuildPlugin_Behavior.call_getProject_1224588814561866657(thisNode), false))
             .select(
                 new ISelector<SNode, DescendantsScope>() {
                   public DescendantsScope select(SNode it) {
                     return DescendantsScope.forNamedElements(
                         it,
                         SLinkOperations.findLinkDeclaration(
                             "jetbrains.mps.build.structure.BuildProject", "parts"),
                         kind);
                   }
                 })
             .concat(
                 Sequence.fromIterable(
                     Sequence.<DescendantsScope>singleton(
                         DescendantsScope.forNamedElements(
                             BuildPlugin_Behavior.call_getProject_1224588814561866657(thisNode),
                             SLinkOperations.findLinkDeclaration(
                                 "jetbrains.mps.build.structure.BuildProject", "parts"),
                             kind))))
             .toGenericArray(DescendantsScope.class));
   }
   return null;
 }
 public List<SNode> getFields() {
   List<SNode> result = new ArrayList<SNode>();
   ListSequence.fromList(result)
       .addSequence(Sequence.fromIterable(MapSequence.fromMap(myFieldsByName).values()));
   ListSequence.fromList(result)
       .addSequence(Sequence.fromIterable(MapSequence.fromMap(myStaticFieldsByName).values()));
   return result;
 }
 public static List<SNode> virtual_getOwnMethods_1906502351318572840(SNode thisNode) {
   List<SNode> baseMethodDeclarations = new ArrayList<SNode>();
   ListSequence.fromList(baseMethodDeclarations)
       .addSequence(
           Sequence.fromIterable(Classifier_Behavior.call_methods_5292274854859311639(thisNode)));
   ListSequence.fromList(baseMethodDeclarations)
       .addSequence(
           Sequence.fromIterable(
               ClassConcept_Behavior.call_staticMethods_5292274854859435867(thisNode)));
   return baseMethodDeclarations;
 }
Beispiel #8
0
 public MPSModulesClosure generationDependenciesClosure() {
   // direct and indirect dependencies of used languages and their runtimes; source languages of
   // generators involved
   for (SNode m : Sequence.fromIterable(initialModules)) {
     Iterable<SNode> usedLanguages = getUsedLanguages(m);
     collectDependencies(usedLanguages, false);
     collectAllUsedLanguageRuntimesAndTheirDeps(usedLanguages);
     modules.addAll(Sequence.fromIterable(usedLanguages).toListSequence());
     collectGeneratorsDependendencies(usedLanguages);
   }
   return this;
 }
 public void test_unspecifiedReferences() throws Exception {
   this.addNodeById("2906110183022219846");
   this.addNodeById("2906110183022219807");
   this.addNodeById("2906110183022219843");
   this.addNodeById("2906110183022354865");
   this.addNodeById("2906110183022432276");
   // Adding one unspecified reference and checking if it was added properly
   int initialSize =
       Sequence.fromIterable(
               SNodeOperations.getReferences(
                   SNodeOperations.cast(
                       this.getNodeById("2906110183022432277"),
                       "jetbrains.mps.lang.smodelTests.structure.ReferenceContainer")))
           .count();
   String unspecifiedReferenceName =
       this.addUnspecifiedReference(
           SNodeOperations.cast(
               this.getNodeById("2906110183022432277"),
               "jetbrains.mps.lang.smodelTests.structure.ReferenceContainer"),
           SNodeOperations.cast(
               this.getNodeById("2906110183022219849"),
               "jetbrains.mps.lang.smodelTests.structure.GrandChild"));
   Assert.assertEquals(
       initialSize + 1,
       Sequence.fromIterable(
               SNodeOperations.getReferences(
                   SNodeOperations.cast(
                       this.getNodeById("2906110183022432277"),
                       "jetbrains.mps.lang.smodelTests.structure.ReferenceContainer")))
           .count());
   // Checking if unspecified reference is working properly
   Iterable<SReference> unspecifiedReferences =
       Sequence.fromIterable(
               SNodeOperations.getReferences(
                   SNodeOperations.cast(
                       this.getNodeById("2906110183022432277"),
                       "jetbrains.mps.lang.smodelTests.structure.ReferenceContainer")))
           .where(
               new IWhereFilter<SReference>() {
                 public boolean accept(SReference it) {
                   return (SLinkOperations.findLinkDeclaration(it) == null);
                 }
               });
   Assert.assertEquals(1, Sequence.fromIterable(unspecifiedReferences).count());
   SReference theReference = Sequence.fromIterable(unspecifiedReferences).first();
   Assert.assertEquals(unspecifiedReferenceName, SLinkOperations.getRole(theReference));
   Assert.assertEquals(
       SNodeOperations.cast(
           this.getNodeById("2906110183022219849"),
           "jetbrains.mps.lang.smodelTests.structure.GrandChild"),
       SLinkOperations.getTargetNode(theReference));
 }
Beispiel #10
0
 private void collectDependencies(Iterable<SNode> sequence, boolean reexportOnly) {
   if (Sequence.fromIterable(sequence).isEmpty()) {
     return;
   }
   Set<SNode> dependencies = SetSequence.fromSet(new HashSet<SNode>());
   for (SNode module : Sequence.fromIterable(sequence)) {
     SetSequence.fromSet(dependencies)
         .addSequence(Sequence.fromIterable(getDependencies(module, reexportOnly)));
   }
   SetSequence.fromSet(dependencies).removeSequence(SetSequence.fromSet(modules));
   modules.addAll(dependencies);
   collectDependencies(dependencies, reexportOnly);
 }
Beispiel #11
0
 public MPSModulesClosure designtimeClosure() {
   // direct and indirect dependencies of the modules, languages used and their runtimes
   collectDependencies(initialModules, false);
   collectAllUsedLanguageRuntimesAndTheirDeps(initialModules);
   for (SNode m : Sequence.fromIterable(initialModules)) {
     Iterable<SNode> usedLanguages = getUsedLanguages(m);
     collectDependencies(usedLanguages, false);
     collectAllUsedLanguageRuntimesAndTheirDeps(usedLanguages);
     modules.addAll(Sequence.fromIterable(usedLanguages).toListSequence());
   }
   modules.removeAll(Sequence.fromIterable(initialModules).toListSequence());
   return this;
 }
 public void test_forSpecializedLink() throws Exception {
   this.addNodeById("2906110183022219846");
   this.addNodeById("2906110183022219807");
   this.addNodeById("2906110183022219843");
   this.addNodeById("2906110183022354865");
   this.addNodeById("2906110183022432276");
   TestUtilities.assertEquals(
       Sequence.fromArray(
           new SNode[] {
             SNodeOperations.cast(
                 this.getNodeById("2906110183022311236"),
                 "jetbrains.mps.lang.smodelTests.structure.ChildSubConcept")
           }),
       Sequence.fromIterable(
               SNodeOperations.getReferences(
                   SNodeOperations.cast(
                       this.getNodeById("2906110183022354866"),
                       "jetbrains.mps.lang.smodelTests.structure.ReferenceContainerSubConcept")))
           .where(
               new IWhereFilter<SReference>() {
                 public boolean accept(SReference it) {
                   return SLinkOperations.findLinkDeclaration(it)
                       == SLinkOperations.findLinkDeclaration(
                           "jetbrains.mps.lang.smodelTests.structure.ReferenceContainer",
                           "rightChild");
                 }
               })
           .select(
               new ISelector<SReference, SNode>() {
                 public SNode select(SReference it) {
                   return SLinkOperations.getTargetNode(it);
                 }
               }));
   Assert.assertTrue(
       Sequence.fromIterable(
               SNodeOperations.getReferences(
                   SNodeOperations.cast(
                       this.getNodeById("2906110183022354866"),
                       "jetbrains.mps.lang.smodelTests.structure.ReferenceContainerSubConcept")))
           .where(
               new IWhereFilter<SReference>() {
                 public boolean accept(SReference it) {
                   return SLinkOperations.findLinkDeclaration(it)
                       == SLinkOperations.findLinkDeclaration(
                           "jetbrains.mps.lang.smodelTests.structure.ReferenceContainerSubConcept",
                           "specializedRightChild");
                 }
               })
           .isEmpty());
 }
Beispiel #13
0
  public MPSModulesClosure runtimeDependencies() {
    // direct dependencies of used languages' runtime solutions
    if (Sequence.fromIterable(initialModules).count() != 1) {
      throw new IllegalStateException("cannot build runtime dependencies for several modules");
    }

    SNode initial = Sequence.fromIterable(initialModules).first();
    Set<SNode> langs = SetSequence.fromSet(new HashSet<SNode>());
    Set<SNode> solutions = SetSequence.fromSet(new HashSet<SNode>());
    fillUsedLanguageRuntimes(initial, langs, solutions);
    modules.addAll(solutions);
    languagesWithRuntime.addAll(langs);
    return this;
  }
Beispiel #14
0
 private void collectAllUsedLanguageRuntimesAndTheirDeps(Iterable<SNode> sequence) {
   if (Sequence.fromIterable(sequence).isEmpty()) {
     return;
   }
   Set<SNode> langs = SetSequence.fromSet(new HashSet<SNode>());
   Set<SNode> solutions = SetSequence.fromSet(new HashSet<SNode>());
   for (SNode module : Sequence.fromIterable(sequence)) {
     fillUsedLanguageRuntimes(module, langs, solutions);
   }
   SetSequence.fromSet(solutions).removeSequence(SetSequence.fromSet(modules));
   modules.addAll(solutions);
   languagesWithRuntime.addAll(langs);
   collectDependencies(((Iterable<SNode>) solutions), false);
   collectAllUsedLanguageRuntimesAndTheirDeps(((Iterable<SNode>) solutions));
 }
Beispiel #15
0
 private Iterable<String> getCommandsFromItem(Object item) {
   if (item == null) {
     return ListSequence.fromList(new ArrayList<String>());
   }
   if (item instanceof String) {
     if (isNotEmptyString(((String) item))) {
       return ProcessHandlerBuilder.splitCommandInParts((String) item);
     }
   } else if (item instanceof File) {
     String path = ((File) item).getAbsolutePath();
     if ((path != null && path.length() > 0)) {
       return Sequence.<String>singleton(path);
     }
   } else if (item instanceof CommandPart) {
     return ((CommandPart) item).getCommandList();
   } else if (item instanceof Iterable) {
     List<String> result = ListSequence.fromList(new ArrayList<String>());
     for (Object it : (Iterable) item) {
       ListSequence.fromList(result).addSequence(Sequence.fromIterable(getCommandsFromItem(it)));
     }
     return result;
   } else {
     if (LOG.isEnabledFor(Priority.ERROR)) {
       LOG.error("Unknown type of command part " + item);
     }
   }
   return ListSequence.fromList(new ArrayList<String>());
 }
Beispiel #16
0
 public static Object insertMacro_varValue_3961775458390375615(
     final TemplateQueryContext _context) {
   StringBuilder res = new StringBuilder();
   Set<String> used = new HashSet<String>();
   Iterable<SNode> dependencies =
       SLinkOperations.getTargets(_context.getNode(), "dependencies", true);
   for (SNode part : ((List<SNode>) _context.getVariable("var:taskParts"))) {
     dependencies =
         Sequence.fromIterable(dependencies)
             .concat(
                 ListSequence.fromList(
                     SLinkOperations.getTargets(part, "additionalDependencies", true)));
   }
   for (SNode dep : dependencies) {
     String d =
         SPropertyOperations.getString(SLinkOperations.getTarget(dep, "target", false), "name");
     if (used.add(d)) {
       if (res.length() > 0) {
         res.append(", ");
       }
       res.append(d);
     }
   }
   return res.toString();
 }
Beispiel #17
0
 public Map<SReference, SNode> classifyUsages(Iterable<SReference> usages) {
   Map<SReference, SNode> result = MapSequence.fromMap(new HashMap<SReference, SNode>());
   for (SReference ref : Sequence.fromIterable(usages)) {
     MapSequence.fromMap(result).put(ref, ref.getTargetNode());
   }
   return result;
 }
Beispiel #18
0
  public static Iterable<Element> children(Element container, String tagName) {
    if (container == null) {
      return Sequence.fromIterable(Collections.<Element>emptyList());
    }

    return (Iterable<Element>) ((List<Element>) container.getChildren(tagName));
  }
Beispiel #19
0
  public static boolean baseMappingRule_Condition_2379134940425784781(
      final IOperationContext operationContext, final BaseMappingRuleContext _context) {
    boolean methodHasDispatchModifier =
        SNodeOperations.isInstanceOf(
                SNodeOperations.getParent(_context.getNode()),
                "jetbrains.mps.baseLanguage.structure.MethodDeclaration")
            && ListSequence.fromList(
                    SLinkOperations.getTargets(
                        SNodeOperations.cast(
                            SNodeOperations.getParent(_context.getNode()),
                            "jetbrains.mps.baseLanguage.structure.MethodDeclaration"),
                        "modifiers",
                        true))
                .any(
                    new IWhereFilter<SNode>() {
                      public boolean accept(SNode it) {
                        return SNodeOperations.isInstanceOf(
                            it,
                            "jetbrains.mps.baseLanguage.doubleDispatch.structure.DispatchModifier");
                      }
                    });

    return methodHasDispatchModifier
        && Sequence.fromIterable(
                DispatchGenUtil.getMatchingMethods(
                    SNodeOperations.cast(
                        SNodeOperations.getParent(_context.getNode()),
                        "jetbrains.mps.baseLanguage.structure.MethodDeclaration")))
            .isNotEmpty();
  }
Beispiel #20
0
 protected Set<IModule> getInitialModules() {
   Set<IModule> result = SetSequence.fromSet(new HashSet<IModule>());
   SetSequence.fromSet(result).addElement(DiffTemporaryModule.this);
   SetSequence.fromSet(result)
       .addSequence(Sequence.fromIterable(GlobalScope.getInstance().getVisibleModules()));
   return result;
 }
 private static SReference getCheckingReference_id4IvydoGvimX(@NotNull SNode __thisNode__) {
   if (SLinkOperations.getTarget(
           __thisNode__,
           MetaAdapterFactory.getReferenceLink(
               0x8585453e6bfb4d80L,
               0x98deb16074f1d86cL,
               0x7181d929c720809L,
               0x4b9f88d62c795596L,
               "checkingReference"))
       == null) {
     return ((SNode) SNodeOperations.getParent(__thisNode__)).getReferences().iterator().next();
   }
   for (SReference reference :
       Sequence.fromIterable(
           SNodeOperations.getReferences(SNodeOperations.getParent(__thisNode__)))) {
     if (SLinkOperations.getTargetNode(reference)
         == SLinkOperations.getTarget(
             __thisNode__,
             MetaAdapterFactory.getReferenceLink(
                 0x8585453e6bfb4d80L,
                 0x98deb16074f1d86cL,
                 0x7181d929c720809L,
                 0x4b9f88d62c795596L,
                 "checkingReference"))) {
       return (jetbrains.mps.smodel.SReference) reference;
     }
   }
   return null;
 }
Beispiel #22
0
 @Override
 protected void doInit() {
   DependencyTree tree = (DependencyTree) getTree();
   for (DepPath c : Sequence.fromIterable(myCycles).distinct()) {
     Iterator<DepLink> itr = Sequence.fromIterable(c.elements()).iterator();
     // skip first path element, which is always the one from my getCapturedDependencies()
     itr.next();
     MPSTreeNode parent = this;
     while (itr.hasNext()) {
       DependencyTreeNode dtn = new DependencyTreeNode(tree.getProject(), itr.next());
       parent.add(dtn);
       parent = dtn;
     }
   }
   myInitialized = true;
 }
Beispiel #23
0
 public static SNode templateFragment_ContextNodeQuery_3618324829955828392(
     final TemplateFragmentContext _context) {
   SNode demoApp =
       SNodeOperations.cast(
           _context.getMainContextNode(),
           MetaAdapterFactory.getConcept(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0xf8c108ca66L,
               "jetbrains.mps.baseLanguage.structure.ClassConcept"));
   SNode method =
       Sequence.fromIterable(
               ClassConcept_BehaviorDescriptor.staticMethods_id4_LVZ3pCeXr.invoke(demoApp))
           .where(
               new IWhereFilter<SNode>() {
                 public boolean accept(SNode it) {
                   return SPropertyOperations.getString(
                           it,
                           MetaAdapterFactory.getProperty(
                               0xceab519525ea4f22L,
                               0x9b92103b95ca8c0cL,
                               0x110396eaaa4L,
                               0x110396ec041L,
                               "name"))
                       .equals("addContent");
                 }
               })
           .first();
   return SLinkOperations.getTarget(
       method,
       MetaAdapterFactory.getContainmentLink(
           0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b1fcL, 0xf8cc56b1ffL, "body"));
 }
 private Iterable<SNode> getFieldDeclarationsWithoutGetterOrSetter(
     final SNode classConcept, final Map<String, Object> _params) {
   final Project project =
       ((EditorContext) MapSequence.fromMap(_params).get("editorContext"))
           .getOperationContext()
           .getProject();
   return Sequence.fromIterable(
           BehaviorReflection.invokeNonVirtual(
               (Class<Iterable<SNode>>) ((Class) Object.class),
               classConcept,
               "jetbrains.mps.baseLanguage.structure.ClassConcept",
               "call_fields_5292274854859383272",
               new Object[] {}))
       .where(
           new IWhereFilter<SNode>() {
             public boolean accept(SNode field) {
               final String setterName =
                   GenerateGettersAndSettersUtil.getFieldSetterName(field, project);
               final String getterName =
                   GenerateGettersAndSettersUtil.getFieldGetterName(field, project);
               return !(Sequence.fromIterable(
                           BehaviorReflection.invokeNonVirtual(
                               (Class<Iterable<SNode>>) ((Class) Object.class),
                               classConcept,
                               "jetbrains.mps.baseLanguage.structure.Classifier",
                               "call_methods_5292274854859311639",
                               new Object[] {}))
                       .any(
                           new IWhereFilter<SNode>() {
                             public boolean accept(SNode method) {
                               return getterName.equals(
                                       SPropertyOperations.getString(method, "name"))
                                   && ListSequence.fromList(
                                           SLinkOperations.getTargets(method, "parameter", true))
                                       .isEmpty();
                             }
                           }))
                   && !(Sequence.fromIterable(
                           BehaviorReflection.invokeNonVirtual(
                               (Class<Iterable<SNode>>) ((Class) Object.class),
                               classConcept,
                               "jetbrains.mps.baseLanguage.structure.Classifier",
                               "call_methods_5292274854859311639",
                               new Object[] {}))
                       .any(
                           new IWhereFilter<SNode>() {
                             public boolean accept(SNode method) {
                               return setterName.equals(
                                       SPropertyOperations.getString(method, "name"))
                                   && (int)
                                           ListSequence.fromList(
                                                   SLinkOperations.getTargets(
                                                       method, "parameter", true))
                                               .count()
                                       == 1;
                             }
                           }));
             }
           });
 }
 /*package*/ static boolean isRerunnable_id1JWcQ2Vfe4u(@NotNull SNode __thisNode__) {
   SNode prop =
       Sequence.fromIterable(
               DSLClassMember__BehaviorDescriptor.find_id2gzehMfi1$l.invoke(
                   SNodeOperations.getNode(
                       "90746344-04fd-4286-97d5-b46ae6a81709/r:52a3d974-bd4f-4651-ba6e-a2de5e336d95(jetbrains.mps.lang.migration/jetbrains.mps.lang.migration.methods)",
                       "2016543223706274716"),
                   __thisNode__))
           .first();
   return prop != null
       && SPropertyOperations.getBoolean(
           SNodeOperations.cast(
               prop,
               MetaAdapterFactory.getConcept(
                   0xc7d5b9dda05f4be2L,
                   0xbc73f2e16994cc67L,
                   0x59e9926e84100ec3L,
                   "jetbrains.mps.baseLanguage.lightweightdsl.structure.BooleanPropertyInstance")),
           MetaAdapterFactory.getProperty(
               0xc7d5b9dda05f4be2L,
               0xbc73f2e16994cc67L,
               0x59e9926e84100ec3L,
               0x59e9926e84100ec4L,
               "value"));
 }
 public void test_roles() throws Exception {
   this.addNodeById("2906110183022219846");
   this.addNodeById("2906110183022219807");
   this.addNodeById("2906110183022219843");
   this.addNodeById("2906110183022354865");
   this.addNodeById("2906110183022432276");
   TestUtilities.assertEquals(
       Sequence.fromArray(
           new String[] {
             SPropertyOperations.getString(
                 SLinkOperations.findLinkDeclaration(
                     "jetbrains.mps.lang.smodelTests.structure.ReferenceContainer", "root"),
                 "role"),
             SPropertyOperations.getString(
                 SLinkOperations.findLinkDeclaration(
                     "jetbrains.mps.lang.smodelTests.structure.ReferenceContainer", "leftChild"),
                 "role"),
             SPropertyOperations.getString(
                 SLinkOperations.findLinkDeclaration(
                     "jetbrains.mps.lang.smodelTests.structure.ReferenceContainer",
                     "rightChild"),
                 "role")
           }),
       Sequence.fromIterable(
               SNodeOperations.getReferences(
                   SNodeOperations.cast(
                       this.getNodeById("2906110183022219844"),
                       "jetbrains.mps.lang.smodelTests.structure.ReferenceContainer")))
           .select(
               new ISelector<SReference, String>() {
                 public String select(SReference it) {
                   return SLinkOperations.getRole(it);
                 }
               }));
 }
Beispiel #27
0
 public static Iterable<SNode> getChildAttributes(SNode node, final SContainmentLink link) {
   return Sequence.fromIterable(
           SNodeOperations.ofConcept(
               SLinkOperations.getChildren(
                   node,
                   MetaAdapterFactory.getContainmentLink(
                       0xceab519525ea4f22L,
                       0x9b92103b95ca8c0cL,
                       0x10802efe25aL,
                       0x47bf8397520e5942L,
                       "smodelAttribute")),
               MetaAdapterFactory.getConcept(
                   0xceab519525ea4f22L,
                   0x9b92103b95ca8c0cL,
                   0x9d98713f247885aL,
                   "jetbrains.mps.lang.core.structure.ChildAttribute")))
       .where(
           new IWhereFilter<SNode>() {
             public boolean accept(SNode it) {
               return eq_b2vkxw_a0a0a0a0a0a0eb(
                   ((SContainmentLink)
                       BHReflection.invoke(
                           it,
                           SMethodTrimmedId.create(
                               "getLink",
                               MetaAdapterFactory.getConcept(
                                   0xceab519525ea4f22L,
                                   0x9b92103b95ca8c0cL,
                                   0x9d98713f247885aL,
                                   "jetbrains.mps.lang.core.structure.ChildAttribute"),
                               "BpxLfMirzf"))),
                   link);
             }
           });
 }
Beispiel #28
0
 public ListCommandPart(List<? extends Object> list, @Nullable String separator) {
   if ((separator == null || separator.length() == 0)) {
     addCommands(getCommands(list));
   } else {
     addCommands(IterableUtils.join(Sequence.fromIterable(getCommands(list)), separator));
   }
 }
Beispiel #29
0
 @Deprecated
 @ToRemove(version = 3.2)
 public static Iterable<SNode> getLinkAttributes(SNode node, final String linkRole) {
   return Sequence.fromIterable(
           SNodeOperations.ofConcept(
               SLinkOperations.getChildren(
                   node,
                   MetaAdapterFactory.getContainmentLink(
                       0xceab519525ea4f22L,
                       0x9b92103b95ca8c0cL,
                       0x10802efe25aL,
                       0x47bf8397520e5942L,
                       "smodelAttribute")),
               MetaAdapterFactory.getConcept(
                   0xceab519525ea4f22L,
                   0x9b92103b95ca8c0cL,
                   0x2eb1ad060897da51L,
                   "jetbrains.mps.lang.core.structure.LinkAttribute")))
       .where(
           new IWhereFilter<SNode>() {
             public boolean accept(SNode it) {
               return eq_b2vkxw_a0a0a0a0a0a0cb(getLink(it).getRoleName(), linkRole);
             }
           });
 }
 public void test_target() throws Exception {
   this.addNodeById("2906110183022219846");
   this.addNodeById("2906110183022219807");
   this.addNodeById("2906110183022219843");
   this.addNodeById("2906110183022354865");
   this.addNodeById("2906110183022432276");
   TestUtilities.assertEquals(
       Sequence.fromArray(
           new SNode[] {
             SNodeOperations.cast(
                 this.getNodeById("2906110183022219847"),
                 "jetbrains.mps.lang.smodelTests.structure.Root"),
             SNodeOperations.cast(
                 this.getNodeById("2906110183022219848"),
                 "jetbrains.mps.lang.smodelTests.structure.Child"),
             SNodeOperations.cast(
                 this.getNodeById("2906110183022311236"),
                 "jetbrains.mps.lang.smodelTests.structure.ChildSubConcept")
           }),
       Sequence.fromIterable(
               SNodeOperations.getReferences(
                   SNodeOperations.cast(
                       this.getNodeById("2906110183022219844"),
                       "jetbrains.mps.lang.smodelTests.structure.ReferenceContainer")))
           .select(
               new ISelector<SReference, SNode>() {
                 public SNode select(SReference it) {
                   return SLinkOperations.getTargetNode(it);
                 }
               }));
 }