List of usage examples for java.util HashSet remove
public boolean remove(Object o)
From source file:edu.ku.brc.specify.dbsupport.cleanuptools.LuceneHelperBase.java
/** * //from www . java 2s . c o m */ public void initLuceneforReading(final String fieldName) { try { reader = IndexReader.open(FSDirectory.open(FILE_INDEX_DIR)); } catch (CorruptIndexException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } Set<?> stdStopWords = StandardAnalyzer.STOP_WORDS_SET; HashSet<Object> stopWords = new HashSet<Object>(stdStopWords); stopWords.remove("will"); /*for (Object o : stopWords) { System.out.print(o.toString()+' '); } System.out.println();*/ searcher = new IndexSearcher(reader); analyzer = new StandardAnalyzer(Version.LUCENE_47, CharArraySet.EMPTY_SET); parser = new QueryParser(Version.LUCENE_47, fieldName, analyzer); }
From source file:org.hyperic.hq.ui.action.resource.common.monitor.alerts.config.RemoveUsersAction.java
/** * Handles the actual work of removing users from the action. *//* w w w. j a va2 s . c o m*/ protected ActionForward handleRemove(ActionMapping mapping, HttpServletRequest request, Map<String, Object> params, Integer sessionID, ActionValue action, EmailActionConfig ea, EventsBoss eb, RemoveNotificationsForm rnForm) throws Exception { Integer[] users = rnForm.getUsers(); if (null != users) { log.debug("users.length=" + users.length); HashSet<Object> storedUsers = new HashSet<Object>(); storedUsers.addAll(ea.getUsers()); for (int x = 0; x < users.length; ++x) { storedUsers.remove(users[x]); } ea.setNames(StringUtil.iteratorToString(storedUsers.iterator(), ",")); action.setConfig(ea.getConfigResponse().encode()); eb.updateAction(sessionID.intValue(), action); } return returnSuccess(request, mapping, params); }
From source file:org.magnum.mobilecloud.video.VideoSvcCtrl.java
@PreAuthorize("hasRole(USER)") @RequestMapping(method = RequestMethod.POST, value = VideoSvcApi.VIDEO_SVC_PATH + "/{id}/unlike") public @ResponseBody void unlikeVideo(@PathVariable("id") long id, Principal principal, HttpServletResponse response) {/*from w w w. j ava 2 s. c o m*/ Video v = videoRepo.findOne(id); if (v != null) { HashSet<String> likers = v.getLikers(); if (likers.contains(principal.getName())) { likers.remove(principal.getName()); videoRepo.save(v); response.setStatus(HttpServletResponse.SC_OK); } else response.setStatus(HttpServletResponse.SC_BAD_REQUEST); } else response.setStatus(HttpServletResponse.SC_NOT_FOUND); }
From source file:com.metaparadigm.jsonrpc.JSONRPCBridge.java
/** * Unregisters a LocalArgResolver</b>. * /*from ww w. j ava2s .c o m*/ * @param argClazz * The previously registered local class * @param argResolver * The previously registered LocalArgResolver object * @param contextInterface * The previously registered transport Context interface. */ public static void unregisterLocalArgResolver(Class argClazz, Class contextInterface, LocalArgResolver argResolver) { synchronized (localArgResolverMap) { HashSet resolverSet = (HashSet) localArgResolverMap.get(argClazz); if (resolverSet == null || !resolverSet.remove(new LocalArgResolverData(argResolver, argClazz, contextInterface))) { log.warning("local arg resolver " + argResolver.getClass().getName() + " not registered for local class " + argClazz.getName() + " with context " + contextInterface.getName()); return; } if (resolverSet.isEmpty()) localArgResolverMap.remove(argClazz); classCache = new HashMap(); // invalidate class cache } log.info("unregistered local arg resolver " + argResolver.getClass().getName() + " for local class " + argClazz.getName() + " with context " + contextInterface.getName()); }
From source file:org.eclipse.gyrex.persistence.internal.storage.RepositoryDefinition.java
@Override public void removeTag(final String tag) { if (StringUtils.isBlank(tag)) { return;//from w w w.j a v a 2 s . c o m } final HashSet<String> tags = new HashSet<String>(getTags()); if (!tags.contains(tag)) { return; } tags.remove(tag); setTags(tags); }
From source file:org.springsource.ide.eclipse.boot.maven.analyzer.aether.AetherHelperTest.java
private void assertExpectedArtifacts(String[] expectedAIDs, List<Dependency> managedDependencies) { HashSet<String> expected = new HashSet<String>(Arrays.asList(expectedAIDs)); for (Dependency d : managedDependencies) { Artifact foundArtifact = d.getArtifact(); if (foundArtifact != null) { expected.remove(foundArtifact.getArtifactId()); }//from w w w. j a v a 2 s . c om } }
From source file:edu.uci.ics.jung.algorithms.cluster.WeakComponentClusterer.java
/** * Extracts the weak components from a graph. * @param graph the graph whose weak components are to be extracted * @return the list of weak components//from w ww. j a v a2s . c om */ public Set<Set<V>> transform(Graph<V, E> graph) { Set<Set<V>> clusterSet = new HashSet<Set<V>>(); HashSet<V> unvisitedVertices = new HashSet<V>(graph.getVertices()); while (!unvisitedVertices.isEmpty()) { Set<V> cluster = new HashSet<V>(); V root = unvisitedVertices.iterator().next(); unvisitedVertices.remove(root); cluster.add(root); Buffer<V> queue = new UnboundedFifoBuffer<V>(); queue.add(root); while (!queue.isEmpty()) { V currentVertex = queue.remove(); Collection<V> neighbors = graph.getNeighbors(currentVertex); for (V neighbor : neighbors) { if (unvisitedVertices.contains(neighbor)) { queue.add(neighbor); unvisitedVertices.remove(neighbor); cluster.add(neighbor); } } } clusterSet.add(cluster); } return clusterSet; }
From source file:org.hyperic.hq.ui.action.resource.common.monitor.alerts.config.RemoveOthersAction.java
/** * Handles the actual work of removing emails from the action. *//*from w w w.j a va 2 s. c o m*/ protected ActionForward handleRemove(ActionMapping mapping, HttpServletRequest request, Map<String, Object> params, Integer sessionID, ActionValue action, EmailActionConfig ea, EventsBoss eb, RemoveNotificationsForm rnForm) throws Exception { String[] emails = rnForm.getEmails(); if (null != emails) { log.debug("emails.length=" + emails.length); HashSet<Object> storedEmails = new HashSet<Object>(); storedEmails.addAll(ea.getUsers()); log.debug("storedEmails (pre): " + storedEmails); for (int i = 0; i < emails.length; ++i) { storedEmails.remove(emails[i]); } log.debug("storedEmails (post): " + storedEmails); ea.setNames(StringUtil.iteratorToString(storedEmails.iterator(), ",")); action.setConfig(ea.getConfigResponse().encode()); eb.updateAction(sessionID.intValue(), action); } return returnSuccess(request, mapping, params); }
From source file:org.trnltk.morphology.lexicon.LexemeCreator.java
private void inferNounCompoundMorphemicAttributes(HashSet<LexemeAttribute> lexemeAttributes) { if (lexemeAttributes.contains(LexemeAttribute.VoicingOpt)) { lexemeAttributes.remove(LexemeAttribute.Voicing); lexemeAttributes.remove(LexemeAttribute.NoVoicing); } else if (!lexemeAttributes.contains(LexemeAttribute.Voicing)) { lexemeAttributes.add(LexemeAttribute.NoVoicing); }/* w ww .ja v a2s . co m*/ }