Esempio n. 1
0
 public boolean check(
     SNode root, Set<AbstractConstraintsChecker> checkers, SRepository repository) {
   // returns whether state has been changed after check
   if (root == null) {
     return false;
   }
   invalidate();
   if (myCheckedRoot && SetSequence.fromSet(myInvalidNodes).isEmpty()) {
     return false;
   }
   Queue<SNode> nodesToCheck = QueueSequence.fromQueue(new LinkedList<SNode>());
   QueueSequence.fromQueue(nodesToCheck).addLastElement(root);
   while (QueueSequence.fromQueue(nodesToCheck).isNotEmpty()) {
     SNode node = QueueSequence.fromQueue(nodesToCheck).removeFirstElement();
     if (!(myCheckedRoot) || SetSequence.fromSet(myInvalidNodes).contains(node)) {
       try {
         myCurrentNode = node;
         addDependency(node);
         for (AbstractConstraintsChecker checker : checkers) {
           checker.checkNode(node, this, repository);
         }
       } finally {
         myCurrentNode = null;
       }
     }
     QueueSequence.fromQueue(nodesToCheck)
         .addSequence(ListSequence.fromList(SNodeOperations.getChildren(node)));
   }
   // traversed the whole root, should have been removed all invalid nodes
   SetSequence.fromSet(myInvalidNodes).clear();
   myCheckedRoot = true;
   myUpdateInspector = true;
   return true;
 }
Esempio n. 2
0
 public static boolean virtual_isDescendant_checkLoops_7165541881557222950(
     SNode thisNode, SNode nodeToCompare, Set<SNode> visited) {
   if (Classifier_Behavior.call_isSame_4855996797771684010(
       nodeToCompare,
       SNodeOperations.getNode(
           "f:java_stub#6354ebe7-c22a-4a0f-ac54-50b52ab9b065#java.lang(JDK/java.lang@java_stub)",
           "~Object"))) {
     return true;
   }
   if (SetSequence.fromSet(visited).contains(thisNode)) {
     if (LOG.isEnabledFor(Priority.ERROR)) {
       LOG.error(
           "circular hierarchy in class "
               + INamedConcept_Behavior.call_getFqName_1213877404258(thisNode));
     }
     return false;
   }
   if (Classifier_Behavior.call_isSame_4855996797771684010(thisNode, nodeToCompare)) {
     return true;
   }
   if (SLinkOperations.getTarget(thisNode, "superclass", true) == null) {
     return false;
   }
   SetSequence.fromSet(visited).addElement(thisNode);
   return BehaviorReflection.invokeVirtual(
       Boolean.TYPE,
       SLinkOperations.getTarget(
           SLinkOperations.getTarget(thisNode, "superclass", true), "classifier", false),
       "virtual_isDescendant_checkLoops_7165541881557222950",
       new Object[] {nodeToCompare, visited});
 }
Esempio n. 3
0
 public Set<IErrorReporter> getErrors() {
   Set<IErrorReporter> result = new HashSet<IErrorReporter>(1);
   for (Set<IErrorReporter> errorReporters : MapSequence.fromMap(myNodesToErrors).values()) {
     SetSequence.fromSet(result).addSequence(SetSequence.fromSet(errorReporters));
   }
   return result;
 }
Esempio n. 4
0
 private void collectReferenceConflicts() {
   Tuples._2<
           Map<Tuples._2<SNodeId, String>, SetReferenceChange>,
           Map<Tuples._2<SNodeId, String>, SetReferenceChange>>
       arranged;
   arranged =
       this.<Tuples._2<SNodeId, String>, SetReferenceChange>arrangeChanges(
           new _FunctionTypes._return_P1_E0<Tuples._2<SNodeId, String>, SetReferenceChange>() {
             public Tuples._2<SNodeId, String> invoke(SetReferenceChange src) {
               return MultiTuple.<SNodeId, String>from(src.getAffectedNodeId(), src.getRole());
             }
           },
           SetReferenceChange.class);
   for (Tuples._2<SNodeId, String> nodeName :
       SetSequence.fromSet(MapSequence.fromMap(arranged._0()).keySet())
           .intersect(SetSequence.fromSet(MapSequence.fromMap(arranged._1()).keySet()))) {
     SetReferenceChange mineChange = MapSequence.fromMap(arranged._0()).get(nodeName);
     SetReferenceChange repositoryChange = MapSequence.fromMap(arranged._1()).get(nodeName);
     if (EqualUtil.equals(mineChange.getTargetNodeId(), repositoryChange.getTargetNodeId())
         && EqualUtil.equals(
             mineChange.getTargetModelReference(), repositoryChange.getTargetModelReference())
         && EqualUtil.equals(mineChange.getResolveInfo(), repositoryChange.getResolveInfo())) {
       addSymmetric(mineChange, repositoryChange);
     } else {
       addPossibleConflict(mineChange, repositoryChange);
     }
   }
 }
