Пример #1
0
  void dftaTransitions() {
    System.out.println("Building DFTA product transitions...");
    Iterator i = idx.sigma.iterator();
    FuncSymb f;
    LinkedHashSet<String> q0;
    ArrayList<ArrayList<LinkedHashSet<FTATransition>>> psi_tuple;
    ArrayList<LinkedHashSet<FTATransition>> deltatuple;
    ArrayList<LinkedHashSet<LinkedHashSet<String>>> lhs;
    int temp;

    while (i.hasNext()) {
      f = (FuncSymb) i.next();
      if (f.arity == 0) {
        q0 = rhsSet(idx.fIndex.get(f));
        if (!q0.isEmpty()) {
          deltad.add(new PTransition(f, q0));
        }
      } else {
        // psi_reinit(f);
        psi_tuple = new ArrayList<ArrayList<LinkedHashSet<FTATransition>>>();
        // Initialise delta-tuple and psi-tuple
        deltatuple = new ArrayList<LinkedHashSet<FTATransition>>();
        for (int j = 0; j < f.arity; j++) {
          psi_tuple.add(j, new ArrayList<LinkedHashSet<FTATransition>>(psi.get(f).get(j)));
          deltatuple.add(j, new LinkedHashSet<FTATransition>());
        }
        // check for don't care arguments for functions of arity > 1
        // remove such arguments from the psi-tuple
        if (f.arity > 1 && dontCare) {
          dontCareArgs(psi_tuple, f);
        }
        int prod = 1;
        for (int j = 0; j < f.arity; j++) {
          prod = prod * psi_tuple.get(j).size();
        }
        System.out.println("Computing transitions for " + f);
        // System.out.println("Product size "+f.toString()+" = "+prod);
        for (int j = 0; j < prod; j++) { // enumerate the delta-tuples
          temp = j;
          for (int k = 0; k < f.arity; k++) {
            deltatuple.set(k, psi_tuple.get(k).get(temp % psi_tuple.get(k).size()));
            temp = temp / psi_tuple.get(k).size();
          }

          q0 = rhsSet(intersect(deltatuple));

          if (!q0.isEmpty()) {
            lhs = new ArrayList<LinkedHashSet<LinkedHashSet<String>>>();
            for (int m = 0; m < f.arity; m++) {
              lhs.add(m, t_inverse_table.get(f).get(m).get(deltatuple.get(m)));
            }
            deltad.add(new PTransition(f, q0, lhs));
          }
        }
      }
    }
  }
Пример #2
0
  /**
   * Returns an array containing all installed providers that satisfy the specified* selection
   * criteria, or null if no such providers have been installed. The returned providers are ordered
   * according to their <a href= "#insertProviderAt(java.security.Provider, int)">preference
   * order</a>.
   *
   * <p>The selection criteria are represented by a map. Each map entry represents a selection
   * criterion. A provider is selected iff it satisfies all selection criteria. The key for any
   * entry in such a map must be in one of the following two formats:
   *
   * <ul>
   *   <li><i>&lt;crypto_service>.&lt;algorithm_or_type></i>
   *       <p>The cryptographic service name must not contain any dots.
   *       <p>The value associated with the key must be an empty string.
   *       <p>A provider satisfies this selection criterion iff the provider implements the
   *       specified algorithm or type for the specified cryptographic service.
   *   <li><i>&lt;crypto_service>.&lt;algorithm_or_type> &lt;attribute_name></i>
   *       <p>The cryptographic service name must not contain any dots. There must be one or more
   *       space charaters between the <i>&lt;algorithm_or_type></i> and the
   *       <i>&lt;attribute_name></i>.
   *       <p>The value associated with the key must be a non-empty string. A provider satisfies
   *       this selection criterion iff the provider implements the specified algorithm or type for
   *       the specified cryptographic service and its implementation meets the constraint expressed
   *       by the specified attribute name/value pair.
   * </ul>
   *
   * <p>See Appendix A in the <a href= "../../../guide/security/CryptoSpec.html#AppA"> Java
   * Cryptogaphy Architecture API Specification &amp; Reference </a> for information about standard
   * cryptographic service names, standard algorithm names and standard attribute names.
   *
   * @param filter the criteria for selecting providers. The filter is case-insensitive.
   * @return all the installed providers that satisfy the selection criteria, or null if no such
   *     providers have been installed.
   * @throws InvalidParameterException if the filter is not in the required format
   * @throws NullPointerException if filter is null
   * @see #getProviders(java.lang.String)
   */
  public static Provider[] getProviders(Map<String, String> filter) {
    // Get all installed providers first.
    // Then only return those providers who satisfy the selection criteria.
    Provider[] allProviders = Security.getProviders();
    Set keySet = filter.keySet();
    LinkedHashSet candidates = new LinkedHashSet(5);

    // Returns all installed providers
    // if the selection criteria is null.
    if ((keySet == null) || (allProviders == null)) {
      return allProviders;
    }

    boolean firstSearch = true;

    // For each selection criterion, remove providers
    // which don't satisfy the criterion from the candidate set.
    for (Iterator ite = keySet.iterator(); ite.hasNext(); ) {
      String key = (String) ite.next();
      String value = (String) filter.get(key);

      LinkedHashSet newCandidates = getAllQualifyingCandidates(key, value, allProviders);
      if (firstSearch) {
        candidates = newCandidates;
        firstSearch = false;
      }

      if ((newCandidates != null) && !newCandidates.isEmpty()) {
        // For each provider in the candidates set, if it
        // isn't in the newCandidate set, we should remove
        // it from the candidate set.
        for (Iterator cansIte = candidates.iterator(); cansIte.hasNext(); ) {
          Provider prov = (Provider) cansIte.next();
          if (!newCandidates.contains(prov)) {
            cansIte.remove();
          }
        }
      } else {
        candidates = null;
        break;
      }
    }

    if ((candidates == null) || (candidates.isEmpty())) return null;

    Object[] candidatesArray = candidates.toArray();
    Provider[] result = new Provider[candidatesArray.length];

    for (int i = 0; i < result.length; i++) {
      result[i] = (Provider) candidatesArray[i];
    }

    return result;
  }
