@SuppressWarnings({"rawtypes", "unchecked"})
 @Override
 public Iterable<Edge> getEdges(final Direction direction, final String... labels) {
   if (direction == Direction.IN) {
     if (labels == null || labels.length == 0) {
       return Collections.unmodifiableSet(getInEdgeObjects());
     } else {
       return getInEdgeObjects(labels);
     }
   } else if (direction == Direction.OUT) {
     if (labels == null || labels.length == 0) {
       return Collections.unmodifiableSet(getOutEdgeObjects());
     } else {
       return getOutEdgeObjects(labels);
     }
   } else {
     LinkedHashSet result = new LinkedHashSet<Edge>();
     if (labels == null || labels.length == 0) {
       result.addAll(getInEdgeObjects());
       result.addAll(getOutEdgeObjects());
     } else {
       result.addAll(getInEdgeObjects(labels));
       result.addAll(getOutEdgeObjects(labels));
     }
     return Collections.unmodifiableSet(result);
   }
 }
  public Set<IndexedTermSimilarityRelation> relationsOf(final IndexedTerm term) {
    final LinkedHashSet<IndexedTermSimilarityRelation> result =
        new LinkedHashSet<IndexedTermSimilarityRelation>();

    // Using the linked hash set will remove a redundant self-relation.
    result.addAll(this.relationsFrom(term));
    result.addAll(this.relationsTo(term));
    return result;
  }
 @NotNull
 Set<VirtualFile> getAllRoots() {
   LinkedHashSet<VirtualFile> result = ContainerUtil.newLinkedHashSet();
   result.addAll(classAndSourceRoots);
   result.addAll(contentRootOf.keySet());
   result.addAll(excludedFromLibraries.keySet());
   result.addAll(excludedFromModule.keySet());
   result.addAll(excludedFromProject);
   return result;
 }
  @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;
  }
Example #5
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;
  }
Example #6
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));
 }
  public static LinkedHashSet<String> sortMatching(
      final PrefixMatcher matcher, Collection<String> _names) {
    ProgressManager.checkCanceled();

    List<String> sorted = new ArrayList<String>();
    for (String name : _names) {
      if (matcher.prefixMatches(name)) {
        sorted.add(name);
      }
    }

    ProgressManager.checkCanceled();
    Collections.sort(sorted, String.CASE_INSENSITIVE_ORDER);
    ProgressManager.checkCanceled();

    LinkedHashSet<String> result = new LinkedHashSet<String>();
    for (String name : sorted) {
      if (matcher.isStartMatch(name)) {
        result.add(name);
      }
    }

    ProgressManager.checkCanceled();

    result.addAll(sorted);
    return result;
  }
Example #8
0
  public static <T> LinkedHashSet<T> mergeToSet(T... args) {
    LinkedHashSet<T> out = new LinkedHashSet<T>();

    out.addAll(Arrays.asList(args));

    return out;
  }
Example #9
0
  public static LinkedHashSet<String> findJars(LogicalPlan dag, Class<?>[] defaultClasses) {
    List<Class<?>> jarClasses = new ArrayList<Class<?>>();

    for (String className : dag.getClassNames()) {
      try {
        Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass(className);
        jarClasses.add(clazz);
      } catch (ClassNotFoundException e) {
        throw new IllegalArgumentException("Failed to load class " + className, e);
      }
    }

    for (Class<?> clazz : Lists.newArrayList(jarClasses)) {
      // process class and super classes (super does not require deploy annotation)
      for (Class<?> c = clazz; c != Object.class && c != null; c = c.getSuperclass()) {
        // LOG.debug("checking " + c);
        jarClasses.add(c);
        jarClasses.addAll(Arrays.asList(c.getInterfaces()));
      }
    }

    jarClasses.addAll(Arrays.asList(defaultClasses));

    if (dag.isDebug()) {
      LOG.debug("Deploy dependencies: {}", jarClasses);
    }

    LinkedHashSet<String> localJarFiles = new LinkedHashSet<String>(); // avoid duplicates
    HashMap<String, String> sourceToJar = new HashMap<String, String>();

    for (Class<?> jarClass : jarClasses) {
      if (jarClass.getProtectionDomain().getCodeSource() == null) {
        // system class
        continue;
      }
      String sourceLocation =
          jarClass.getProtectionDomain().getCodeSource().getLocation().toString();
      String jar = sourceToJar.get(sourceLocation);
      if (jar == null) {
        // don't create jar file from folders multiple times
        jar = JarFinder.getJar(jarClass);
        sourceToJar.put(sourceLocation, jar);
        LOG.debug("added sourceLocation {} as {}", sourceLocation, jar);
      }
      if (jar == null) {
        throw new AssertionError("Cannot resolve jar file for " + jarClass);
      }
      localJarFiles.add(jar);
    }

    String libJarsPath = dag.getValue(LogicalPlan.LIBRARY_JARS);
    if (!StringUtils.isEmpty(libJarsPath)) {
      String[] libJars = StringUtils.splitByWholeSeparator(libJarsPath, LIB_JARS_SEP);
      localJarFiles.addAll(Arrays.asList(libJars));
    }

    LOG.info("Local jar file dependencies: " + localJarFiles);

    return localJarFiles;
  }