Esempio n. 5
0
 private <K, C extends ModelChange> void collectSymmetricChanges(Map<K, C> mine, Map<K, C> repo) {
   for (K key :
       SetSequence.fromSet(MapSequence.fromMap(mine).keySet())
           .intersect(SetSequence.fromSet(MapSequence.fromMap(repo).keySet()))) {
     addSymmetric(MapSequence.fromMap(mine).get(key), MapSequence.fromMap(repo).get(key));
   }
 }
Esempio n. 6
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 List<SNode> getImplementedAndExtended(
     SNode classifier, Map<SNode, SNode> typeByTypeVar) {
   Set<SNode> set = SetSequence.fromSet(new LinkedHashSet<SNode>());
   ClassifierAndSuperClassifiersCache.ClassifiersDataSet.collectImplementedAndExtended(
       classifier, set, null, typeByTypeVar);
   List<SNode> result = new ArrayList<SNode>();
   ListSequence.fromList(result).addSequence(SetSequence.fromSet(set));
   SNode objectClass =
       SNodeOperations.getNode(
           "6354ebe7-c22a-4a0f-ac54-50b52ab9b065/java:java.lang(JDK/)", "~Object");
   if (objectClass != null && !(SetSequence.fromSet(set).contains(objectClass))) {
     int indexOfFirstInterface = 0;
     for (SNode classifierInResult : set) {
       if (SNodeOperations.isInstanceOf(
           classifierInResult,
           MetaAdapterFactory.getConcept(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0x101edd46144L,
               "jetbrains.mps.baseLanguage.structure.Interface"))) {
         break;
       }
       indexOfFirstInterface++;
     }
     if (indexOfFirstInterface == 0) {
       result.add(objectClass);
     } else {
       result.add(indexOfFirstInterface, objectClass);
     }
   }
   return result;
 }
 public void doDispose() {
   PluginId debuggerPlugin =
       PluginManager.getPluginByClassName("jetbrains.mps.debug.api.DebugInfoManager");
   if (debuggerPlugin == null) {
     return;
   }
   final DebugInfoManager manager = DebugInfoManager.getInstance();
   if (manager == null) {
     return;
   }
   manager.removeConceptBreakpointCreator("jetbrains.mps.baseLanguage.structure.Statement");
   manager.removeConceptBreakpointCreator("jetbrains.mps.baseLanguage.structure.FieldDeclaration");
   manager.removeConceptBreakpointCreator(
       "jetbrains.mps.baseLanguage.structure.StaticFieldDeclaration");
   SetSequence.fromSet(DebugInfoProvider_CustomApplicationPlugin.this.myCreators)
       .visitAll(
           new IVisitor<
               Tuples._2<
                   _FunctionTypes._return_P1_E0<? extends Boolean, ? super SNode>,
                   _FunctionTypes._return_P2_E0<
                       ? extends ILocationBreakpoint, ? super SNode, ? super Project>>>() {
             public void visit(
                 Tuples._2<
                         _FunctionTypes._return_P1_E0<? extends Boolean, ? super SNode>,
                         _FunctionTypes._return_P2_E0<
                             ? extends ILocationBreakpoint, ? super SNode, ? super Project>>
                     it) {
               manager.removeBreakpointCreator(it);
             }
           });
   SetSequence.fromSet(DebugInfoProvider_CustomApplicationPlugin.this.myCreators).clear();
 }
Esempio n. 9
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());
 }
Esempio n. 10
0
  private Set<SNode> removeDependencyFromMapping(@NotNull SNode dependency) {
    // removing dependency node from any mappings together with all checked nodes
    // denending on this dependency node

    // 1. Removing dependency -> nodes mapping for specified dependency
    Set<SNode> nodes = MapSequence.fromMap(myDependenciesToNodes).removeKey(dependency);

    if (nodes != null) {
      // 2. Removing node -> dependencies mappings for nodes from step 1.
      for (SNode node : nodes) {
        Set<SNode> nodeDependencies = MapSequence.fromMap(myNodesToDependecies).removeKey(node);
        if (nodeDependencies != null) {
          // 3. Cleaning "backward" dependency -> nodes maping for removed nodes
          for (SNode nodeDependency : nodeDependencies) {
            Set<SNode> errors = MapSequence.fromMap(myDependenciesToNodes).get(nodeDependency);
            if (errors != null) {
              SetSequence.fromSet(errors).removeElement(node);
              if (SetSequence.fromSet(errors).isEmpty()) {
                MapSequence.fromMap(myDependenciesToNodes).removeKey(nodeDependency);
              }
            }
          }
        }
      }
    }

    // returning a set of checked nodes removed from mapping
    return nodes;
  }
