List of usage examples for com.google.common.collect Sets newLinkedHashSet
public static <E> LinkedHashSet<E> newLinkedHashSet()
From source file:org.zoumbox.tarot.engine.Statistics.java
public Set<Contract> getFavoriteContract() { if (favoriteContract == null) { favoriteContract = Sets.newLinkedHashSet(); int maxOccurrence = 0; for (Map.Entry<Contract, Integer> entry : contracts.entrySet()) { int count = entry.getValue(); if (count > maxOccurrence) { favoriteContract.clear(); maxOccurrence = count;// ww w . j ava 2 s.com } if (count == maxOccurrence) { Contract contract = entry.getKey(); favoriteContract.add(contract); } } } return favoriteContract; }
From source file:org.artifactory.search.archive.ArchiveSearcherAql.java
@Override public ItemSearchResults<ArchiveSearchResult> doSearch(ArchiveSearchControls controls) { AqlApiItem aql = AqlApiItem.create() .filter(AqlApiItem.and(AqlApiItem.archive().entry().name().equal(controls.getName()), AqlApiItem.archive().entry().path().matches(controls.getPath()))) .include(AqlApiItem.archive().entry().name(), AqlApiItem.archive().entry().path()); AqlService aqlService = StorageContextHelper.get().beanForType(AqlService.class); AqlEagerResult<AqlItem> result = aqlService.executeQueryEager(aql); Set<ArchiveSearchResult> results = Sets.newLinkedHashSet(); for (AqlItem aqlArtifact : result.getResults()) { results.add(new ArchiveSearchResult(AqlConverts.toFileInfo.apply(aqlArtifact), ((AqlArchiveEntryItem) aqlArtifact).getEntryName(), ((AqlArchiveEntryItem) aqlArtifact).getEntryPath() + "/" + ((AqlArchiveEntryItem) aqlArtifact).getEntryName(), true));/*from ww w .jav a 2 s . c o m*/ } return new ItemSearchResults<>(Lists.newArrayList(results)); /*VfsQuery query = createQuery(controls); String path = controls.getPath(); if (path != null && !path.isEmpty() && !controls.isWildcardsOnly(path)) { if (path.contains(".") && !path.contains("/")) { path = path.replace(".", "/"); } validateQueryLength(path); query.archivePath(path).nextBool(VfsBoolType.AND); } String name = controls.getName(); if (controls.isSearchClassResourcesOnly()) { if (StringUtils.isEmpty(name)) { name = "*"; } if (!name.endsWith(".class")) { name += ".class"; } } if (name != null && !name.isEmpty() && !controls.isWildcardsOnly(name)) { validateQueryLength(name); query.archiveName(name); } query.expectedResult(VfsQueryResultType.ARCHIVE_ENTRY); if (controls.isExcludeInnerClasses()) { query.archiveName("*$*").comp(VfsComparatorType.NOT_CONTAINS); } int limit = getLimit(controls); VfsQueryResult queryResult = query.execute(limit); List<ArchiveSearchResult> resultList = Lists.newArrayList(); for (VfsQueryRow row : queryResult.getAllRows()) { //If the search results are limited, stop when reached more than max results + 1 if (resultList.size() < limit) { ItemInfo item = row.getItem(); RepoPath repoPath = item.getRepoPath(); if (!isResultAcceptable(repoPath)) { continue; } boolean shouldCalc = controls.shouldCalcEntries(); if (shouldCalc) { Iterable<ArchiveEntryRow> archiveEntries = row.getArchiveEntries(); *//** * Handle normal archive search (needs to calculate entry paths for display and results were * returned) */ /* for (ArchiveEntryRow entry : archiveEntries) { String entryName = entry.getEntryName(); if (StringUtils.isEmpty(entryName)) { entryName = name; } resultList.add(new ArchiveSearchResult(item, entryName, entry.getEntryPath() + "/" + entryName, true)); } } else { *//** * Create generic entries when we don't need to calculate paths (performing a search for the * "saved search results") or if the search query was too ambiguous (no results returned because * there were too many) *//* resultList.add(new ArchiveSearchResult(item, "Empty", "Entry path calculation is disabled.", false)); } } } return new ItemSearchResults<>(resultList, resultList.size());*/ }
From source file:com.baidu.rigel.biplatform.ma.auth.bo.CalMeasureViewBo.java
public CalMeasureViewBo() { this.referenceNames = Sets.newLinkedHashSet(); }
From source file:org.exoplatform.social.opensocial.service.ExoService.java
/** * Get the set of user id's from a user and group. * * @param user the user//from ww w. java 2 s.c o m * @param group the group * @param token the token * @return the id set * @throws Exception the exception */ protected Set<Identity> getIdSet(UserId user, GroupId group, SecurityToken token) throws Exception { if (token instanceof AnonymousSecurityToken) { throw new Exception(Integer.toString(HttpServletResponse.SC_FORBIDDEN)); } String userId = user.getUserId(token); Identity id = getIdentity(userId, token); Set<Identity> returnVal = Sets.newLinkedHashSet(); if (group == null) { returnVal.add(id); } else { switch (group.getType()) { case all: case friends: case groupId: returnVal.addAll(getFriendsList(id, token)); break; case self: returnVal.add(id); break; } } return returnVal; }
From source file:org.jetbrains.kotlin.resolve.calls.results.ResolutionResultsHandler.java
@NotNull public <D extends CallableDescriptor> OverloadResolutionResultsImpl<D> computeResultAndReportErrors( @NotNull CallResolutionContext context, @NotNull TracingStrategy tracing, @NotNull Collection<MutableResolvedCall<D>> candidates) { boolean resolveOverloads = context.checkArguments == CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS; // todo rename CheckArgumentTypesMode Set<MutableResolvedCall<D>> successfulCandidates = Sets.newLinkedHashSet(); Set<MutableResolvedCall<D>> failedCandidates = Sets.newLinkedHashSet(); Set<MutableResolvedCall<D>> incompleteCandidates = Sets.newLinkedHashSet(); Set<MutableResolvedCall<D>> candidatesWithWrongReceiver = Sets.newLinkedHashSet(); for (MutableResolvedCall<D> candidateCall : candidates) { ResolutionStatus status = candidateCall.getStatus(); assert status != UNKNOWN_STATUS : "No resolution for " + candidateCall.getCandidateDescriptor(); if (status.isSuccess()) { successfulCandidates.add(candidateCall); } else if (status == INCOMPLETE_TYPE_INFERENCE) { incompleteCandidates.add(candidateCall); } else if (candidateCall.getStatus() == RECEIVER_TYPE_ERROR) { candidatesWithWrongReceiver.add(candidateCall); } else if (candidateCall.getStatus() != RECEIVER_PRESENCE_ERROR) { failedCandidates.add(candidateCall); }//from w w w .j a v a 2s . c o m } // TODO : maybe it's better to filter overrides out first, and only then look for the maximally specific if (!successfulCandidates.isEmpty() || !incompleteCandidates.isEmpty()) { return computeSuccessfulResult(context, tracing, successfulCandidates, incompleteCandidates, resolveOverloads); } else if (!failedCandidates.isEmpty()) { return computeFailedResult(tracing, context.trace, failedCandidates, resolveOverloads); } if (!candidatesWithWrongReceiver.isEmpty()) { tracing.unresolvedReferenceWrongReceiver(context.trace, candidatesWithWrongReceiver); return OverloadResolutionResultsImpl.candidatesWithWrongReceiver(candidatesWithWrongReceiver); } tracing.unresolvedReference(context.trace); return OverloadResolutionResultsImpl.nameNotFound(); }
From source file:com.baidu.rigel.biplatform.ma.model.meta.DimTableMetaDefine.java
/** * /*from w w w . ja va2 s . co m*/ * * @param column * ? */ public void addColumn(ColumnMetaDefine column) { if (columns == null) { columns = Sets.newLinkedHashSet(); } columns.add(column); }
From source file:com.dilipkumarg.qb.SelectQueryBuilder.java
public SelectQueryBuilder(SqlTable table) { super(table); whereDelegator = WITH_ALIAS ? new AliasBasedWhereClause() : new NonAliasBasedWhereClause(); selectedColumns = Lists.newArrayList(); orderByEntries = Sets.newLinkedHashSet(); joinDelegator = new JoinClauseBuilder(); }
From source file:org.jetbrains.jet.lang.resolve.lazy.descriptors.LazyTypeParameterDescriptor.java
@NotNull @Override/*from w w w . j av a 2 s .c om*/ protected Set<JetType> resolveUpperBounds() { Set<JetType> upperBounds = Sets.newLinkedHashSet(); JetTypeParameter jetTypeParameter = this.jetTypeParameter; resolveUpperBoundsFromWhereClause(upperBounds, false); JetTypeReference extendsBound = jetTypeParameter.getExtendsBound(); if (extendsBound != null) { upperBounds.add(resolveBoundType(extendsBound)); } if (upperBounds.isEmpty()) { upperBounds.add(KotlinBuiltIns.getInstance().getDefaultBound()); } return upperBounds; }
From source file:exec.validate_evaluation.streaks.EditStreakGenerationRunner.java
public void run() { log.starting(filters);//from ww w . j a v a 2 s. c o m Set<String> zips = io.findCompletionEventZips(); log.foundZips(zips); for (String zip : zips) { log.startingZip(zip); editStreaks = Maps.newLinkedHashMap(); Set<ICompletionEvent> events = io.readCompletionEvents(zip); log.foundEvents(events); for (ICompletionEvent e : events) { log.processingEvent(e); extractEdits(e); } filterRemovals(); Set<EditStreak> streaks = Sets.newLinkedHashSet(); streaks.addAll(editStreaks.values()); log.endZip(streaks); io.storeEditStreaks(streaks, zip); } log.finish(); }
From source file:org.jetbrains.kotlin.builder.KotlinPsiManager.java
@NotNull public Set<FileObject> getFilesByProject(Project project) { Set<FileObject> ktFiles = Sets.newLinkedHashSet(); for (SourceGroup srcGroup : KotlinProjectHelper.INSTANCE.getKotlinSources(project).//project.getKotlinSources(). getSourceGroups(KotlinProjectConstants.KOTLIN_SOURCE.toString())) { for (FileObject file : srcGroup.getRootFolder().getChildren()) { if (isKotlinFile(file)) { ktFiles.add(file);//w w w .ja v a 2 s.co m } } } return ktFiles; }