Example #10
0
 /**
  * Method to add a collection to the LinkedHashSet.
  *
  * @param elements The collection
  * @return Whether it was added ok.
  */
 public boolean addAll(Collection elements) {
   boolean success = delegate.addAll(elements);
   if (ownerOP != null && ownerOP.getExecutionContext().getManageRelations()) {
     // Relationship management
     Iterator iter = elements.iterator();
     while (iter.hasNext()) {
       ownerOP
           .getExecutionContext()
           .getRelationshipManager(ownerOP)
           .relationAdd(ownerMmd.getAbsoluteFieldNumber(), iter.next());
     }
   }
   if (success) {
     if (SCOUtils.useQueuedUpdate(ownerOP)) {
       for (Object element : elements) {
         ownerOP
             .getExecutionContext()
             .addOperationToQueue(
                 new CollectionAddOperation(ownerOP, ownerMmd.getAbsoluteFieldNumber(), element));
       }
     }
     makeDirty();
     if (ownerOP != null && !ownerOP.getExecutionContext().getTransaction().isActive()) {
       ownerOP.getExecutionContext().processNontransactionalUpdate();
     }
   }
   return success;
 }
Example #11
0
 public ListValue union(ListValue other) throws PathEvaluationException {
   if (!isEmpty() && !other.isEmpty() && (isPrimitiveList() ^ other.isPrimitiveList()))
     throw new PathEvaluationException("Can't perform a union between different types of list");
   if (!isPrimitiveList()) {
     LinkedHashSet<SingleValue> set = new LinkedHashSet<SingleValue>();
     set.addAll(this.values);
     set.addAll(other.values);
     ListValue result = new ListValue();
     result.values.addAll(set);
     return result;
   } else {
     ListValue result = new ListValue(this);
     result.values.addAll(other.values);
     return result;
   }
 }
Example #12
0
  public static void main(String[] args) {

    Scanner input = new Scanner(System.in);
    List<String> list = new ArrayList<>();

    System.out.print("Enter text to add to ArrayList: ");
    String str = input.nextLine();
    // adding text to list:
    while (true) {
      if (str.equals("exit")) break;
      list.add(str);
      System.out.print("Enter text to add to ArrayList: ");
      str = input.nextLine();
    }

    // dellete duplicates
    LinkedHashSet<String> set = new LinkedHashSet<>();
    set.addAll(list);
    list.clear();
    list.addAll(set);

    // output of arraylist
    System.out.println("All duplicates are deleted:");
    for (String elem : list) {
      System.out.println(elem);
    }
  }
Example #13
0
 public ListValue except(ListValue other) {
   LinkedHashSet<SingleValue> set = new LinkedHashSet<SingleValue>();
   set.addAll(this.values);
   set.removeAll(other.values);
   ListValue result = new ListValue();
   result.values.addAll(set);
   return result;
 }