Пример #3
0
  public void paintActions(Object actionTarget, PaintTarget paintTarget) throws PaintException {

    actionMapper = null;

    LinkedHashSet<Action> actions = getActionSet(actionTarget, viewer);

    /*
     * Must repaint whenever there are actions OR if all actions have been
     * removed but still exist on client side
     */
    if (!actions.isEmpty() || clientHasActions) {
      actionMapper = new KeyMapper<Action>();

      paintTarget.addVariable((VariableOwner) viewer, "action", "");
      paintTarget.startTag("actions");

      for (final Action a : actions) {
        paintTarget.startTag("action");
        final String akey = actionMapper.key(a);
        paintTarget.addAttribute("key", akey);
        if (a.getCaption() != null) {
          paintTarget.addAttribute("caption", a.getCaption());
        }
        if (a.getIcon() != null) {
          paintTarget.addAttribute("icon", a.getIcon());
        }
        if (a instanceof ShortcutAction) {
          final ShortcutAction sa = (ShortcutAction) a;
          paintTarget.addAttribute("kc", sa.getKeyCode());

          final int[] modifiers = sa.getModifiers();
          if (modifiers != null) {
            final String[] smodifiers = new String[modifiers.length];
            for (int i = 0; i < modifiers.length; i++) {
              smodifiers[i] = String.valueOf(modifiers[i]);
            }
            paintTarget.addAttribute("mk", smodifiers);
          }
        }
        paintTarget.endTag("action");
      }

      paintTarget.endTag("actions");
    }

    /*
     * Update flag for next repaint so we know if we need to paint empty
     * actions or not (must send actions is client had actions before and
     * all actions were removed).
     */
    clientHasActions = !actions.isEmpty();
  }
  private boolean tryToReloadApplication() {
    try {
      final Application app = ApplicationManager.getApplication();

      if (app.isDisposed()) return false;
      final HashSet<Pair<VirtualFile, StateStorage>> causes =
          new HashSet<Pair<VirtualFile, StateStorage>>(myChangedApplicationFiles);
      if (causes.isEmpty()) return true;

      final boolean[] reloadOk = {false};
      final LinkedHashSet<String> components = new LinkedHashSet<String>();

      ApplicationManager.getApplication()
          .runWriteAction(
              new Runnable() {
                @Override
                public void run() {
                  try {
                    reloadOk[0] =
                        ((ApplicationImpl) app).getStateStore().reload(causes, components);
                  } catch (StateStorageException e) {
                    Messages.showWarningDialog(
                        ProjectBundle.message("project.reload.failed", e.getMessage()),
                        ProjectBundle.message("project.reload.failed.title"));
                  } catch (IOException e) {
                    Messages.showWarningDialog(
                        ProjectBundle.message("project.reload.failed", e.getMessage()),
                        ProjectBundle.message("project.reload.failed.title"));
                  }
                }
              });

      if (!reloadOk[0] && !components.isEmpty()) {
        String message = "Application components were changed externally and cannot be reloaded:\n";
        for (String component : components) {
          message += component + "\n";
        }

        final boolean canRestart = ApplicationManager.getApplication().isRestartCapable();
        message += "Would you like to " + (canRestart ? "restart " : "shutdown ");
        message += ApplicationNamesInfo.getInstance().getProductName() + "?";

        if (Messages.showYesNoDialog(
                message, "Application Configuration Reload", Messages.getQuestionIcon())
            == Messages.YES) {
          for (Pair<VirtualFile, StateStorage> cause : causes) {
            StateStorage stateStorage = cause.getSecond();
            if (stateStorage instanceof XmlElementStorage) {
              ((XmlElementStorage) stateStorage).disableSaving();
            }
          }
          ApplicationManagerEx.getApplicationEx().restart(true);
        }
      }

      return reloadOk[0];
    } finally {
      myChangedApplicationFiles.clear();
    }
  }
