List of usage examples for java.util HashMap remove
public V remove(Object key)
From source file:org.rhwlab.BHCnotused.ThreadedAlgorithm.java
@Override public void run() { while (clusters.size() > 1) { System.out.printf("\n%d Clusters\n", clusters.size()); Cluster T = maximumRCluster();//www . j ava2 s. c o m if (T == null) { return; } T.printCluster(System.out); // System.out.printf("size=%d,dpm=%e,like=%e,pi=%f,pi*like=%e,r=%.20f,d=%s,Gam=%s,f=%s,d2=%s\n", T.data.getN(),T.dpm,T.data.likelihood(),T.pi,T.pi*T.data.likelihood(),T.r,T.d,T.gammaN,T.f,T.d2); // remove the children of the max r pair pairs.remove(T.left); pairs.remove(T.right); for (HashMap<Cluster, Cluster> map : pairs.values()) { map.remove(T.left); map.remove(T.right); } clusters.remove(T.left); clusters.remove(T.right); // make new pairs with all the clusters HashMap<Cluster, Cluster> map = new HashMap<>(); MergeAction merge = new MergeAction(clusters, T, 0, clusters.size() - 1, map); ForkJoinPool pool = new ForkJoinPool(); pool.invoke(merge); pairs.put(T, map); clusters.add(T); } }
From source file:org.duracloud.syncoptimize.config.SyncOptimizeConfigParserTest.java
private void removeArgFailTest(SyncOptimizeConfigParser retConfigParser, HashMap<String, String> argsMap, String arg, String failMsg) { HashMap<String, String> cloneMap = (HashMap<String, String>) argsMap.clone(); cloneMap.remove(arg); try {/* w w w. j ava 2 s .c o m*/ retConfigParser.processOptions(mapToArray(cloneMap)); fail(failMsg); } catch (ParseException e) { assertNotNull(e); } }
From source file:org.hfoss.posit.android.web.Communicator.java
/** * cleanup the item key,value pairs so that we can receive and save to the * internal database// w w w . j a v a 2s .c o m * * @param rMap */ public static void cleanupOnReceive(HashMap<String, Object> rMap) { rMap.put(PositDbHelper.FINDS_SYNCED, PositDbHelper.FIND_IS_SYNCED); rMap.put(PositDbHelper.FINDS_GUID, rMap.get("guid")); // rMap.put(PositDbHelper.FINDS_GUID, rMap.get("guid")); rMap.put(PositDbHelper.FINDS_PROJECT_ID, projectId); if (rMap.containsKey("add_time")) { rMap.put(PositDbHelper.FINDS_TIME, rMap.get("add_time")); rMap.remove("add_time"); } if (rMap.containsKey("images")) { if (Utils.debug) Log.d(TAG, "contains image key"); rMap.put(PositDbHelper.PHOTOS_IMAGE_URI, rMap.get("images")); rMap.remove("images"); } }
From source file:cr.ac.siua.tec.services.impl.RTServiceImpl.java
/** * Builds a string with the structure needed to post a new ticket to RT REST API. *///from w ww .jav a 2 s .co m public String getTicketParamsString(HashMap<String, String> formValues) { formValues.remove("g-recaptcha-response"); StringBuilder sb = new StringBuilder(); //Manually appends the queue, subject and requestor fields. sb.append("Queue: " + formValues.get("Queue") + "\n"); sb.append("Subject: Solicitado por " + formValues.get("RequestorName") + "\n"); sb.append("Requestor: " + formValues.get("Requestor") + "\n"); formValues.remove("Queue"); formValues.remove("Requestor"); formValues.remove("RequestorName"); //Iterates through all custom fields. String fieldName, fieldValue; for (Map.Entry<String, String> entry : formValues.entrySet()) { fieldName = entry.getKey(); fieldValue = entry.getValue(); String lines[] = fieldValue.split("\n"); if (lines.length > 1) { fieldValue = ""; for (String line : lines) fieldValue += " " + line + "\n"; } sb.append("CF-" + fieldName + ": " + fieldValue + "\n"); } return sb.toString(); }
From source file:org.rhwlab.BHCnotused.Algorithm.java
@Override public void run() { while (clusters.size() > 1) { System.out.printf("\n%d Clusters\n", clusters.size()); Cluster T = maximumRCluster();/*from w w w .j a va 2 s. com*/ if (T == null) { return; } if (T == null || T.left == null || T.right == null) { int auishdfius = 0; } T.printCluster(System.out); // System.out.printf("size=%d,dpm=%e,like=%e,pi=%f,pi*like=%e,r=%.20f,d=%s,Gam=%s,f=%s,d2=%s\n", T.data.getN(),T.dpm,T.data.likelihood(),T.pi,T.pi*T.data.likelihood(),T.r,T.d,T.gammaN,T.f,T.d2); // remove the children of the max r pair pairs.remove(T.left); pairs.remove(T.right); for (HashMap<Cluster, Cluster> map : pairs.values()) { map.remove(T.left); map.remove(T.right); } clusters.remove(T.left); clusters.remove(T.right); // make new pairs with all the clusters HashMap<Cluster, Cluster> map = new HashMap<>(); for (Cluster cl : clusters) { Cluster Tcl = new Cluster(T, cl); map.put(cl, Tcl); } pairs.put(T, map); clusters.add(T); } int asdsadf = 0; }
From source file:nl.b3p.kaartenbalie.service.requesthandler.ProxyRequestHandler.java
/** * Processes the parameters and creates the specified urls from the given parameters. * Each url will be used to recieve the data from the ServiceProvider this url is refering to. * * @param dw DataWrapper which contains all information that has to be sent to the client * @param user User the user which invoked the request * * @throws Exception// ww w . j a v a 2 s . c om * @throws IOException */ public void getRequest(DataWrapper dw, User user) throws IOException, Exception { Integer[] orgIds = user.getOrganizationIds(); OGCRequest ogcrequest = dw.getOgcrequest(); String spInUrl = ogcrequest.getServiceProviderName(); String[] la = ogcrequest.getParameter(OGCConstants.WMS_PARAM_LAYER).split(","); List<LayerSummary> lsl = LayerSummary.createLayerSummaryList(Arrays.asList(la), spInUrl, (spInUrl == null)); if (lsl == null || lsl.size() != 1) { log.error("Only one layer for proxy."); throw new Exception(KBConfiguration.KB_PROXY_EXECPTION); } List spUrls = getServiceProviderURLS(lsl, orgIds, false, dw, false); if (spUrls == null || spUrls.size() != 1) { log.error("Only one layer for proxy."); throw new Exception(KBConfiguration.KB_PROXY_EXECPTION); } SpLayerSummary spInfo = (SpLayerSummary) spUrls.get(0); if (spInfo == null) { log.error("No urls found!"); throw new Exception(KBConfiguration.KB_PROXY_EXECPTION); } B3PCredentials credentials = new B3PCredentials(); credentials.setUserName(spInfo.getUsername()); credentials.setPassword(spInfo.getPassword()); String decodedUrl = ogcrequest.getParameter(OGCConstants.PROXY_URL); HashMap<String, String> extraParameter = ogcrequest.getNonOGCParameters(); extraParameter.remove(OGCConstants.PROXY_URL); if (decodedUrl == null || decodedUrl.length() == 0) { log.error(KBConfiguration.KB_PROXY_EXECPTION); throw new Exception(KBConfiguration.KB_PROXY_EXECPTION); } String encodedUrl = URLEncoder.encode(decodedUrl); String purl = KBCrypter.decryptText(encodedUrl); OGCRequest proxyrequest = new OGCRequest(purl); for (Map.Entry<String, String> m : extraParameter.entrySet()) { proxyrequest.addOrReplaceParameter(m.getKey(), m.getValue()); } String proxyUrl = proxyrequest.getUrl(); ServiceProviderRequest proxyWrapper = new ServiceProviderRequest(); proxyWrapper.setProviderRequestURI(proxyUrl); proxyWrapper.setServiceName(dw.getOgcrequest().getServiceProviderName()); proxyWrapper.setCredentials(credentials); ArrayList urlWrapper = new ArrayList(); urlWrapper.add(proxyWrapper); getOnlineData(dw, urlWrapper, false, KBConfiguration.KB_PROXY); }
From source file:org.duracloud.retrieval.config.RetrievalToolConfigParserTest.java
private void removeArgFailTest(RetrievalToolConfigParser retConfigParser, HashMap<String, String> argsMap, String arg, String failMsg) { HashMap<String, String> cloneMap = (HashMap<String, String>) argsMap.clone(); cloneMap.remove(arg); try {//ww w .j av a 2 s. co m retConfigParser.processOptions(mapToArray(cloneMap)); fail(failMsg); } catch (ParseException e) { assertNotNull(e); } }
From source file:com.github.chenxiaolong.dualbootpatcher.appsharing.AppSharingService.java
private void onPackageRemoved(final String pkg) { RomInformation info;/*from www . j av a 2 s . c o m*/ MbtoolConnection conn = null; try { conn = new MbtoolConnection(this); MbtoolInterface iface = conn.getInterface(); info = RomUtils.getCurrentRom(this, iface); } catch (Exception e) { Log.e(TAG, "Failed to determine current ROM. App sharing status was NOT updated", e); return; } finally { IOUtils.closeQuietly(conn); } if (info == null) { Log.e(TAG, "Failed to determine current ROM. App sharing status was NOT updated"); return; } // Unshare package if explicitly removed. This only exists to keep the config file clean. // Mbtool will not touch any app that's not listed in the package database. RomConfig config = RomConfig.getConfig(info.getConfigPath()); HashMap<String, SharedItems> sharedPkgs = config.getIndivAppSharingPackages(); if (sharedPkgs.containsKey(pkg)) { sharedPkgs.remove(pkg); config.setIndivAppSharingPackages(sharedPkgs); config.apply(); new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { String message = getString(R.string.indiv_app_sharing_app_no_longer_shared); Toast.makeText(AppSharingService.this, String.format(message, pkg), Toast.LENGTH_LONG).show(); } }); } }
From source file:se.vgregion.service.innovationsslussen.ldap.TextFrag.java
@SuppressWarnings("unchecked") @Override// ww w .jav a2 s . c o m public String toString() { try { if (toStringRunning) { return " recursive call to " + getClass().getSimpleName() + ".toString()"; } toStringRunning = true; HashMap hm = new HashMap(new BeanMap(this)); hm.remove("class"); return hm.toString(); } finally { toStringRunning = false; } }
From source file:org.apache.sysml.runtime.instructions.gpu.context.GPULazyCudaFreeMemoryManager.java
/** * Remove a specific pointer in the given hashmap * /*from w w w.j av a 2 s .c om*/ * @param hm hashmap of size, pointers * @param size size in bytes * @param ptr pointer to be removed */ private void remove(HashMap<Long, Set<Pointer>> hm, long size, Pointer ptr) { hm.get(size).remove(ptr); if (hm.get(size).isEmpty()) hm.remove(size); }