Package org.openjdk.jmc.flightrecorder
Class EventCollection
- java.lang.Object
-
- org.openjdk.jmc.flightrecorder.EventCollection
-
- All Implemented Interfaces:
java.lang.Iterable<IItemIterable>,IItemCollection
class EventCollection extends java.lang.Object implements IItemCollection
Java 1.7 based implementation ofIItemCollectionusingIItemIterableiterators. This class is only intended to be used as an IItemCollection outside of the usage inJfrLoaderToolkit.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classEventCollection.EventTypeEntry
-
Field Summary
Fields Modifier and Type Field Description private java.util.ArrayList<EventCollection.EventTypeEntry>itemsprivate java.util.Set<IType<IItem>>types
-
Constructor Summary
Constructors Modifier Constructor Description privateEventCollection(java.util.ArrayList<EventCollection.EventTypeEntry> items)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static <V,C extends IItemConsumer<C>>
Vaggregate(IAggregator<V,C> aggregator, java.util.Iterator<? extends IItemIterable> items)EventCollectionapply(IItemFilter filter)Creates a new item collection with all items in this collection that pass through the filter.(package private) static IItemCollectionbuild(EventArray[] events)private static java.util.Iterator<IItem>buildIterator(IItem[] array, IPredicate<? super IItem> filter)<V,C extends IItemConsumer<C>>
VgetAggregate(IAggregator<V,C> aggregator)Calculates an aggregated value for the items in this collection.booleanhasItems()private static booleanisFiltered(IPredicate<?> filter)java.util.Iterator<IItemIterable>iterator()
-
-
-
Field Detail
-
items
private final java.util.ArrayList<EventCollection.EventTypeEntry> items
-
-
Constructor Detail
-
EventCollection
private EventCollection(java.util.ArrayList<EventCollection.EventTypeEntry> items)
-
-
Method Detail
-
build
static IItemCollection build(EventArray[] events)
-
apply
public EventCollection apply(IItemFilter filter)
Description copied from interface:IItemCollectionCreates a new item collection with all items in this collection that pass through the filter. The collection may be eagerly or lazily evaluated.- Specified by:
applyin interfaceIItemCollection- Parameters:
filter- the filter to use when selecting items for the new collection- Returns:
- a new collection of items
-
buildIterator
private static java.util.Iterator<IItem> buildIterator(IItem[] array, IPredicate<? super IItem> filter)
-
isFiltered
private static boolean isFiltered(IPredicate<?> filter)
-
iterator
public java.util.Iterator<IItemIterable> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<IItemIterable>
-
hasItems
public boolean hasItems()
- Specified by:
hasItemsin interfaceIItemCollection- Returns:
trueif the collections contains items,falseotherwise
-
getAggregate
public <V,C extends IItemConsumer<C>> V getAggregate(IAggregator<V,C> aggregator)
Description copied from interface:IItemCollectionCalculates an aggregated value for the items in this collection.- Specified by:
getAggregatein interfaceIItemCollection- Type Parameters:
V- aggregate result value typeC- Item consumer type. SeeIAggregator.- Returns:
- the aggregated value
-
aggregate
private static <V,C extends IItemConsumer<C>> V aggregate(IAggregator<V,C> aggregator, java.util.Iterator<? extends IItemIterable> items)
-
-