Пример #5
0
    @Override
    protected void finish() {
      if (!errorMessages.isEmpty()) {
        JOptionPane.showMessageDialog(
            Main.parent, formatErrorMessages(), tr("Error"), JOptionPane.ERROR_MESSAGE);
      }
      if (layer != null) {
        Main.main.addLayer(layer);
        layer.hook_up_mouse_events(); // Main.map.mapView should exist
        // now. Can add mouse listener
        Main.map.mapView.addPropertyChangeListener(layer);
        if (Main.map.getToggleDialog(ImageViewerDialog.class) == null) {
          ImageViewerDialog.newInstance();
          Main.map.addToggleDialog(ImageViewerDialog.getInstance());
        }

        if (!cancelled && layer.data.size() > 0) {
          boolean noGeotagFound = true;
          for (ImageEntry e : layer.data) {
            if (e.getPos() != null) {
              noGeotagFound = false;
            }
          }
          if (noGeotagFound) {
            new CorrelateGpxWithImages(layer).actionPerformed(null);
          }
        }
      }
    }
Пример #6
0
  private static void logInitialLoadSequence(
      TreeLogger logger, LinkedHashSet<JRunAsync> initialLoadSequence) {
    if (!logger.isLoggable(TreeLogger.TRACE)) {
      return;
    }

    StringBuilder message = new StringBuilder();
    message.append("Initial load sequence of split points: ");
    if (initialLoadSequence.isEmpty()) {
      message.append("(none)");
    } else {
      Collection<Integer> runAsyncIds =
          Collections2.transform(
              initialLoadSequence,
              new Function<JRunAsync, Integer>() {
                @Override
                public Integer apply(JRunAsync runAsync) {
                  return runAsync.getRunAsyncId();
                }
              });
      message.append(Joiner.on(", ").join(runAsyncIds));
    }

    logger.log(TreeLogger.TRACE, message.toString());
  }
Пример #7
0
    private synchronized TaskAttemptId getAndRemove(int volumeId) {
      TaskAttemptId taskAttemptId = null;
      if (!unassignedTaskForEachVolume.containsKey(volumeId)) {
        if (volumeId > REMOTE) {
          diskVolumeLoads.remove(volumeId);
        }
        return taskAttemptId;
      }

      LinkedHashSet<TaskAttempt> list = unassignedTaskForEachVolume.get(volumeId);
      if (list != null && !list.isEmpty()) {
        TaskAttempt taskAttempt;
        synchronized (unassignedTaskForEachVolume) {
          Iterator<TaskAttempt> iterator = list.iterator();
          taskAttempt = iterator.next();
          iterator.remove();
        }

        taskAttemptId = taskAttempt.getId();
        for (DataLocation location : taskAttempt.getTask().getDataLocations()) {
          HostVolumeMapping volumeMapping =
              scheduledRequests.leafTaskHostMapping.get(location.getHost());
          if (volumeMapping != null) {
            volumeMapping.removeTaskAttempt(location.getVolumeId(), taskAttempt);
          }
        }

        increaseConcurrency(volumeId);
      }

      return taskAttemptId;
    }
