diff options
author | Ulf Adams <ulfjack@google.com> | 2015-10-22 12:02:28 +0000 |
---|---|---|
committer | Kristina Chodorow <kchodorow@google.com> | 2015-10-22 15:17:29 +0000 |
commit | c708f96b4d23a1b6b03bed50013dd437ff40e92d (patch) | |
tree | 9547253098856fee4eb7ff04128f9af52439c031 /src/main/java/com/google/devtools/build/lib/events | |
parent | fac21e564c9a9fe5288431f05e4ae6b5c19d35bf (diff) |
Assert the specific type of event, not just the existence of any event.
Also remove a bunch of custom uses of EventCollector, and use the (already
existing) EventCollectionApparatus instead.
--
MOS_MIGRATED_REVID=106047665
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/events')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/events/EventCollector.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/events/EventCollector.java b/src/main/java/com/google/devtools/build/lib/events/EventCollector.java index 9efd0d9e44..b45bca2bb3 100644 --- a/src/main/java/com/google/devtools/build/lib/events/EventCollector.java +++ b/src/main/java/com/google/devtools/build/lib/events/EventCollector.java @@ -13,6 +13,7 @@ // limitations under the License. package com.google.devtools.build.lib.events; +import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import java.util.ArrayList; @@ -64,6 +65,15 @@ public class EventCollector extends AbstractEventHandler implements Iterable<Eve return collected.iterator(); } + public Iterable<Event> filtered(final EventKind eventKind) { + return Iterables.filter(collected, new Predicate<Event>() { + @Override + public boolean apply(Event event) { + return event.getKind() == eventKind; + } + }); + } + /** * Returns the number of events collected. */ |