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 ofIItemCollection
usingIItemIterable
iterators. 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 class
EventCollection.EventTypeEntry
-
Field Summary
Fields Modifier and Type Field Description private java.util.ArrayList<EventCollection.EventTypeEntry>
items
private java.util.Set<IType<IItem>>
types
-
Constructor Summary
Constructors Modifier Constructor Description private
EventCollection(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)
EventCollection
apply(IItemFilter filter)
Creates a new item collection with all items in this collection that pass through the filter.(package private) static IItemCollection
build(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.boolean
hasItems()
private static boolean
isFiltered(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:IItemCollection
Creates 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:
apply
in 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:
iterator
in interfacejava.lang.Iterable<IItemIterable>
-
hasItems
public boolean hasItems()
- Specified by:
hasItems
in interfaceIItemCollection
- Returns:
true
if the collections contains items,false
otherwise
-
getAggregate
public <V,C extends IItemConsumer<C>> V getAggregate(IAggregator<V,C> aggregator)
Description copied from interface:IItemCollection
Calculates an aggregated value for the items in this collection.- Specified by:
getAggregate
in 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)
-
-