Example #14
0
  public void udtSerDeserTest(int version) throws Exception {
    ListType<?> lt = ListType.getInstance(Int32Type.instance, true);
    SetType<?> st = SetType.getInstance(UTF8Type.instance, true);
    MapType<?, ?> mt = MapType.getInstance(UTF8Type.instance, LongType.instance, true);

    UserType udt =
        new UserType(
            "ks",
            bb("myType"),
            Arrays.asList(bb("f1"), bb("f2"), bb("f3"), bb("f4")),
            Arrays.asList(LongType.instance, lt, st, mt));

    Map<ColumnIdentifier, Term.Raw> value = new HashMap<>();
    value.put(ci("f1"), lit(42));
    value.put(ci("f2"), new Lists.Literal(Arrays.<Term.Raw>asList(lit(3), lit(1))));
    value.put(ci("f3"), new Sets.Literal(Arrays.<Term.Raw>asList(lit("foo"), lit("bar"))));
    value.put(
        ci("f4"),
        new Maps.Literal(
            Arrays.<Pair<Term.Raw, Term.Raw>>asList(
                Pair.<Term.Raw, Term.Raw>create(lit("foo"), lit(24)),
                Pair.<Term.Raw, Term.Raw>create(lit("bar"), lit(12)))));

    UserTypes.Literal u = new UserTypes.Literal(value);
    Term t = u.prepare("ks", columnSpec("myValue", udt));

    QueryOptions options = QueryOptions.DEFAULT;
    if (version == 2)
      options =
          QueryOptions.fromProtocolV2(ConsistencyLevel.ONE, Collections.<ByteBuffer>emptyList());
    else if (version != 3) throw new AssertionError("Invalid protocol version for test");

    ByteBuffer serialized = t.bindAndGet(options);

    ByteBuffer[] fields = udt.split(serialized);

    assertEquals(4, fields.length);

    assertEquals(bytes(42L), fields[0]);

    // Note that no matter what the protocol version has been used in bindAndGet above, the
    // collections inside
    // a UDT should alway be serialized with version 3 of the protocol. Which is why we don't use
    // 'version'
    // on purpose below.

    assertEquals(
        Arrays.asList(3, 1), lt.getSerializer().deserializeForNativeProtocol(fields[1], 3));

    LinkedHashSet<String> s = new LinkedHashSet<>();
    s.addAll(Arrays.asList("bar", "foo"));
    assertEquals(s, st.getSerializer().deserializeForNativeProtocol(fields[2], 3));

    LinkedHashMap<String, Long> m = new LinkedHashMap<>();
    m.put("bar", 12L);
    m.put("foo", 24L);
    assertEquals(m, mt.getSerializer().deserializeForNativeProtocol(fields[3], 3));
  }
Example #15
0
  public void generateMetadata(
      List<IArtifactFacade> artifacts,
      Map<String, IArtifactFacade> attachedArtifacts,
      File targetDir)
      throws IOException {
    LinkedHashSet<IInstallableUnit> units = new LinkedHashSet<IInstallableUnit>();
    LinkedHashSet<IArtifactDescriptor> artifactDescriptors =
        new LinkedHashSet<IArtifactDescriptor>();

    for (IArtifactFacade artifact : artifacts) {
      PublisherInfo publisherInfo = new PublisherInfo();

      DependencyMetadata metadata;

      // meta data handling for root files
      if ("eclipse-feature".equals(artifact.getPackagingType())) {
        publisherInfo.setArtifactOptions(
            IPublisherInfo.A_INDEX | IPublisherInfo.A_PUBLISH | IPublisherInfo.A_NO_MD5);
        FeatureRootfileArtifactRepository artifactsRepository =
            new FeatureRootfileArtifactRepository(publisherInfo, targetDir);
        publisherInfo.setArtifactRepository(artifactsRepository);

        metadata = super.generateMetadata(artifact, null, publisherInfo, null);

        attachedArtifacts.putAll(artifactsRepository.getPublishedArtifacts());
      } else {
        publisherInfo.setArtifactOptions(IPublisherInfo.A_NO_MD5);
        TransientArtifactRepository artifactsRepository = new TransientArtifactRepository();
        publisherInfo.setArtifactRepository(artifactsRepository);
        metadata = super.generateMetadata(artifact, null, publisherInfo, null);
      }

      units.addAll(metadata.getInstallableUnits());
      artifactDescriptors.addAll(metadata.getArtifactDescriptors());
    }

    new MetadataIO()
        .writeXML(
            units,
            attachedArtifacts.get(RepositoryLayoutHelper.CLASSIFIER_P2_METADATA).getLocation());
    new ArtifactsIO()
        .writeXML(
            artifactDescriptors,
            attachedArtifacts.get(RepositoryLayoutHelper.CLASSIFIER_P2_ARTIFACTS).getLocation());
  }