Пример #8
0
 LinkedHashSet<LinkedHashSet<FTATransition>> intersectCartProd(
     ArrayList<ArrayList<LinkedHashSet<FTATransition>>> psi_phi_tuple, int k) {
   LinkedHashSet<LinkedHashSet<FTATransition>> result =
       new LinkedHashSet<LinkedHashSet<FTATransition>>();
   LinkedHashSet<FTATransition> t;
   if (k == psi_phi_tuple.size() - 1) {
     for (int i = 0; i < psi_phi_tuple.get(k).size(); i++) {
       result.add((LinkedHashSet<FTATransition>) (psi_phi_tuple.get(k).get(i)).clone());
     }
     return result;
   } else {
     LinkedHashSet<LinkedHashSet<FTATransition>> r = intersectCartProd(psi_phi_tuple, k + 1);
     Iterator i = r.iterator();
     while (i.hasNext()) {
       t = (LinkedHashSet<FTATransition>) i.next();
       for (int j = 0; j < psi_phi_tuple.get(k).size(); j++) {
         LinkedHashSet<FTATransition> u = (LinkedHashSet<FTATransition>) t.clone();
         u.retainAll(psi_phi_tuple.get(k).get(j));
         if (!u.isEmpty()) {
           result.add(u);
         }
       }
     }
   }
   return result;
 }
  private static List<XmlElementDescriptor> computeRequiredSubTags(XmlElementsGroup group) {

    if (group.getMinOccurs() < 1) return Collections.emptyList();
    switch (group.getGroupType()) {
      case LEAF:
        XmlElementDescriptor descriptor = group.getLeafDescriptor();
        return descriptor == null
            ? Collections.<XmlElementDescriptor>emptyList()
            : Collections.singletonList(descriptor);
      case CHOICE:
        LinkedHashSet<XmlElementDescriptor> set = null;
        for (XmlElementsGroup subGroup : group.getSubGroups()) {
          List<XmlElementDescriptor> descriptors = computeRequiredSubTags(subGroup);
          if (set == null) {
            set = new LinkedHashSet<XmlElementDescriptor>(descriptors);
          } else {
            set.retainAll(descriptors);
          }
        }
        if (set == null || set.isEmpty()) {
          return Collections.singletonList(null); // placeholder for smart completion
        }
        return new ArrayList<XmlElementDescriptor>(set);

      default:
        ArrayList<XmlElementDescriptor> list = new ArrayList<XmlElementDescriptor>();
        for (XmlElementsGroup subGroup : group.getSubGroups()) {
          list.addAll(computeRequiredSubTags(subGroup));
        }
        return list;
    }
  }
 /**
  * Removes the
  *
  * @param spacePart
  * @param spaceRootFOUri
  */
 private void removeSpaceRootUri(DataSpacesURI spacePart, String spaceRootFOUri) {
   LinkedHashSet<String> allRootUris = accessibleFileObjectUris.get(spacePart);
   allRootUris.remove(spaceRootFOUri);
   if (allRootUris.isEmpty()) {
     accessibleFileObjectUris.remove(spacePart);
   } else {
     accessibleFileObjectUris.put(spacePart, allRootUris);
   }
 }
Пример #11
0
  @SuppressWarnings("unchecked")
  private Collection<Artifact> getNonTransitivePlugins(Set<Artifact> projectArtifacts)
      throws MojoExecutionException {
    Collection<Artifact> deps = new LinkedHashSet<Artifact>();

    for (Artifact artifact : projectArtifacts) {
      Artifact pomArtifact =
          artifactFactory.createArtifact(
              artifact.getGroupId(),
              artifact.getArtifactId(),
              artifact.getVersion(),
              artifact.getClassifier(),
              "pom");
      Set<Artifact> result;
      try {
        MavenProject pomProject =
            mavenProjectBuilder.buildFromRepository(
                pomArtifact, remoteRepositories, localRepository);

        Set<Artifact> artifacts = pomProject.createArtifacts(artifactFactory, null, null);
        artifacts = filterOutSystemDependencies(artifacts);
        ArtifactResolutionResult arr =
            resolver.resolveTransitively(
                artifacts,
                pomArtifact,
                localRepository,
                remoteRepositories,
                artifactMetadataSource,
                null);
        result = arr.getArtifacts();
      } catch (Exception e) {
        throw new MojoExecutionException(
            "Failed to resolve non-transitive deps " + e.getMessage(), e);
      }

      LinkedHashSet<Artifact> plugins = new LinkedHashSet<Artifact>();
      plugins.addAll(filtterArtifacts(result, getFilters(null, null, "nexus-plugin", null)));
      plugins.addAll(filtterArtifacts(result, getFilters(null, null, "zip", "bundle")));

      plugins.addAll(getNonTransitivePlugins(plugins));

      if (!plugins.isEmpty()) {
        getLog()
            .debug(
                "Adding non-transitive dependencies for: "
                    + artifact
                    + " -\n"
                    + plugins.toString().replace(',', '\n'));
      }

      deps.addAll(plugins);
    }

    return deps;
  }
