List of usage examples for java.util Set remove
boolean remove(Object o);
From source file:com.techcavern.wavetact.ircCommands.chanhalfop.Part.java
@Override public void onCommand(String command, User user, PircBotX network, String prefix, Channel channel, boolean isPrivate, int userPermLevel, String... args) throws Exception { if (args.length < 1 || (args.length == 1 && args[0].equalsIgnoreCase(channel.getName()))) { channel.send().part();/* w w w. ja va 2s . c o m*/ Registry.lastLeftChannel.put(network, channel.getName()); } else { if (userPermLevel >= 20) { boolean permanent = false; if (args[0].startsWith("+")) { args[0] = args[0].replace("+", ""); permanent = true; } Registry.lastLeftChannel.put(network, args[0]); Registry.messageQueue.get(network).add("PART " + args[0]); if (permanent) { Record netRecord = DatabaseUtils.getNetwork(IRCUtils.getNetworkNameByNetwork(network)); Set<String> channels = new HashSet<>( Arrays.asList(StringUtils.split(netRecord.getValue(NETWORKS.CHANNELS), ", "))); channels.remove(args[0]); netRecord.setValue(NETWORKS.CHANNELS, StringUtils.join(channels, ", ")); DatabaseUtils.updateNetwork(netRecord); } } else { IRCUtils.sendError(user, network, channel, "Permission denied", prefix); } } }
From source file:com.alibaba.otter.common.push.AbstractSubscribeManager.java
private void doUnregister(String dataId, String groupId, SubscribeCallback callback, String key) { Object lock = getLock(key);/*from ww w.ja v a 2 s .c om*/ synchronized (lock) { Set<SubscribeCallback> callbacks = callBackMap.get(key); boolean effectRemoved = callbacks.remove(callback); if (!effectRemoved) { return; } if (callbacks.isEmpty()) { doWhenCallbackEmpty(dataId, groupId, callback); } } }
From source file:edu.uci.ics.jung.algorithms.blockmodel.StructurallyEquivalent.java
/** * Checks whether a pair of vertices are structurally equivalent. * Specifically, whether v1's predecessors are equal to v2's predecessors, * and same for successors.// w ww. j a v a 2 s . c o m * * @param g the graph in which the structural equivalence comparison is to take place * @param v1 the vertex to check for structural equivalence to v2 * @param v2 the vertex to check for structural equivalence to v1 */ protected boolean isStructurallyEquivalent(Graph<V, ?> g, V v1, V v2) { if (g.degree(v1) != g.degree(v2)) { return false; } Set<V> n1 = new HashSet<V>(g.getPredecessors(v1)); n1.remove(v2); n1.remove(v1); Set<V> n2 = new HashSet<V>(g.getPredecessors(v2)); n2.remove(v1); n2.remove(v2); Set<V> o1 = new HashSet<V>(g.getSuccessors(v1)); Set<V> o2 = new HashSet<V>(g.getSuccessors(v2)); o1.remove(v1); o1.remove(v2); o2.remove(v1); o2.remove(v2); // this neglects self-loops and directed edges from 1 to other boolean b = (n1.equals(n2) && o1.equals(o2)); if (!b) return b; // if there's a directed edge v1->v2 then there's a directed edge v2->v1 b &= (g.isSuccessor(v1, v2) == g.isSuccessor(v2, v1)); // self-loop check b &= (g.isSuccessor(v1, v1) == g.isSuccessor(v2, v2)); return b; }
From source file:com.linuxbox.enkive.workspace.searchFolder.SearchFolder.java
public void removeMessageId(String messageId) throws WorkspaceException { for (SearchFolderSearchResult result : results) { Set<String> folderMessageIds = result.getMessageIds(); if (folderMessageIds.remove(messageId)) { if (folderMessageIds.isEmpty()) { result.deleteSearchResult(); results.remove(result);//from ww w . j a va2 s . c o m } else { result.setMessageIds(folderMessageIds); result.saveSearchResult(); } } } }
From source file:com.sshdemo.common.report.manage.service.ChartReportService.java
@Override public Long updChartReportParameter(Long chartReportId, Parameter parameter) throws BaseException { if (chartReportId == null || chartReportId.intValue() == 0) throw new BaseException("", "????"); ChartReport chart = chartReportDAO.get(chartReportId); if (chart == null) throw new BaseException("", "???"); parameter = ParameterSetValueUtil.setParametersValue(parameter); Set<Parameter> parameters = chart.getParameters(); parameters.remove(parameter); parameters.add(parameter);/*from w ww . j a v a2s .c om*/ chart.setParameters(parameters); chartReportDAO.merge(chart); return parameter.getId(); }
From source file:org.wso2.carbon.integrator.core.handler.IntegratorSynapseHandler.java
@Override public boolean handleResponseInFlow(MessageContext messageContext) { if ("true".equals(messageContext.getProperty(MESSAGE_DISPATCHED))) { //remove the "MessageDispatched" property Set keySet = messageContext.getPropertyKeySet(); keySet.remove(MESSAGE_DISPATCHED); // In here, We are rewriting the location header which comes from the particular registered endpoints. Object headers = ((Axis2MessageContext) messageContext).getAxis2MessageContext() .getProperty("TRANSPORT_HEADERS"); if (headers instanceof TreeMap) { String locationHeader = (String) ((TreeMap) headers).get("Location"); if (locationHeader != null) { Utils.rewriteLocationHeader(locationHeader, messageContext); }//from w ww .ja v a2 s . c o m } messageContext.setTo(null); messageContext.setResponse(true); Axis2MessageContext axis2smc = (Axis2MessageContext) messageContext; org.apache.axis2.context.MessageContext axis2MessageCtx = axis2smc.getAxis2MessageContext(); axis2MessageCtx.getOperationContext().setProperty(RESPONSE_WRITTEN, "SKIP"); Axis2Sender.sendBack(messageContext); return false; } return true; }
From source file:com.espertech.esper.epl.join.table.PropertyIndexedEventTableSingle.java
private void remove(EventBean theEvent) { Object key = getKey(theEvent); Set<EventBean> events = propertyIndex.get(key); if (events == null) { return;/* ww w . ja v a 2s . co m*/ } if (!events.remove(theEvent)) { // Not an error, its possible that an old-data event is artificial (such as for statistics) and // thus did not correspond to a new-data event raised earlier. return; } if (events.isEmpty()) { propertyIndex.remove(key); } }
From source file:com.espertech.esper.epl.join.table.PropertyIndexedEventTable.java
private void remove(EventBean theEvent) { MultiKeyUntyped key = getMultiKey(theEvent); Set<EventBean> events = propertyIndex.get(key); if (events == null) { return;/* www .j a v a2s. c o m*/ } if (!events.remove(theEvent)) { // Not an error, its possible that an old-data event is artificial (such as for statistics) and // thus did not correspond to a new-data event raised earlier. return; } if (events.isEmpty()) { propertyIndex.remove(key); } }
From source file:exec.csharp.queries.RandomQueryBuilder.java
private Set<CallSite> rndSelect(int numToRemove, Set<CallSite> allSites) { if (numToRemove == 0) { return allSites; }//from w ww. j a v a 2 s . c o m Set<CallSite> shuffled = SublistSelector.shuffle(allSites); for (int i = 0; i < numToRemove; i++) { CallSite cs = shuffled.iterator().next(); shuffled.remove(cs); } return shuffled; }
From source file:com.alibaba.rocketmq.storm.spout.StreamMessageSpout.java
public void finish(String msgId) { MessageCacheItem cacheItem = (MessageCacheItem) msgCache.remove(msgId); if (cacheItem == null) { LOG.warn("Failed to get from cache {} !", msgId); return;//from w w w.ja v a 2 s.c o m } UUID batchId = cacheItem.getId(); BatchMsgsTag partTag = batchMsgsMap.get(batchId); if (partTag == null) { throw new RuntimeException("In partOffset map, no entry of " + batchId); } Set<String> msgIds = partTag.getMsgIds(); msgIds.remove(msgId); if (msgIds.size() == 0) { batchMsgsMap.remove(batchId); super.finish(batchId); } }