List of usage examples for com.google.common.collect Sets newHashSet
public static <E> HashSet<E> newHashSet()
From source file:com.citytechinc.cq.clientlibs.api.util.ComponentUtils.java
public static Set<String> getNestedComponentTypes(Resource root, boolean inclusive) { Set<Resource> flattenedResourceTree = flattenResourceTree(root, inclusive); Set<String> resourceTypeSet = Sets.newHashSet(); for (Resource currentResource : flattenedResourceTree) { if (currentResource.getResourceType() != null && StringUtils.isNotBlank(currentResource.getResourceType())) { resourceTypeSet.add(currentResource.getResourceType()); }//from www. j a v a 2 s .co m } return resourceTypeSet; }
From source file:org.spongepowered.despector.ast.io.insn.InstructionTreeBuilder.java
@SuppressWarnings("unchecked") public static StatementBlock build(MethodNode asm) { if (asm.instructions.size() == 0) { return null; }/*from w w w. jav a2 s. c o m*/ Locals locals = new Locals(); Set<String> names = Sets.newHashSet(); for (LocalVariableNode node : (List<LocalVariableNode>) asm.localVariables) { Local local = locals.getLocal(node.index); String name = node.name; if ("".equals(name)) { name = "local"; } if (names.contains(name)) { String possible_name = name + "1"; int i = 1; while (names.contains(possible_name)) { possible_name = name + (++i); } name = possible_name; } local.setName(name); names.add(name); local.setType(node.desc); if (node.signature != null) { String[] generics = TypeHelper.getGenericContents(node.signature); local.setGenericTypes(generics); } } int offs = ((asm.access & Opcodes.ACC_STATIC) != 0) ? 1 : 0; for (int i = 0; i <= TypeHelper.paramCount(asm.desc) - offs; i++) { locals.getLocal(i).setAsParameter(); } return new OpcodeDecompiler().decompile(asm.instructions, locals); }
From source file:org.vclipse.refactoring.core.DefaultContainerPreviewComputer.java
@Override public Set<EClass> getFavoredTypes() { return Sets.newHashSet(); }
From source file:org.geogit.storage.sqlite.PathToRootWalker.java
public PathToRootWalker(ObjectId start, SQLiteGraphDatabase<T> graph, T cx) { this.graph = graph; this.cx = cx; q = Lists.newLinkedList();/* w w w .ja v a2s . com*/ q.add(start); seen = Sets.newHashSet(); }
From source file:org.auraframework.util.test.util.ModuleUtil.java
public static Collection<String> getClassNames(URI rootUri) { Collection<String> classNames = Sets.newHashSet(); try {/*from w w w.ja v a 2s . com*/ if ("jar".equals(rootUri.getScheme())) { JarURLConnection jarConn = (JarURLConnection) rootUri.toURL().openConnection(); for (Enumeration<JarEntry> entries = jarConn.getJarFile().entries(); entries.hasMoreElements();) { JarEntry entry = entries.nextElement(); String entryName = entry.getName(); if (entryName.endsWith(CLASS_SUFFIX)) { entryName = entryName.substring(0, entryName.length() - CLASS_SUFFIX.length()); } classNames.add(entryName.replace('/', '.')); } } else { forEachFile(classNames, rootUri, new File(rootUri)); } } catch (IOException e) { e.printStackTrace(); } return classNames; }
From source file:org.graylog2.plugins.PluginRegistry.java
public static void setActiveAlarmCallbacks(Core server, List<AlarmCallback> callbacks) { Set<Map<String, Object>> r = Sets.newHashSet(); for (AlarmCallback callback : callbacks) { r.add(buildStandardInformation(callback.getClass().getCanonicalName(), callback.getName(), callback.getRequestedConfiguration())); }//from w w w. j av a2s. co m server.getMongoBridge().writePluginInformation(r, "alarm_callbacks"); }
From source file:org.nlplab.brat.configuration.BratAttributeType.java
public BratAttributeType(String name, Set<String> values) { super(name);/*ww w .j av a 2 s . c o m*/ if (values == null) { values = Sets.newHashSet(); } this.values = ImmutableSet.copyOf(values); }
From source file:it.smartcommunitylab.aac.keymanager.model.AACClient.java
public AACClient() { grantedTypes = Sets.newHashSet(); }
From source file:org.eclipse.recommenders.codesearch.rcp.searcher.LuceneSearchTermExtractor.java
@Override public Set<String> exec(XtextResource state) throws Exception { final TreeIterator<EObject> iter = state.getAllContents(); final Set<String> res = Sets.newHashSet(); do {//ww w . ja va 2s . c o m final EObject o = iter.next(); if (o instanceof ClauseExpressionImpl) { final ClauseExpressionImpl impl = (ClauseExpressionImpl) o; for (int i = 0; i < impl.getValues().size(); i++) { final String value = impl.getValues().get(i); final String lowerCase = value.toLowerCase(); final String[] segments = lowerCase.split("\\W"); for (final String term : segments) { if (term.isEmpty()) { continue; } res.add(term); } } } } while (iter.hasNext()); return res; }
From source file:co.mitro.analysis.AuditLogProcessor.java
/** * Tries to create processed audit logs for any audit records that are missing * processed logs. This could take a while... *///from w w w. j a v a2 s . co m public static void main(String[] args) throws SQLException { Main.exitIfAssertionsDisabled(); Set<String> transactionsToProcess = Sets.newHashSet(); try (Manager mgr = ManagerFactory.getInstance().newManager()) { mgr.disableAuditLogs(); if (args.length == 0) { // find all transactions // this crazy string is necessary because postgres 9.1 does not properly optimize NOT IN queries String QUERY = "SELECT DISTINCT transaction_id FROM audit WHERE audit.action = 'INVITE_NEW_USER'"; List<String[]> inviteResults = Lists.newArrayList(mgr.processedAuditDao.queryRaw(QUERY)); for (String[] row : inviteResults) { String tid = row[0]; if (Strings.isNullOrEmpty(tid)) { continue; } transactionsToProcess.add(tid); } } else { // use specified transaction ids. for (int i = 0; i < args.length; ++i) { transactionsToProcess.add(args[i]); } } if (true) { // ONLY FOR RE-CREATING ALL LOGS. THIS IS DANGEROUS for (String tid : transactionsToProcess) { System.out.println("deleting " + tid); DeleteBuilder<DBProcessedAudit, Integer> deleter = mgr.processedAuditDao.deleteBuilder(); deleter.where().eq("transaction_id", tid); deleter.delete(); } } ///// logger.info("we must process logs for {} transactions.", transactionsToProcess.size()); for (String tid : transactionsToProcess) { int count = putActionsForTransactionId(mgr, tid); mgr.commitTransaction(); logger.info("transaction {} -> {} events.", tid, count); } } }