Пример #12
0
  private void compare(
      String name,
      LombokTestSource expected,
      String actualFile,
      LinkedHashSet<CompilerMessage> actualMessages,
      boolean printErrors,
      boolean skipCompareContent)
      throws Throwable {
    if (!skipCompareContent)
      try {
        compareContent(name, expected.getContent(), actualFile);
      } catch (Throwable e) {
        if (printErrors) {
          System.out.println("***** " + name + " *****");
          System.out.println(e.getMessage());
          System.out.println("**** Expected ******");
          System.out.println(expected.getContent());
          System.out.println("****  Actual  ******");
          System.out.println(actualFile);
          if (actualMessages != null && !actualMessages.isEmpty()) {
            System.out.println("**** Actual Errors *****");
            for (CompilerMessage actualMessage : actualMessages) {
              System.out.println(actualMessage);
            }
          }
          System.out.println("*******************");
        }
        if (dumpActualFilesHere != null) {
          dumpToFile(new File(dumpActualFilesHere, name), actualFile);
        }
        throw e;
      }

    try {
      compareMessages(name, expected.getMessages(), actualMessages);
    } catch (Throwable e) {
      if (printErrors) {
        System.out.println("***** " + name + " *****");
        System.out.println(e.getMessage());
        System.out.println("**** Expected ******");
        for (CompilerMessageMatcher expectedMessage : expected.getMessages()) {
          System.out.println(expectedMessage);
        }
        System.out.println("****  Actual  ******");
        for (CompilerMessage actualMessage : actualMessages) {
          System.out.println(actualMessage);
        }
        System.out.println("*******************");
      }
      if (dumpActualFilesHere != null) {
        dumpToFile(new File(dumpActualFilesHere, name + ".messages"), actualMessages);
      }
      throw e;
    }
  }
  @SuppressWarnings("unchecked")
  public void resetElements(
      T[] elements,
      final @Nullable Comparator<T> sortComparator,
      final boolean restoreSelectedElements) {
    final List<T> selectedElements =
        restoreSelectedElements && mySelectedElements != null
            ? new ArrayList<T>(mySelectedElements)
            : null;
    myElements = elements;
    if (sortComparator != null) {
      myComparator = new ElementNodeComparatorWrapper(sortComparator);
    }
    mySelectedNodes.clear();
    myNodeToParentMap.clear();
    myElementToNodeMap.clear();
    myContainerNodes.clear();

    ApplicationManager.getApplication()
        .runReadAction(
            new Runnable() {
              @Override
              public void run() {
                myTreeModel = buildModel();
              }
            });

    myTree.setModel(myTreeModel);
    myTree.setRootVisible(false);

    restoreTree();

    if (myOptionControls == null) {
      myCopyJavadocCheckbox = new NonFocusableCheckBox(IdeBundle.message("checkbox.copy.javadoc"));
      if (myIsInsertOverrideVisible) {
        myInsertOverrideAnnotationCheckbox =
            new NonFocusableCheckBox(IdeBundle.message("checkbox.insert.at.override"));
        myOptionControls =
            new JCheckBox[] {myCopyJavadocCheckbox, myInsertOverrideAnnotationCheckbox};
      } else {
        myOptionControls = new JCheckBox[] {myCopyJavadocCheckbox};
      }
    }

    myTree.doLayout();
    setOKActionEnabled(myElements != null && myElements.length > 0);

    if (selectedElements != null) {
      selectElements(selectedElements.toArray(new ClassMember[selectedElements.size()]));
    }
    if (mySelectedElements == null || mySelectedElements.isEmpty()) {
      expandFirst();
    }
  }
Пример #14
0
  // This may not catch 100% of packets, but should get most of them, a small number may end up
  // being compressed by main thread
  @SuppressWarnings("unchecked")
  public void manageChunkQueue(boolean flag1) {
    List<ChunkCoordIntPair> playerChunkQueue = player.chunkCoordIntPairQueue;

    try {
      if (!playerChunkQueue.isEmpty()) {
        chunkUpdateQueue.addAll(playerChunkQueue);
        playerChunkQueue.clear();
      }
    } catch (ConcurrentModificationException e) {
      // seems to be called from a separate thread during teleports (rogue plugins?)
    }

    int chunkCompressionThreadSize = ChunkCompressionThread.getPlayerQueueSize(this.player);
    if (!chunkUpdateQueue.isEmpty()
        && (lowPriorityCount()
                + chunkCompressionThreadSize
                + MapChunkThread.getQueueLength(this.player))
            < 4) {
      ChunkCoordIntPair playerChunk = getPlayerChunk();
      Iterator<ChunkCoordIntPair> i = chunkUpdateQueue.iterator();
      ChunkCoordIntPair first = i.next();
      while (first != null && !activeChunks.contains(first)) {
        i.remove();
        if (i.hasNext()) {
          first = i.next();
        } else {
          first = null;
        }
      }
      if (first != null) {
        if (updateCounter.get() > 0) {
          int cx = playerChunk.x;
          int cz = playerChunk.z;
          boolean chunkFound = false;
          for (int c = 0; c < spiralx.length; c++) {
            ChunkCoordIntPair testChunk = new ChunkCoordIntPair(spiralx[c] + cx, spiralz[c] + cz);
            if (chunkUpdateQueue.contains(testChunk)) {
              first = testChunk;
              chunkFound = true;
              break;
            }
          }
          if (!chunkFound) {
            updateCounter.decrementAndGet();
          }
        }
        chunkUpdateQueue.remove(first);
        MapChunkThread.sendPacketMapChunk(first, this.player, this.player.world);
        sendChunkTiles(first.x, first.z, player);
      }
    }
  }
