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.Set<IRange<IQuantity>>
chunkRanges
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, java.util.Set<IRange<IQuantity>> chunkRanges)
-
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(EventArrays 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.java.util.Set<IRange<IQuantity>>
getTimeRanges()
Returns a set of IRange representations of the time ranges represented by this item 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, java.util.Set<IRange<IQuantity>> chunkRanges)
-
-
Method Detail
-
build
static IItemCollection build(EventArrays 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)
-
getTimeRanges
public java.util.Set<IRange<IQuantity>> getTimeRanges()
Description copied from interface:IItemCollection
Returns a set of IRange representations of the time ranges represented by this item collection. This set is not affected by any filtering operations on the item collection since its use is to show the time ranges in which events could possibly have been occurred.- Specified by:
getTimeRanges
in interfaceIItemCollection
- Returns:
- a set of IRange objects representing the time ranges of represented by this IItemCollection
-
-