Esempio n. 11
0
 @Override
 public void onTestFailure(TestEvent event) {
   SetSequence.fromSet(myFailed).addElement(this.getNameFromEvent(event));
   if (!(SetSequence.fromSet(myFailExpected).contains(this.getNameFromEvent(event)))) {
     myMessages.append("Unexpected failure: ").append(this.getNameFromEvent(event)).append("\n");
   } else {
   }
 }
Esempio n. 12
0
  public LanguageEditorChecker() {
    SetSequence.fromSet(myRules).addElement(new ConstraintsChecker());
    SetSequence.fromSet(myRules).addElement(new RefScopeChecker());
    SetSequence.fromSet(myRules).addElement(new CardinalitiesChecker());
    SetSequence.fromSet(myRules).addElement(new TargetConceptChecker());

    SModelRepository.getInstance().addModelRepositoryListener(this.myRepositoryListener);
  }
Esempio n. 13
0
 @Override
 public void onTestFinish(TestEvent event) {
   if (!(SetSequence.fromSet(myFailed).contains(this.getNameFromEvent(event)))) {
     if (!(SetSequence.fromSet(mySuccessExpected).contains(this.getNameFromEvent(event)))) {
       myMessages.append("Unexpected success: ").append(this.getNameFromEvent(event)).append("\n");
     }
   }
 }
Esempio n. 14
0
 protected GraphLayout doLayoutCopy(LayoutInfo patchInfo) {
   Graph graph = patchInfo.getGraph();
   final Map<Node, Integer> components = ConnectivityComponents.getComponents(graph);
   int numComponents = 0;
   for (Node node : ListSequence.fromList(graph.getNodes())) {
     numComponents = Math.max(numComponents, MapSequence.fromMap(components).get(node));
   }
   numComponents++;
   List<LayoutInfoCopier> copiers =
       ListSequence.fromList(new ArrayList<LayoutInfoCopier>(numComponents));
   List<GraphLayout> subgraphLayouts =
       ListSequence.fromList(new ArrayList<GraphLayout>(numComponents));
   for (int num = 0; num < numComponents; num++) {
     LayoutInfoCopier copier = new LayoutInfoCopier(patchInfo);
     ListSequence.fromList(copiers).addElement(copier);
     final int curComponent = num;
     copier.copySubgraph(
         new Filter<INode>() {
           public boolean accept(INode node) {
             Node myNode = ((Node) node);
             return (Integer) MapSequence.fromMap(components).get(myNode) == curComponent;
           }
         });
     LayoutInfo subgraphInfo = copier.getLayoutInfoCopy();
     ListSequence.fromList(subgraphLayouts).addElement(doLayoutConnectedGraph(subgraphInfo));
   }
   List<Rectangle> subgraphLayoutRects =
       ListSequence.fromList(new ArrayList<Rectangle>(numComponents));
   for (GraphLayout layout : ListSequence.fromList(subgraphLayouts)) {
     ListSequence.fromList(subgraphLayoutRects).addElement(layout.getContainingRectangle());
   }
   List<Dimension> subgraphLayoutShifts = getSubgraphLayoutShifts(subgraphLayoutRects);
   GraphLayout graphLayout = GraphLayoutFactory.createGraphLayout(graph);
   for (int num = 0; num < numComponents; num++) {
     LayoutInfoCopier copier = ListSequence.fromList(copiers).getElement(num);
     GraphLayout layout = ListSequence.fromList(subgraphLayouts).getElement(num);
     Dimension shift = ListSequence.fromList(subgraphLayoutShifts).getElement(num);
     for (INode node : SetSequence.fromSet(copier.getCopiedNodes())) {
       Rectangle rect = layout.getNodeLayout(copier.getNodeCopy(node));
       rect.translate(shift.width, shift.height);
       graphLayout.setLayoutFor(node, rect);
     }
     for (IEdge edge : SetSequence.fromSet(copier.getCopiedEdges())) {
       List<Point> path = layout.getEdgeLayout(copier.getEdgeCopy(edge));
       for (Point point : ListSequence.fromList(path)) {
         point.translate(shift.width, shift.height);
       }
       graphLayout.setLayoutFor(edge, path);
       if (SetSequence.fromSet(patchInfo.getLabeledEdges()).contains(edge)) {
         Rectangle rect = layout.getLabelLayout(copier.getEdgeCopy(edge));
         rect.translate(shift.width, shift.height);
         graphLayout.setLabelLayout(edge, rect);
       }
     }
   }
   return graphLayout;
 }