Пример #15
0
 int getPartialHashCode(boolean unknowns, boolean varStates) {
   int hash =
       (getNonTrivialEqClasses().hashCode() * 31 + getDistinctClassPairs().hashCode()) * 31
           + myStack.hashCode();
   if (varStates) {
     hash = hash * 31 + myVariableStates.hashCode();
   }
   if (unknowns && !myUnknownVariables.isEmpty()) {
     hash = hash * 31 + myUnknownVariables.hashCode();
   }
   return hash;
 }
 @Override
 public void calcData(final DataKey key, final DataSink sink) {
   if (key.equals(LangDataKeys.PSI_ELEMENT)) {
     if (mySelectedElements != null && !mySelectedElements.isEmpty()) {
       T selectedElement = mySelectedElements.iterator().next();
       if (selectedElement instanceof ClassMemberWithElement) {
         sink.put(
             LangDataKeys.PSI_ELEMENT, ((ClassMemberWithElement) selectedElement).getElement());
       }
     }
   }
 }
Пример #17
0
 public void forget(ConceptInstanceMap other) {
   for (String cn : other.myNodes.keySet()) {
     assert myNodes.containsKey(cn); // other shall be subset of this map
     List<SNode> nodes = myNodes.get(cn);
     LinkedHashSet<SNode> newNodes = new LinkedHashSet<SNode>(nodes);
     newNodes.removeAll(other.myNodes.get(cn));
     if (newNodes.isEmpty()) {
       myNodes.remove(cn);
     } else {
       myNodes.put(cn, new ArrayList<SNode>(newNodes));
     }
   }
 }
Пример #18
0
  public static void notifyUnknownMacros(
      @NotNull TrackingPathMacroSubstitutor substitutor,
      @NotNull final Project project,
      @Nullable final String componentName) {
    final LinkedHashSet<String> macros =
        new LinkedHashSet<String>(substitutor.getUnknownMacros(componentName));
    if (macros.isEmpty()) {
      return;
    }

    UIUtil.invokeLaterIfNeeded(
        new Runnable() {
          @Override
          public void run() {
            macros.removeAll(getMacrosFromExistingNotifications(project));

            if (!macros.isEmpty()) {
              LOG.debug(
                  "Reporting unknown path macros " + macros + " in component " + componentName);
              String format = "<p><i>%s</i> %s undefined. <a href=\"define\">Fix it</a></p>";
              String productName = ApplicationNamesInfo.getInstance().getProductName();
              String content =
                  String.format(
                          format, StringUtil.join(macros, ", "), macros.size() == 1 ? "is" : "are")
                      + "<br>Path variables are used to substitute absolute paths "
                      + "in "
                      + productName
                      + " project files "
                      + "and allow project file sharing in version control systems.<br>"
                      + "Some of the files describing the current project settings contain unknown path variables "
                      + "and "
                      + productName
                      + " cannot restore those paths.";
              new UnknownMacroNotification(
                      "Load Error",
                      "Load error: undefined path variables",
                      content,
                      NotificationType.ERROR,
                      new NotificationListener() {
                        @Override
                        public void hyperlinkUpdate(
                            @NotNull Notification notification, @NotNull HyperlinkEvent event) {
                          ((ProjectEx) project).checkUnknownMacros(true);
                        }
                      },
                      macros)
                  .notify(project);
            }
          }
        });
  }
Пример #19
0
    private synchronized void removeTaskAttempt(int volumeId, TaskAttempt taskAttempt) {
      if (!unassignedTaskForEachVolume.containsKey(volumeId)) return;

      LinkedHashSet<TaskAttempt> tasks = unassignedTaskForEachVolume.get(volumeId);
      if (tasks.remove(taskAttempt)) {
        remainTasksNum.getAndDecrement();
      }

      if (tasks.isEmpty()) {
        unassignedTaskForEachVolume.remove(volumeId);
        if (volumeId > REMOTE) {
          diskVolumeLoads.remove(volumeId);
        }
      }
    }
