/** * Set the configuration attribute with the specified name. Calling this with * a <code>null</code> value is equivalent to calling * <code>removeAttribute(name)</code>. * * @param name * Name of the attribute to set * @param value * Value of the attribute to set, or <code>null</code> to remove * any setting for this attribute */ @SuppressWarnings("unchecked") public void setAttribute(String name, Object value) { if (value == null) { attributes.remove(name); } else { attributes.put(name, value); } } }
/** * Clear out all entries of database with a certain name * * @param dbname * The name of the database for which we want to clear the cache or null if we want to clear it all. */ public void clear( String dbname ) { if ( dbname == null ) { cache = new Hashtable<DBCacheEntry, RowMetaInterface>(); setActive(); } else { Enumeration<DBCacheEntry> keys = cache.keys(); while ( keys.hasMoreElements() ) { DBCacheEntry entry = keys.nextElement(); if ( entry.sameDB( dbname ) ) { // Same name: remove it! cache.remove( entry ); } } } }
/** * Removes the mapping associated to the specified prefix. * * @param prefix The prefix which mapping should be removed. */ private void removeIfNeeded(String prefix) { // remove the previous mapping to the prefix if (this.prefixMapping.containsValue(prefix)) { Object key = null; for (Enumeration<String> e = this.prefixMapping.keys(); e.hasMoreElements();) { key = e.nextElement(); if (this.prefixMapping.get(key).equals(prefix)) { break; } } this.prefixMapping.remove(key); // we know key should have a value } }
while(enumeration.hasMoreElements() && (misses <= 4)) { Thread t = (Thread) enumeration.nextElement(); if(t.isAlive()) { misses++; Thread t = (Thread) v.elementAt(i); LogLog.debug("Lazy NDC removal for thread [" + t.getName() + "] ("+ ht.size() + ")."); ht.remove(t);
public static void main(String[] args) { // TODO Auto-generated method stub Hashtable siCache = new Hashtable(); siCache.put("key", "value"); siCache.put("key1", "value1"); Enumeration keys = siCache.keys(); //siCache is Hashtable while(keys.hasMoreElements()) { String k = (String) keys.nextElement(); Object v = siCache.get(k); if(true) siCache.remove(k); } System.out.println(siCache.size()); }
private boolean SSSPFinder(Object src) { Hashtable<Object, IntContainer> outedges = sources.get(src); if (outedges == null) { return true; if (outedges.size() == 0) { return true; distance.remove(src); WeightedDirectedEdge edge = edgeIt.next(); IntContainer dfrom = distance.get(edge.from); IntContainer dto = distance.get(edge.to); if (dto == null) { continue; IntContainer dist = distance.get(to); outedges.put(to, dist.dup());
/** * Remove all flags in the given Flags object from this * Flags object. * * @param f the flag to be removed */ public void remove(Flags f) { system_flags &= ~f.system_flags; // remove system flags if (f.user_flags != null) { if (user_flags == null) return; Enumeration<String> e = f.user_flags.keys(); while (e.hasMoreElements()) user_flags.remove(e.nextElement()); } }
s_logger.debug("connMap=" + connMap); Enumeration<String> e = connMap.keys(); while (e.hasMoreElements()) { String key; ConsoleProxyClient client; key = e.nextElement(); client = connMap.get(key); connMap.remove(key); bReportLoad = true;
if (f.user_flags != null) { Enumeration<String> e = user_flags.keys(); while (e.hasMoreElements()) { String key = e.nextElement(); if (!f.user_flags.containsKey(key)) { user_flags.remove(key); changed = true; changed = user_flags.size() > 0; user_flags = null;
/** * Update references to a renamed job in the fingerprint */ public synchronized void rename(String oldName, String newName) throws IOException { boolean touched = false; if (original != null) { if (original.getName().equals(oldName)) { original.setName(newName); touched = true; } } if (usages != null) { RangeSet r = usages.get(oldName); if (r != null) { usages.put(newName, r); usages.remove(oldName); touched = true; } } if (touched) { save(); } }
/** * Set the configuration attribute with the specified name. Calling this with * a <code>null</code> value is equivalent to calling * <code>removeAttribute(name)</code>. * * @param name * Name of the attribute to set * @param value * Value of the attribute to set, or <code>null</code> to remove * any setting for this attribute */ @SuppressWarnings("unchecked") public void setAttribute(String name, Object value) { if (value == null) { attributes.remove(name); } else { attributes.put(name, value); } } }
public void killNode(Object tokill) { if (!this.vertexes.contains(tokill)) { return; } this.makeShortestPathGraph(); List<Object> sourceList = new ArrayList<Object>(sources.keySet()); Iterator<Object> srcIt = sourceList.iterator(); while (srcIt.hasNext()) { Object src = srcIt.next(); Hashtable targets = sources.get(src); /* delete the in edge */ targets.remove(tokill); if (targets.size() == 0) { sources.remove(src); } } sources.remove(tokill); this.makeShortestPathGraph(); }
@Override public synchronized List getRenderingInstructions(String template) { if (template == null) { return Collections.EMPTY_LIST; } List l = (List) templatesCache.get(template); if (l == null) { l = calculateInstructions(template); if (templatesCache.size() > 50) templatesCache.remove(templatesCache.keySet().iterator().next()); templatesCache.put(template, l); } return l; }