Esempio n. 15
0
 private boolean checkOutputReferencies() {
   Set<SNode> computedOutputRefs = myRefactoring.getOutputReferences();
   for (SNode computedRef : SetSequence.fromSet(computedOutputRefs)) {
     if (!(SetSequence.fromSet(myOutputRefs).contains(computedRef))) {
       return false;
     }
   }
   return true;
 }
Esempio n. 16
0
 private void invalidate() {
   if (SetSequence.fromSet(myDependenciesToInvalidate).isEmpty()) {
     return;
   }
   for (SNode toInvalidate : myDependenciesToInvalidate) {
     invalidateDependency(toInvalidate);
   }
   SetSequence.fromSet(myDependenciesToInvalidate).clear();
 }
Esempio n. 17
0
 private void addModelListener(SModel modelDescriptor) {
   if (modelDescriptor == null) {
     return;
   }
   if (!(SetSequence.fromSet(myListenedModels).contains(modelDescriptor))) {
     ((SModelInternal) modelDescriptor).addModelListener(myModelListener);
     SetSequence.fromSet(myListenedModels).addElement(modelDescriptor);
   }
 }
Esempio n. 18
0
 public String addClassPathItem(String path) {
   if (SetSequence.fromSet(myClassPaths).contains(path)) {
     path = null;
   } else {
     SetSequence.fromSet(myClassPaths).addElement(path);
     myDescriptor.getAdditionalJavaStubPaths().add(path);
   }
   fireChanged();
   return path;
 }
Esempio n. 19
0
 private Set<ModelRoot> readModelRoots(Element array) {
   Set<ModelRoot> res = SetSequence.fromSet(new HashSet<ModelRoot>());
   for (Element o : XmlUtil.children(array, "ModelRoot")) {
     String path = getPath(o);
     if (path != null) {
       SetSequence.fromSet(res).addElement(new ModelRoot(path, null));
     }
   }
   return res;
 }
Esempio n. 20
0
 public void clear() {
   myCheckedRoot = false;
   SetSequence.fromSet(myDependenciesToInvalidate).clear();
   SetSequence.fromSet(myInvalidNodes).clear();
   myCurrentNode = null;
   MapSequence.fromMap(myDependenciesToNodes).clear();
   MapSequence.fromMap(myNodesToDependecies).clear();
   MapSequence.fromMap(myNodesToErrors).clear();
   removeModelListener();
 }
Esempio n. 21
0
 private void fillUsedLanguageRuntimes(
     SNode m, Set<SNode> runtimeLanguages, Set<SNode> runtimeSolutions) {
   for (SNode language : getUsedLanguages(m)) {
     boolean hasRuntime = false;
     for (SNode rdep :
         SLinkOperations.getChildren(
             language,
             MetaAdapterFactory.getContainmentLink(
                 0xcf935df46994e9cL,
                 0xa132fa109541cba3L,
                 0x2c446791464290f8L,
                 0x2c4467914643be24L,
                 "runtime"))) {
       if (!(SNodeOperations.isInstanceOf(
           rdep,
           MetaAdapterFactory.getConcept(
               0xcf935df46994e9cL,
               0xa132fa109541cba3L,
               0x2c4467914644b6e3L,
               "jetbrains.mps.build.mps.structure.BuildMps_ModuleSolutionRuntime")))) {
         hasRuntime = true;
         continue;
       }
       SNode runtimeSolution =
           SNodeOperations.as(
               toOriginal(
                   SLinkOperations.getTarget(
                       SNodeOperations.cast(
                           rdep,
                           MetaAdapterFactory.getConcept(
                               0xcf935df46994e9cL,
                               0xa132fa109541cba3L,
                               0x2c4467914644b6e3L,
                               "jetbrains.mps.build.mps.structure.BuildMps_ModuleSolutionRuntime")),
                       MetaAdapterFactory.getReferenceLink(
                           0xcf935df46994e9cL,
                           0xa132fa109541cba3L,
                           0x2c4467914644b6e3L,
                           0x2c4467914644b6e4L,
                           "solution"))),
               MetaAdapterFactory.getConcept(
                   0xcf935df46994e9cL,
                   0xa132fa109541cba3L,
                   0x2c446791464290f7L,
                   "jetbrains.mps.build.mps.structure.BuildMps_Solution"));
       if (runtimeSolution != null) {
         SetSequence.fromSet(runtimeSolutions).addElement(runtimeSolution);
       }
     }
     if (hasRuntime) {
       SetSequence.fromSet(runtimeLanguages).addElement(language);
     }
   }
 }
 public void applyRule(
     final SNode debuggerReference,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   if (SNodeOperations.isInstanceOf(
       SNodeOperations.getContainingRoot(debuggerReference),
       "jetbrains.mps.debugger.api.lang.structure.BreakpointCreator")) {
     Set<SNode> throwables = SetSequence.fromSet(new HashSet<SNode>());
     SetSequence.fromSet(throwables).addElement(_quotation_createNode_fpej4j_a0a1a0a1());
     RulesFunctions_BaseLanguage.check(typeCheckingContext, throwables, debuggerReference);
   }
 }