Пример #20
0
 LinkedHashSet<LinkedHashSet<FTATransition>> t(
     int i, FuncSymb f, LinkedHashSet<LinkedHashSet<String>> qss) {
   Iterator k = qss.iterator();
   LinkedHashSet<LinkedHashSet<FTATransition>> result =
       new LinkedHashSet<LinkedHashSet<FTATransition>>();
   LinkedHashSet<String> qs;
   LinkedHashSet<FTATransition> h;
   while (k.hasNext()) {
     qs = (LinkedHashSet<String>) k.next();
     h = lhsSet(i, f, qs);
     if (!h.isEmpty()) {
       result.add(h);
     }
   }
   return result;
 }
  public void moveFieldInitializations() throws IncorrectOperationException {
    LOG.assertTrue(myMembersAfterMove != null);

    final LinkedHashSet<PsiField> movedFields = new LinkedHashSet<>();
    for (PsiMember member : myMembersAfterMove) {
      if (member instanceof PsiField) {
        movedFields.add((PsiField) member);
      }
    }

    if (movedFields.isEmpty()) return;

    PullUpHelper<MemberInfo> processor = getProcessor(myTargetSuperClass);
    LOG.assertTrue(processor != null, myTargetSuperClass);
    processor.moveFieldInitializations(movedFields);
  }
 /** {@inheritDoc} */
 public void okClicked() {
   // Check that at least one checkbox is selected.
   selectedAttributes.clear();
   int i = 0;
   for (T attribute : monitoringAttributes) {
     if (checkboxes[i].isSelected()) {
       selectedAttributes.add(attribute);
     }
     i++;
   }
   if (selectedAttributes.isEmpty()) {
     super.displayErrorDialog(newArrayList(INFO_CTRL_PANEL_NO_OPERATION_SELECTED.get()));
   } else {
     isCanceled = false;
     super.closeClicked();
   }
 }
Пример #23
0
 ArrayList<LinkedHashSet<FTATransition>> pruneSets(
     LinkedHashSet<LinkedHashSet<FTATransition>> psi_f_k, LinkedHashSet<FTATransition> newtrs) {
   ArrayList<LinkedHashSet<FTATransition>> result = new ArrayList<LinkedHashSet<FTATransition>>();
   LinkedHashSet<FTATransition> set1, set2;
   Iterator i = psi_f_k.iterator();
   int y = newtrs.size();
   System.out.print("Before " + psi_f_k.size() + " --- ");
   while (i.hasNext()) {
     set1 = (LinkedHashSet<FTATransition>) i.next();
     set2 = new LinkedHashSet<FTATransition>(newtrs);
     set2.retainAll(set1);
     // System.out.print(set1.size()+"."+set2.size()+": ");
     if (!set2.isEmpty()) {
       result.add(set2);
     }
   }
   System.out.println("After " + result.size());
   return result;
 }
Пример #24
0
  @SuppressWarnings("HardCodedStringLiteral")
  public String toString() {
    StringBuilder result = new StringBuilder();
    result.append('<');
    if (myEphemeral) {
      result.append("ephemeral, ");
    }

    for (EqClass set : getNonTrivialEqClasses()) {
      result.append(set);
    }

    if (!myDistinctClasses.isEmpty()) {
      result.append("\n  distincts: ");
      List<String> distincts = new ArrayList<>();
      for (UnorderedPair<EqClass> pair : getDistinctClassPairs()) {
        distincts.add("{" + pair.first + ", " + pair.second + "}");
      }
      Collections.sort(distincts);
      result.append(StringUtil.join(distincts, " "));
    }

    if (!myStack.isEmpty()) {
      result.append("\n  stack: ").append(StringUtil.join(myStack, ","));
    }
    if (!myVariableStates.isEmpty()) {
      result.append("\n  vars: ");
      for (Map.Entry<DfaVariableValue, DfaVariableState> entry : myVariableStates.entrySet()) {
        result
            .append("[")
            .append(entry.getKey())
            .append("->")
            .append(entry.getValue())
            .append("] ");
      }
    }
    if (!myUnknownVariables.isEmpty()) {
      result.append("\n  unknowns: ").append(new HashSet<>(myUnknownVariables));
    }
    result.append('>');
    return result.toString();
  }
  private void setAliases(final AbstractBuild<?, ?> build, final BuildListener listener)
      throws IOException, InterruptedException {

    final LinkedHashSet<String> aliases = aliases(build, listener);

    if (aliases.isEmpty()) {

      printToConsole(listener, "no build aliases set");
      return;
    } else {

      printToConsole(listener, "setting build aliases " + aliases.toString());
    }

    final AbstractProject<?, ?> project = build.getProject();

    getStorage(project).addAliases(build, aliases);

    project.save();
  }
