Class SingleEntryItemCollection
- java.lang.Object
-
- org.openjdk.jmc.flightrecorder.rules.jdk.util.SingleEntryItemCollection
-
- All Implemented Interfaces:
java.lang.Iterable<IItemIterable>
,IItemCollection
final class SingleEntryItemCollection extends java.lang.Object implements IItemCollection
Implementation helper class for handling a singularIItem
as anIItemCollection
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
SingleEntryItemCollection.SingleEntryIItemIterable
private static class
SingleEntryItemCollection.SingleEntryIteratorOfIterable
-
Field Summary
Fields Modifier and Type Field Description private java.util.Set<IRange<IQuantity>>
chunkRanges
private IItem
item
private static IItemCollection
NULLCOLLECTION
private static IItemIterable
NULLITERABLE
-
Constructor Summary
Constructors Constructor Description SingleEntryItemCollection(IItem item, java.util.Set<IRange<IQuantity>> chunkRanges)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IItemCollection
apply(IItemFilter filter)
Creates a new item collection with all items in this collection that pass through the 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()
java.util.Iterator<IItemIterable>
iterator()
-
-
-
Field Detail
-
NULLCOLLECTION
private static final IItemCollection NULLCOLLECTION
-
NULLITERABLE
private static final IItemIterable NULLITERABLE
-
item
private final IItem item
-
-
Method Detail
-
iterator
public java.util.Iterator<IItemIterable> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<IItemIterable>
-
apply
public IItemCollection 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
-
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
-
hasItems
public boolean hasItems()
- Specified by:
hasItems
in interfaceIItemCollection
- Returns:
true
if the collections contains items,false
otherwise
-
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
-
-