Example #16
0
  public MPSModulesClosure closure() {
    // get all direct dependencies abd runtimes, plus re-exported dependencies thereof.
    Set<SNode> langs = SetSequence.fromSet(new HashSet<SNode>());
    Set<SNode> solutions = SetSequence.fromSet(new HashSet<SNode>());

    for (SNode module : Sequence.fromIterable(initialModules)) {
      List<SNode> firstLevelDeps =
          Sequence.fromIterable(getDependencies(module, false)).toListSequence();
      collectDependencies(firstLevelDeps, true);
      fillUsedLanguageRuntimes(module, langs, solutions);
      modules.addAll(firstLevelDeps);
    }
    modules.addAll(solutions);
    languagesWithRuntime.addAll(langs);
    collectDependencies(((Iterable<SNode>) solutions), true);
    modules.removeAll(Sequence.fromIterable(initialModules).toListSequence());
    return this;
  }
  /**
   * Begins the in-place refactoring operation.
   *
   * @return true if the in-place refactoring was successfully started, false if it failed to start
   *     and a dialog should be shown instead.
   */
  public boolean startInplaceIntroduceTemplate() {
    final boolean replaceAllOccurrences = isReplaceAllOccurrences();
    final Ref<Boolean> result = new Ref<>();
    CommandProcessor.getInstance()
        .executeCommand(
            myProject,
            () -> {
              final String[] names = suggestNames(replaceAllOccurrences, getLocalVariable());
              final V variable = createFieldToStartTemplateOn(replaceAllOccurrences, names);
              boolean started = false;
              if (variable != null) {
                int caretOffset = getCaretOffset();
                myEditor.getCaretModel().moveToOffset(caretOffset);
                myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);

                final LinkedHashSet<String> nameSuggestions = new LinkedHashSet<>();
                nameSuggestions.add(variable.getName());
                nameSuggestions.addAll(Arrays.asList(names));
                initOccurrencesMarkers();
                setElementToRename(variable);
                updateTitle(getVariable());
                started = super.performInplaceRefactoring(nameSuggestions);
                if (started) {
                  onRenameTemplateStarted();
                  myDocumentAdapter =
                      new DocumentAdapter() {
                        @Override
                        public void documentChanged(DocumentEvent e) {
                          if (myPreview == null) return;
                          final TemplateState templateState =
                              TemplateManagerImpl.getTemplateState(myEditor);
                          if (templateState != null) {
                            final TextResult value =
                                templateState.getVariableValue(
                                    InplaceRefactoring.PRIMARY_VARIABLE_NAME);
                            if (value != null) {
                              updateTitle(getVariable(), value.getText());
                            }
                          }
                        }
                      };
                  myEditor.getDocument().addDocumentListener(myDocumentAdapter);
                  updateTitle(getVariable());
                  if (TemplateManagerImpl.getTemplateState(myEditor) != null) {
                    myEditor.putUserData(ACTIVE_INTRODUCE, this);
                  }
                }
              }
              result.set(started);
              if (!started) {
                finish(true);
              }
            },
            getCommandName(),
            getCommandName());
    return result.get();
  }
Example #18
0
  public static LinkedHashSet<String> getImplicitlyImportedPackages(GroovyFile file) {
    final LinkedHashSet<String> result = new LinkedHashSet<String>();
    ContainerUtil.addAll(result, GroovyFileBase.IMPLICITLY_IMPORTED_PACKAGES);

    for (DefaultImportContributor contributor : DefaultImportContributor.EP_NAME.getExtensions()) {
      result.addAll(contributor.appendImplicitlyImportedPackages(file));
    }

    return result;
  }
Example #19
0
  private boolean saveArray() {
    SharedPreferences sp = this.getSharedPreferences(SHARED_PREFS_NAME, Activity.MODE_PRIVATE);
    SharedPreferences.Editor mEdit1 = sp.edit();
    LinkedHashSet<String> set = new LinkedHashSet<String>();
    set.addAll(newcost);

    mEdit1.putStringSet("list", set);
    // Toast.makeText(this, set.toString(), Toast.LENGTH_LONG).show();
    return mEdit1.commit();
  }
Example #20
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 merge(ConceptInstanceMap other) {
   for (String cn : other.myNodes.keySet()) {
     List<SNode> nodes = myNodes.get(cn);
     if (nodes == null) {
       myNodes.put(cn, other.myNodes.get(cn));
     } else {
       LinkedHashSet<SNode> newNodes = new LinkedHashSet<SNode>(nodes);
       newNodes.addAll(other.myNodes.get(cn));
       myNodes.put(cn, new ArrayList<SNode>(newNodes));
     }
   }
 }