Esempio n. 23
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);
 }
Esempio n. 24
0
 private void processEvent(SModelChildEvent event) {
   SetSequence.fromSet(myDependenciesToInvalidate).addElement(event.getParent());
   if (event.isRemoved()) {
     SetSequence.fromSet(myDependenciesToInvalidate).addElement(event.getChild());
   }
   if (event.isAdded()) {
     SetSequence.fromSet(myInvalidNodes)
         .addSequence(
             ListSequence.fromList(
                 SNodeOperations.getNodeDescendants(
                     ((SNode) event.getChild()), null, false, new SAbstractConcept[] {})));
     SetSequence.fromSet(myInvalidNodes).addElement(event.getChild());
   }
 }
Esempio n. 25
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;
  }
Esempio n. 26
0
 private void mergeEdges() {
   Map<Edge, List<Edge>> merged = MapSequence.fromMap(new HashMap<Edge, List<Edge>>());
   Set<Edge> dummyEdges = SetSequence.fromSet(new HashSet<Edge>());
   for (Edge edge : SetSequence.fromSet(MapSequence.fromMap(mySplittedEdges).keySet())) {
     SetSequence.fromSet(dummyEdges)
         .addSequence(ListSequence.fromList(MapSequence.fromMap(mySplittedEdges).get(edge)));
   }
   for (Edge edge : SetSequence.fromSet(MapSequence.fromMap(mySplittedEdges).keySet())) {
     if (SetSequence.fromSet(dummyEdges).contains(edge)) {
       continue;
     }
     MapSequence.fromMap(merged).put(edge, mergeEdges(edge));
   }
   mySplittedEdges = merged;
 }
Esempio n. 27
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));
 }
Esempio n. 28
0
 @Nullable
 public SNode resolve(SNode contextNode, @NotNull String refText) {
   // todo: recheck this code
   return (SetSequence.fromSet(names).contains(refText)
       ? scope.resolve(contextNode, refText)
       : parentScope.resolve(contextNode, refText));
 }
Esempio n. 29
0
 public static <U> ISetSequence<U> fromSetWithValues(Set<U> set, Iterable<? extends U> it) {
   Set<U> tmp = set;
   if (Sequence.USE_NULL_SEQUENCE) {
     if (set == null && it == null) {
       return NullSetSequence.instance();
     } else if (set == null) {
       tmp = new HashSet<U>();
     } else if (it == null) {
       return SetSequence.fromSet(set);
     }
   }
   if (Sequence.IGNORE_NULL_VALUES) {
     for (U u : it) {
       if (u != null) {
         tmp.add(u);
       }
     }
   } else if (it instanceof Collection) {
     tmp.addAll((Collection<? extends U>) it);
   } else {
     for (U u : it) {
       tmp.add(u);
     }
   }
   if (tmp instanceof ISetSequence) {
     return (ISetSequence<U>) tmp;
   }
   return new SetSequence<U>(tmp);
 }
Esempio n. 30
0
 public boolean hasFailedTests() {
   for (final ITestNodeWrapper testCase :
       SetSequence.fromSet(MapSequence.fromMap(this.myState.getTestsMap()).keySet())) {
     if (testCase == null) {
       continue;
     }
     for (final ITestNodeWrapper method :
         ListSequence.fromList(MapSequence.fromMap(this.myState.getTestsMap()).get(testCase))) {
       final Wrappers._T<String> className = new Wrappers._T<String>();
       final Wrappers._T<String> methodName = new Wrappers._T<String>();
       ModelAccess.instance()
           .runReadAction(
               new Runnable() {
                 public void run() {
                   className.value = testCase.getFqName();
                   methodName.value = method.getName();
                 }
               });
       TestMethodTreeNode treeNode = this.myMap.get(className.value, methodName.value);
       if (method == null) {
         continue;
       }
       if (!(isPassed(treeNode))) {
         return true;
       }
     }
   }
   return false;
 }