Пример #26
0
  /** {@inheritDoc} */
  @Override()
  public void toString(StringBuilder buffer) {
    buffer.append("DynamicGroup(dn=");
    buffer.append(groupEntryDN);
    buffer.append(",urls={");

    if (!memberURLs.isEmpty()) {
      Iterator<LDAPURL> iterator = memberURLs.iterator();
      buffer.append("\"");
      iterator.next().toString(buffer, false);

      while (iterator.hasNext()) {
        buffer.append("\", ");
        iterator.next().toString(buffer, false);
      }

      buffer.append("\"");
    }

    buffer.append("})");
  }
    public final void createAndSubmitWorkpackage() {
      markAsProcessed();

      if (models.isEmpty() && !isEnqueueWorkpackageWhenNoModelsEnqueued()) {
        return;
      }

      final IWorkPackageBlockBuilder blockBuilder =
          Services.get(IWorkPackageQueueFactory.class)
              .getQueueForEnqueuing(ctx, workpackageProcessorClass)
              .newBlock()
              .setContext(ctx);

      if (isCreateOneWorkpackagePerModel()) {
        for (final Object model : models) {
          createAndSubmitWorkpackage(blockBuilder, ImmutableList.of(model));
        }
      } else {
        createAndSubmitWorkpackage(blockBuilder, models);
      }
    }
Пример #28
0
  /**
   * Parses queryParams and produces sparseFields map.
   *
   * @param queryParams The request query parameters
   * @return Parsed sparseFields map
   */
  private static Map<String, Set<String>> parseSparseFields(
      MultivaluedMap<String, String> queryParams) {
    Map<String, Set<String>> result = new HashMap<>();

    for (Map.Entry<String, List<String>> kv : queryParams.entrySet()) {
      String key = kv.getKey();
      if (key.startsWith("fields[") && key.endsWith("]")) {
        String type = key.substring(7, key.length() - 1);

        LinkedHashSet<String> filters = new LinkedHashSet<>();
        for (String filterParams : kv.getValue()) {
          Collections.addAll(filters, filterParams.split(","));
        }

        if (!filters.isEmpty()) {
          result.put(type, filters);
        }
      }
    }

    return result;
  }
Пример #29
0
 LinkedHashSet<FTATransition> lhsSet(int i, FuncSymb f, LinkedHashSet<String> qs) {
   Iterator k = qs.iterator();
   LinkedHashSet<FTATransition> result = new LinkedHashSet<FTATransition>();
   LinkedHashMap<String, LinkedHashSet<FTATransition>> lhsmap = idx.lhsf.get(f).get(i);
   String q;
   while (k.hasNext()) {
     q = (String) k.next();
     if (lhsmap.containsKey(q)) {
       result.addAll(lhsmap.get(q));
     }
   }
   // Tabulate result for the t_inverse function
   if (!result.isEmpty()) {
     LinkedHashMap<LinkedHashSet<FTATransition>, LinkedHashSet<LinkedHashSet<String>>> hm =
         t_inverse_table.get(f).get(i);
     if (!hm.containsKey(result)) {
       hm.put(result, new LinkedHashSet<LinkedHashSet<String>>());
     }
     hm.get(result).add(qs);
   }
   return result;
 }
Пример #30
0
  /** Method to clear the LinkedHashSet */
  public void clear() {
    if (ownerOP != null && ownerOP.getExecutionContext().getManageRelations()) {
      // Relationship management
      Iterator iter = delegate.iterator();
      RelationshipManager relMgr = ownerOP.getExecutionContext().getRelationshipManager(ownerOP);
      while (iter.hasNext()) {
        relMgr.relationRemove(ownerMmd.getAbsoluteFieldNumber(), iter.next());
      }
    }

    if (ownerOP != null && !delegate.isEmpty()) {
      // Cascade delete
      if (SCOUtils.useQueuedUpdate(ownerOP)) {
        // Queue the cascade delete
        Iterator iter = delegate.iterator();
        while (iter.hasNext()) {
          ownerOP
              .getExecutionContext()
              .addOperationToQueue(
                  new CollectionRemoveOperation(
                      ownerOP, ownerMmd.getAbsoluteFieldNumber(), iter.next(), true));
        }
      } else if (SCOUtils.hasDependentElement(ownerMmd)) {
        // Perform the cascade delete
        Iterator iter = delegate.iterator();
        while (iter.hasNext()) {
          ownerOP.getExecutionContext().deleteObjectInternal(iter.next());
        }
      }
    }

    delegate.clear();

    makeDirty();
    if (ownerOP != null && !ownerOP.getExecutionContext().getTransaction().isActive()) {
      ownerOP.getExecutionContext().processNontransactionalUpdate();
    }
  }