Example #22
0
  public synchronized List<String> listEntries(String namePattern) {
    List<String> viewList = view.listEntries(namePattern);
    List<String> archiveList = archive.listEntries(namePattern);

    if (archiveList.isEmpty()) {
      return viewList;
    }

    LinkedHashSet<String> entries = new LinkedHashSet<String>(viewList);
    entries.addAll(archiveList);
    return new ArrayList<String>(entries);
  }
  // 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);
      }
    }
  }
Example #24
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);
 }
  /*package*/ void addAliases(
      final AbstractBuild<?, ?> build, final LinkedHashSet<String> aliases) {

    final int buildNumber = build.getNumber();

    LinkedHashSet<String> bucket = permalinks.get(buildNumber);
    if (bucket == null) {
      bucket = new LinkedHashSet<String>(aliases.size());
      permalinks.put(buildNumber, bucket);
    }

    bucket.addAll(aliases);
  }
 @NotNull
 private LinkedHashSet<OrderEntry> getLibraryOrderEntries(
     @NotNull List<VirtualFile> hierarchy,
     @Nullable VirtualFile libraryClassRoot,
     @Nullable VirtualFile librarySourceRoot,
     @NotNull MultiMap<VirtualFile, OrderEntry> libClassRootEntries,
     @NotNull MultiMap<VirtualFile, OrderEntry> libSourceRootEntries) {
   LinkedHashSet<OrderEntry> orderEntries = ContainerUtil.newLinkedHashSet();
   for (VirtualFile root : hierarchy) {
     if (root.equals(libraryClassRoot) && !sourceRootOf.containsKey(root)) {
       orderEntries.addAll(libClassRootEntries.get(root));
     }
     if (root.equals(librarySourceRoot) && libraryClassRoot == null) {
       orderEntries.addAll(libSourceRootEntries.get(root));
     }
     if (libClassRootEntries.containsKey(root)
         || sourceRootOf.containsKey(root) && librarySourceRoot == null) {
       break;
     }
   }
   return orderEntries;
 }
 static {
   baseGenericTypes.addAll(
       Arrays.asList(
           new String[] {
             "java.util.Map",
             "java.util.Collection",
             "java.lang.Iterable",
             "java.util.Iterator",
             "com.google.common.collect.Multimap",
             "com.google.common.collect.Multiset",
             "com.google.common.collect.Table"
           }));
 }
  private LinkedHashSet<String> aliases(
      final AbstractBuild<?, ?> build, final BuildListener listener)
      throws IOException, InterruptedException {

    final LinkedHashSet<String> aliases = new LinkedHashSet<String>(providers.size());
    for (final AliasProvider provider : providers) {

      final List<String> names = provider.names(build, listener);
      aliases.addAll(names);
    }

    return filterAliases(aliases, listener);
  }
Example #29
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;
 }
Example #30
0
  public ArrayList<String> IPTrack(
      String ipaddr, boolean IPdisp, boolean recursive, boolean override) {
    ArrayList<String> output = new ArrayList<String>();

    PreparedStatement ps = null;
    ResultSet rs = null;
    try {
      ps =
          conn.prepareStatement(
              "SELECT `accountname` "
                  + "FROM `"
                  + table
                  + "` "
                  + "WHERE `ip` = ? "
                  + "ORDER BY `time` DESC");
      ps.setString(1, ipaddr);
      rs = ps.executeQuery();

      LinkedHashSet<String> names = new LinkedHashSet<String>();
      while (rs.next()) {
        if ((!plugin.untraceable.contains(rs.getString("accountname"))) || (override))
          names.add(rs.getString("accountname") + ((IPdisp) ? " (" + ipaddr + ")" : ""));
      }
      if (recursive) { // OH GOD OH GOD OH GOD
        LinkedHashSet<String> names_spent = new LinkedHashSet<String>();
        java.util.Iterator<String> names_itr = names.iterator();
        while (names_itr.hasNext()) {

          String thisName = names_itr.next();
          if (names_spent.contains(thisName)) continue;

          names_spent.add(thisName);
          if (names.addAll(
              PlayerTrack(
                  ((thisName.indexOf(" ") != -1)
                      ? thisName.substring(0, thisName.indexOf(" "))
                      : thisName),
                  IPdisp,
                  false,
                  override,
                  false,
                  false))) names_itr = names.iterator();
        }
      }
      output.addAll(names);
    } catch (SQLException ex) {
      PlayerTracker.log.log(Level.SEVERE, "[P-Tracker] Couldn't execute MySQL statement: ", ex);
    }

    return output;
  }