Created
July 13, 2011 03:42
-
-
Save mikebrock/1079667 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean processAll() { | |
int start; | |
// brute force FTW | |
do { | |
start = processingEntries.size(); | |
List<ProcessingEntry> toRun = new ArrayList<ProcessingEntry>(processingEntries); | |
for (ProcessingEntry<?> pEntry : toRun) { | |
if (pEntry.processAllDelegates()) { | |
processingEntries.remove(pEntry); | |
} | |
} | |
} while (!processingEntries.isEmpty() && processingEntries.size() < start); | |
// aww man, something's screwed. | |
if (!processingEntries.isEmpty()) { | |
// throw a meaningless exception | |
throw new RuntimeException("unresolved dependences: " + processingEntries); | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment