List of usage examples for java.util HashSet remove
public boolean remove(Object o)
From source file:och.comp.chats.ChatsAccService.java
public synchronized void reloadAccs() { HashSet<String> existsAccs = new HashSet<>(); read.lock();/*from w w w .j a va 2 s . c o m*/ try { existsAccs.addAll(accsById.keySet()); } finally { read.unlock(); } ArrayList<String> added = new ArrayList<>(); ArrayList<String> removed = new ArrayList<>(); ArrayList<String> updated = new ArrayList<>(); List<String> curAccs = getAccIdsNames(root); for (String accId : curAccs) { File accDir = getAccDir(accId); if (hasRemoveReqFlag(accDir)) continue; boolean exists = existsAccs.remove(accId); if (exists) { boolean isUpdated = reloadAcc(accId); if (isUpdated) updated.add(accId); } else { createAcc(accId); added.add(accId); } } removed.addAll(existsAccs); for (String accountId : existsAccs) { removeAcc(accountId); } if (added.size() > 0) log.info("loaded " + added.size() + " accs: " + added); if (updated.size() > 0) log.info("updated " + updated.size() + " accs: " + updated); if (removed.size() > 0) log.info("removed " + removed.size() + " accs: " + existsAccs); }
From source file:com.milaboratory.core.tree.SequenceTreeMapTest.java
@Test public void testNIterator() throws Exception { SequenceTreeMap<NucleotideSequence, Integer> map = new SequenceTreeMap<>(NucleotideSequence.ALPHABET); assertNull(map.put(new NucleotideSequence("attagaca"), 1)); // 1 mm assertNull(map.put(new NucleotideSequence("attacaca"), 2)); // match assertNull(map.put(new NucleotideSequence("ataacaca"), 3)); // 1 mm assertNull(map.put(new NucleotideSequence("attcgtca"), 4)); // many mm assertNull(map.put(new NucleotideSequence("atttacaca"), 5)); // 1 insertion in stretch assertNull(map.put(new NucleotideSequence("atacaca"), 6)); // 1 deletion in the "t" stretch assertNull(map.put(new NucleotideSequence("attacacta"), 7)); // 1 insertion assertNull(map.put(new NucleotideSequence("attcaca"), 8)); // 1 deletion assertNull(map.put(new NucleotideSequence("attacac"), 9)); // 1 deletion in the end assertNull(map.put(new NucleotideSequence("ttacaca"), 10)); // 1 deletion in the beginning assertNull(map.put(new NucleotideSequence("tattacaca"), 11)); // 1 insertion in the beginning assertNull(map.put(new NucleotideSequence("attacacat"), 12)); // 1 insertion in the ent assertNull(map.put(new NucleotideSequence("attacact"), 13)); // 1 mm end assertNull(map.put(new NucleotideSequence("tttacaca"), 14)); // 1 mm begin NucleotideSequence reference = new NucleotideSequence("attacaca"); SequenceTreeMap.Node<Integer> node; HashSet<Integer>[] allAsserts = new HashSet[3]; allAsserts[0] = new HashSet<>(Arrays.asList(1, 3, 13, 14)); allAsserts[1] = new HashSet<>(Arrays.asList(6, 8, 9, 10)); allAsserts[2] = new HashSet<>(Arrays.asList(5, 7, 11, 12)); for (int i = 0; i < 8; ++i) { double lastPenalty = -1.0; HashSet<Integer> asserts = new HashSet<>(); asserts.add(2);// w w w. j av a 2s . c om int[] maxMut = new int[3]; for (int j = 0; j < 3; ++j) { if (((0x1 << j) & i) != 0) { maxMut[j] = 1; asserts.addAll(allAsserts[j]); } } HashSet<Integer> asserts1 = new HashSet<>(asserts); NeighborhoodIterator ni = map.getNeighborhoodIterator(reference, 0.5, new double[] { 0.31, 0.301, 0.3001 }, maxMut, null); while ((node = ni.nextNode()) != null) { assertTrue(lastPenalty <= ni.getPenalty()); lastPenalty = ni.getPenalty(); asserts.remove(node.object); assertTrue(asserts1.contains(node.object)); } assertTrue(asserts.isEmpty()); } }
From source file:test.DynaTEST.java
/*** test000()/* w w w . j a va 2s. c o m*/ is based on the following specification in source/xml/testdb.xml. Change the xml and the test will fail. Table tableName="DbCheckTest" objectName="DbCheckNewCol" description="DbCheckTest" Column name="ID" objectName="ID" jrfImpl="IntegerColumnSpec" isPrimaryKey="true" / Column name="Field1" objectName="Field1" nullable="false" jrfImpl="DoubleColumnSpec" precision="10" default="new Double(1.2)" maxValue="new Double(6.1)" minValue="new Double(4.3)" scale="2" description="Just a test" / Column name="Field2" objectName="Field2" jrfImpl="IntegerColumnSpec" maxValue="new Integer(14)" description="Just a test" / Column name="Name" objectName="Name" jrfImpl="StringColumnSpec" size="75" nullable="true" description="Name" ListOfValues value="John"/ ListOfValues value="Marcia"/ ListOfValues value="Susan"/ /Column Column name="createDate" objectName="CreateDate" jrfImpl="DateColumnSpec" description="A date." writeOnce="true" / /Table **/ public void test000() throws Exception { DynaProperty[] props = c.getDynaProperties(); HashSet check = new HashSet(); check.add("ID"); check.add("field1"); check.add("field2"); check.add("name"); check.add("encodedKey"); check.add("createDate"); for (int i = 0; i < props.length; i++) { PersistentObjectDynaProperty dp = PersistentObjectDynaProperty.getPOProperty(props[i]); if (dp == null) continue; if (dp.getName().equals("ID")) { this.assertTrue(dp.isRequired()); this.assertNotNull(dp.getGetterSetter()); //this.assertEquals(java.lang.Integer.class,dp.getType()); this.assertEquals(int.class, dp.getType()); this.assertTrue(dp.isDbColumn()); this.assertTrue(dp.getMaxValue() == null); this.assertTrue(dp.getMinValue() == null); this.assertTrue(dp.getReadMethodName() == null); this.assertTrue(dp.getWriteMethodName() == null); this.assertTrue(dp.getListOfValues() == null); this.assertEquals(new Integer(0), dp.getDefaultValue()); this.assertTrue(dp.isWriteOnce()); check.remove("ID"); } else if (dp.getName().equals("field1")) { this.assertTrue(dp.isRequired()); //this.assertEquals(java.lang.Double.class,dp.getType()); this.assertEquals(double.class, dp.getType()); this.assertNotNull(dp.getGetterSetter()); this.assertTrue(dp.isDbColumn()); this.assertEquals(new Double(6.1), dp.getMaxValue()); this.assertEquals(new Double(4.3), dp.getMinValue()); this.assertTrue(dp.getReadMethodName() == null); this.assertTrue(dp.getWriteMethodName() == null); this.assertTrue(dp.getListOfValues() == null); this.assertEquals(new Double(1.2), dp.getDefaultValue()); this.assertTrue(dp.isWriteOnce() == false); check.remove("field1"); } else if (dp.getName().equals("field2")) { this.assertTrue(dp.isRequired()); //this.assertEquals(java.lang.Integer.class,dp.getType()); this.assertEquals(int.class, dp.getType()); this.assertNotNull(dp.getGetterSetter()); this.assertTrue(dp.isDbColumn()); this.assertEquals(new Integer(0), dp.getDefaultValue()); this.assertTrue(dp.getMinValue() == null); this.assertTrue(dp.getReadMethodName() == null); this.assertTrue(dp.getWriteMethodName() == null); this.assertTrue(dp.getListOfValues() == null); this.assertEquals(new Integer(14), dp.getMaxValue()); this.assertTrue(dp.isWriteOnce() == false); check.remove("field2"); } else if (dp.getName().equals("name")) { this.assertTrue(dp.isRequired() == false); this.assertNotNull(dp.getGetterSetter()); this.assertEquals(java.lang.String.class, dp.getType()); this.assertTrue(dp.isDbColumn()); this.assertTrue(dp.getMaxValue() == null); this.assertTrue(dp.getMinValue() == null); this.assertTrue(dp.getReadMethodName() == null); this.assertTrue(dp.getWriteMethodName() == null); this.assertNotNull(dp.getListOfValues()); this.assertTrue(dp.getDefaultValue() == null); this.assertTrue(dp.isWriteOnce() == false); check.remove("name"); // TODO handle list when generator is ready. } else if (dp.getName().equals("encodedKey")) { this.assertTrue(dp.isRequired() == false); this.assertTrue(dp.getGetterSetter() == null); this.assertEquals("getEncodedKey", dp.getReadMethodName()); this.assertNull(dp.getWriteMethodName()); this.assertEquals(java.lang.String.class, dp.getType()); this.assertTrue(dp.isDbColumn() == false); this.assertTrue(dp.getMaxValue() == null); this.assertTrue(dp.getMinValue() == null); this.assertTrue(dp.getListOfValues() == null); this.assertTrue(dp.isWriteOnce() == false); this.assertTrue(dp.getDefaultValue() == null); check.remove("encodedKey"); } else if (dp.getName().equals("createDate")) { this.assertTrue(dp.isRequired() == true); this.assertTrue(dp.getGetterSetter() != null); this.assertTrue(dp.isDbColumn()); this.assertTrue(dp.getReadMethodName() == null); this.assertTrue(dp.getWriteMethodName() == null); this.assertEquals(java.util.Date.class, dp.getType()); this.assertTrue(dp.getMinValue() == null); this.assertTrue(dp.getMaxValue() == null); this.assertTrue(dp.getListOfValues() == null); this.assertTrue(dp.isWriteOnce()); check.remove("createDate"); } } if (check.size() != 0) this.fail("class does not contain all properties. Missing: " + check); }
From source file:com.cloudera.impala.catalog.HdfsTable.java
/** * Drops the partition having the given partition spec from HdfsTable. Cleans up its * metadata from all the mappings used to speed up partition pruning/lookup. * Also updates partition column statistics. Given partitionSpec must match exactly * one partition.//from w w w . ja va2s. c o m * Returns the HdfsPartition that was dropped. If the partition does not exist, returns * null. * * Note: This method is not thread safe because it modifies the list of partitions * and the HdfsTable's partition metadata. */ public HdfsPartition dropPartition(List<TPartitionKeyValue> partitionSpec) { HdfsPartition partition = getPartitionFromThriftPartitionSpec(partitionSpec); // Check if the partition does not exist. if (partition == null || !partitions_.remove(partition)) return null; totalHdfsBytes_ -= partition.getSize(); Preconditions.checkArgument(partition.getPartitionValues().size() == numClusteringCols_); Long partitionId = partition.getId(); // Remove the partition id from the list of partition ids and other mappings. partitionIds_.remove(partitionId); partitionMap_.remove(partitionId); for (int i = 0; i < partition.getPartitionValues().size(); ++i) { ColumnStats stats = getColumns().get(i).getStats(); LiteralExpr literal = partition.getPartitionValues().get(i); // Check if this is a null literal. if (literal instanceof NullLiteral) { nullPartitionIds_.get(i).remove(partitionId); stats.setNumNulls(stats.getNumNulls() - 1); if (nullPartitionIds_.get(i).isEmpty()) { stats.setNumDistinctValues(stats.getNumDistinctValues() - 1); } continue; } HashSet<Long> partitionIds = partitionValuesMap_.get(i).get(literal); // If there are multiple partition ids corresponding to a literal, remove // only this id. Otherwise, remove the <literal, id> pair. if (partitionIds.size() > 1) partitionIds.remove(partitionId); else { partitionValuesMap_.get(i).remove(literal); stats.setNumDistinctValues(stats.getNumDistinctValues() - 1); } } return partition; }
From source file:edu.virginia.iath.snac.helpers.GeoNamesHelper.java
/** * Gets <code>max</code> next Cheshire results (in normalized XML format), in no particular order. It ignores the * first best match, only returning results 2 to max. There are no duplicates in this list. * /*from www . j a v a 2s . com*/ * @param max Maximum number of results to return * @return String of concatenated XML results, each wrapped in a place tag. */ public String getNextUniqueReturnResults(int max) { String result = ""; int i = 0; HashSet<String> uniqueResults = new HashSet<String>(); uniqueResults.addAll(results); if (results.size() > 0) uniqueResults.remove(results.get(0)); for (String res : uniqueResults) { result += "<place>" + getXMLReturnValue(res) + "</place>\n"; if (i++ > max) break; } return result; }
From source file:me.mneri.rice.Connection.java
private void initCallbacks() { // Cambi di stato on(REGISTER, event -> {//from w w w . j a v a 2 s . c o m if (mAutoJoin.size() > 0) { for (String channel : mAutoJoin) join(channel); mAutoJoin.clear(); } else { for (Conversation conversation : mConversations.values()) { if (conversation.getType() == Conversation.Type.CHANNEL) join(conversation.getName()); } } }); on(CLOSE, event -> { OutputInterfaceFactory f = OutputInterfaceFactory.instance(); //@formatter:off try { mSocket.close(); } catch (Exception ignored) { } finally { mSocket = null; } try { mInputThread.quit(); } catch (Exception ignored) { } finally { mInputThread = null; } try { f.release(mOutputInterface); } catch (Exception ignored) { } finally { mOutputInterface = null; } //@formatter:on mCapabilities.clear(); mCurrentHost = null; mHostCapabilities.clear(); mHostIrcdVersion = null; }); // Ricezione messaggi on(AUTHENTICATE, event -> { String body = mWantedNick + "\0" + mUser + "\0" + mPass; sendRawString("AUTHENTICATE " + new String(Base64.encodeBase64(body.getBytes())) + "\r\n"); }); on(AWAY, (Event event) -> { Message message = (Message) event.data; if (message.params.size() > 0) { // TODO: User is away } else { // TODO: User is returned } }); on(CAP, event -> { Message message = (Message) event.data; String sub = message.params.get(1); if (sub.equals("ACK")) { ArrayList<String> caps = new ArrayList<>(Arrays.asList(message.params.get(2).split("\\s+"))); for (String cap : caps) { if (cap.startsWith("-")) mCapabilities.remove(cap.substring(1)); else mCapabilities.add(cap.replaceAll("[-~=]", "")); } } }); on(CAP, event -> { Message message = (Message) event.data; String sub = message.params.get(1); if (mState == State.CONNECTED) { ArrayList<String> caps = new ArrayList<>(Arrays.asList(message.params.get(2).split("\\s+"))); switch (sub) { case "ACK": if (caps.contains("sasl")) sendRawString("AUTHENTICATE PLAIN\r\n"); else cap("END"); break; case "LS": mHostCapabilities.addAll(caps); HashSet<String> wanted = new HashSet<>(mWantedCapabilities); wanted.retainAll(caps); if (TextUtils.isEmpty(mPass)) wanted.remove("sasl"); if (wanted.isEmpty()) { cap("END"); } else { StringBundler requesting = new StringBundler(); for (String s : wanted) requesting.append(s).append(" "); cap("REQ", requesting.toString()); } } } }); on(ERR_NICKNAMEINUSE, new Callback() { private int mTries; @Override public void performAction(Event event) { if (mState == State.CONNECTED && mAutoNickChange) nick(mWantedNick + (++mTries)); } }); on(JOIN, event -> { Message message = (Message) event.data; User user = mUsers.get(message.nick); if (mUser == null) user = new User(message.nick, message.user, message.host); if (mCapabilities.contains("extended-join")) { user.setAccount(message.params.get(1)); user.setReal(message.params.get(2)); } String channel = message.params.get(0); }); on(MODE, event -> { Message message = (Message) event.data; String target = message.params.get(0); String specs = message.params.get(1); // Ci interessa solo la nostra user mode if (target.equals(mNick)) { char mode; boolean value = false; for (int i = 0; i < specs.length(); i++) { mode = specs.charAt(i); //@formatter:off if (mode == '+') value = true; else if (mode == '-') value = false; else if (mode != ' ') mUserMode.put(mode, value); //@formatter:on } } }); on(NICK, event -> { Message message = (Message) event.data; if (TextUtils.compareIgnoreCase(mNick, message.nick, mCaseMapping) == 0) mNick = message.params.get(0); }); on(PING, event -> { Message message = (Message) event.data; pong(message.params.get(0)); }); on(RPL_ISUPPORT, event -> { Message message = (Message) event.data; Pattern pattern = Pattern.compile("Try server (.+), port (\\d+)"); Matcher matcher = pattern.matcher(message.params.get(1)); boolean isRplBounce = matcher.find(); if (isRplBounce) { mIsupportCompilant = false; try { if (mAutoBounce) { mHost = matcher.group(1); mPort = Integer.parseInt(matcher.group(2)); emit(new Event(BOUNCE, this)); stop(); start(); } } catch (Exception ignored) { } } else { mIsupportCompilant = true; pattern = Pattern.compile("([A-Z]+)(=(\\S+))?"); for (int i = 1; i < message.params.size(); i++) { matcher = pattern.matcher(message.params.get(i)); while (matcher.find()) { String key = matcher.group(1); String value = matcher.group(3); try { switch (key) { case "CASEMAPPING": if (value.equals("ascii")) mCaseMapping = CaseMapping.ASCII; else if (value.equals("strict-rfc1459")) mCaseMapping = CaseMapping.STRICT_RFC1459; break; case "NETWORK": mNetwork = value; break; } } catch (Exception ignored) { } } } } }); on(RPL_MYINFO, event -> { Message message = (Message) event.data; mCurrentHost = message.params.get(1); mHostIrcdVersion = message.params.get(2); String userModes = message.params.get(3); String channelModes = message.params.get(4); for (int i = 0; i < userModes.length(); i++) mUserMode.put(userModes.charAt(i), false); for (int i = 0; i < channelModes.length(); i++) mAvailChannelModes.add(channelModes.charAt(i)); mState = State.REGISTERED; emit(new Event(REGISTER, this)); }); on(RPL_SASLSUCCESS, event -> { if (mState == State.CONNECTED) cap("END"); }); on(RPL_WELCOME, (Event event) -> { Message message = (Message) event.data; mNick = message.params.get(0); }); // Stato delle conversazioni on(JOIN, event -> { Message message = (Message) event.data; String target = message.params.get(0); Conversation conversation = mConversations.get(target); if (conversation == null) { conversation = new Conversation(target, mFactory); mConversations.put(target, conversation); emit(new Event(NEW_CONVERSATION, conversation)); } conversation.addUser(message.nick); }); on(new String[] { KICK, PART }, event -> { Message message = (Message) event.data; String conversationName = message.params.get(0); String target; if (message.command.equals(PART)) target = message.nick; else target = message.params.get(1); if (TextUtils.compareIgnoreCase(target, mNick, mCaseMapping) == 0) { Conversation conversation = mConversations.remove(conversationName); emit(new Event(REMOVE_CONVERSATION, conversation)); } else { Conversation conversation = mConversations.get(conversationName); if (conversation == null) { conversation = new Conversation(conversationName, mFactory); mConversations.put(conversationName, conversation); emit(new Event(NEW_CONVERSATION, conversation)); } conversation.removeUser(target); conversation.putMessage(message); } }); on(new String[] { JOIN, NOTICE, PRIVMSG }, event -> { Message message = (Message) event.data; String target = message.params.get(0); if (message.command.equals(PRIVMSG) || message.command.equals(NOTICE)) { if (mState == State.REGISTERED) { if (TextUtils.compareIgnoreCase(target, mNick, mCaseMapping) == 0) target = message.nick; } } Conversation conversation = mConversations.get(target); if (conversation == null) { conversation = new Conversation(target, mFactory); mConversations.put(target, conversation); emit(new Event(NEW_CONVERSATION, conversation)); } conversation.putMessage(message); }); on(NICK, event -> { Message message = (Message) event.data; for (Conversation conversation : mConversations.values()) { if (conversation.contains(message.nick)) { conversation.removeUser(message.nick); conversation.addUser(message.params.get(0)); conversation.putMessage(message); } } }); on(new String[] { RPL_NAMREPLY, RPL_ENDOFNAMES }, new Callback() { StringBundler sb; @Override public void performAction(Event event) { Message message = (Message) event.data; switch (message.command) { case RPL_NAMREPLY: if (sb == null) sb = new StringBundler(); sb.append(" "); sb.append(message.params.get(3)); break; case RPL_ENDOFNAMES: String target = message.params.get(1); Conversation conversation = mConversations.get(target); if (conversation == null) { conversation = new Conversation(target, mFactory); mConversations.put(target, conversation); emit(new Event(NEW_CONVERSATION, conversation)); } conversation.clearUsers(); conversation.addUsers(Arrays.asList(sb.toString().split("\\s+"))); sb = null; } } }); on(RPL_WHOREPLY, event -> { Message message = (Message) event.data; String user = message.params.get(2); String host = message.params.get(3); String server = message.params.get(4); String nick = message.params.get(5); boolean away = message.params.get(6).equals("G"); }); on(QUIT, event -> { Message message = (Message) event.data; for (Conversation conversation : mConversations.values()) { if (conversation.contains(message.nick)) { conversation.removeUser(message.nick); conversation.putMessage(message); } } }); }
From source file:net.sf.jabref.model.database.BibtexDatabase.java
/** * If the label represents a string contained in this database, returns * that string's content. Resolves references to other strings, taking * care not to follow a circular reference pattern. * If the string is undefined, returns null. *//* www . j a va2s . co m*/ private String resolveString(String label, HashSet<String> usedIds) { for (BibtexString string : bibtexStrings.values()) { //Util.pr(label+" : "+string.getName()); if (string.getName().toLowerCase().equals(label.toLowerCase())) { // First check if this string label has been resolved // earlier in this recursion. If so, we have a // circular reference, and have to stop to avoid // infinite recursion. if (usedIds.contains(string.getId())) { LOGGER.info("Stopped due to circular reference in strings: " + label); return label; } // If not, log this string's ID now. usedIds.add(string.getId()); // Ok, we found the string. Now we must make sure we // resolve any references to other strings in this one. String result = string.getContent(); result = resolveContent(result, usedIds); // Finished with recursing this branch, so we remove our // ID again: usedIds.remove(string.getId()); return result; } } // If we get to this point, the string has obviously not been defined locally. // Check if one of the standard BibTeX month strings has been used: MonthUtil.Month month = MonthUtil.getMonthByShortName(label); if (month.isValid()) { return month.fullName; } else { return null; } }
From source file:edu.ku.brc.specify.tasks.subpane.VisualQueryPanel.java
/** * Moves selected items from one list to the other. * @param srcList/* w w w. j ava 2 s . com*/ * @param srcHash * @param dstList * @param dstHash */ private void moveItems(final JList srcList, final HashSet<Integer> srcHash, final JList dstList, final HashSet<Integer> dstHash) { int inx = srcList.getSelectedIndex(); if (inx > -1) { DefaultListModel srcModel = (DefaultListModel) srcList.getModel(); DefaultListModel dstModel = (DefaultListModel) dstList.getModel(); int[] indexes = srcList.getSelectedIndices(); ArrayList<LatLonPoint> llpList = new ArrayList<LatLonPoint>(indexes.length); for (int selInx : indexes) { LatLonPoint llp = (LatLonPoint) srcModel.get(selInx); llpList.add(llp); if (!dstHash.contains(llp.getLocId())) { dstModel.addElement(llp); dstHash.add(llp.getLocId()); } } for (LatLonPoint llp : llpList) { srcModel.removeElement(llp); srcHash.remove(llp.getLocId()); } } }
From source file:nl.mpcjanssen.simpletask.Simpletask.java
private void deleteSavedFilter(String prefsName) { SharedPreferences saved_filters = getSharedPreferences("filters", MODE_PRIVATE); HashSet<String> ids = new HashSet<String>(); ids.addAll(saved_filters.getStringSet("ids", new HashSet<String>())); ids.remove(prefsName); saved_filters.edit().putStringSet("ids", ids).apply(); SharedPreferences filter_prefs = getSharedPreferences(prefsName, MODE_PRIVATE); ActiveFilter deleted_filter = new ActiveFilter(); deleted_filter.initFromPrefs(filter_prefs); filter_prefs.edit().clear().apply(); File prefs_path = new File(this.getFilesDir(), "../shared_prefs"); File prefs_xml = new File(prefs_path, prefsName + ".xml"); final boolean deleted = prefs_xml.delete(); if (!deleted) { Log.w(TAG, "Failed to delete saved filter: " + deleted_filter.getName()); }//from www . j av a2s. c o m updateRightDrawer(); }
From source file:org.lockss.scheduler.TaskRunner.java
boolean cleanupSchedule(Scheduler scheduler, boolean doDrop) { if (currentSchedule == null) { log.debug("cleanupSchedule(): currentSchedule = null"); return false; }//from w ww .j a va2s. c o m // don't do this too often if (TimeBase.msSince(lastCleanup) < minCleanupInterval) { return false; } lastCleanup = TimeBase.nowMs(); List unexpired = getUnexpiredTasks(); if (scheduler.createSchedule(unexpired)) { // no cleanup necessary, nothing pruned log.debug("cleanupSchedule(): no cleanup necessary"); return false; } HashSet remainingTasks = new HashSet(unexpired); HashSet dropped = new HashSet(); for (int ix = maxDrop; ix > 0; ix--) { SchedulableTask droppable = findDroppableTask(dropped); if (droppable == null) { log.error("Failed to cleanup schedule: " + currentSchedule + " after dropping " + dropped); return false; } if (log.isDebug3()) log.debug3("Considering dropping: " + droppable); remainingTasks.remove(droppable); dropped.add(droppable); if (scheduler.createSchedule(remainingTasks)) { log.debug3("succeeded"); if (doDrop) { for (Iterator iter = dropped.iterator(); iter.hasNext();) { SchedulableTask task = (SchedulableTask) iter.next(); log.warning("Dropped " + task); task.setDropped(); decrStats(task, STAT_WAITING); addOverrunner(task, STAT_DROPPED); } } return true; } } return false; }