Class DefaultIItemResultSet
- java.lang.Object
-
- org.openjdk.jmc.flightrecorder.rules.jdk.util.DefaultIItemResultSet
-
- All Implemented Interfaces:
IItemResultSet
final class DefaultIItemResultSet extends java.lang.Object implements IItemResultSet
The default implementation of anIItemResultSet.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<IAggregator<?,?>>aggregatorsprivate java.util.List<IAttribute<?>>attributesprivate intcursorprivate java.util.ArrayList<java.lang.Object[]>dataprivate java.util.Map<java.lang.String,ColumnInfo>infoprivate IItemQueryquery
-
Constructor Summary
Constructors Constructor Description DefaultIItemResultSet(IItemCollection items, IItemQuery query)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcalculateData(IItemCollection input)java.util.Map<java.lang.String,ColumnInfo>getColumnMetadata()Returns the column metadata for the result set.private static java.lang.ObjectgetFirstNonNull(IItemCollection items, IAttribute<?> attribute)Returns the first encountered non-null attribute value, or null if no non-null value could be found.private intgetNoOfColumns()IItemQuerygetQuery()Returns the query used to create the result set.java.lang.ObjectgetValue(int column)Returns the value for the specified column, at the current row.private voidinitializeMetadata()private java.lang.Object[]newRow()booleannext()Advances the cursor to the next row in the result set.
-
-
-
Field Detail
-
query
private final IItemQuery query
-
attributes
private final java.util.List<IAttribute<?>> attributes
-
aggregators
private final java.util.List<IAggregator<?,?>> aggregators
-
info
private final java.util.Map<java.lang.String,ColumnInfo> info
-
data
private final java.util.ArrayList<java.lang.Object[]> data
-
cursor
private int cursor
-
-
Constructor Detail
-
DefaultIItemResultSet
DefaultIItemResultSet(IItemCollection items, IItemQuery query)
-
-
Method Detail
-
calculateData
private void calculateData(IItemCollection input)
-
getFirstNonNull
private static java.lang.Object getFirstNonNull(IItemCollection items, IAttribute<?> attribute)
Returns the first encountered non-null attribute value, or null if no non-null value could be found.- Parameters:
items- the items to search.attribute- the attribute to look for.- Returns:
- the first value found.
-
newRow
private java.lang.Object[] newRow()
-
initializeMetadata
private void initializeMetadata()
-
getQuery
public IItemQuery getQuery()
Description copied from interface:IItemResultSetReturns the query used to create the result set.- Specified by:
getQueryin interfaceIItemResultSet- Returns:
- the query used to create the result set.
-
getValue
public java.lang.Object getValue(int column) throws ItemResultSetExceptionDescription copied from interface:IItemResultSetReturns the value for the specified column, at the current row.- Specified by:
getValuein interfaceIItemResultSet- Parameters:
column- the column for which to return the value.- Returns:
- value for the specified column, at the current row.
- Throws:
ItemResultSetException- if there was a problem reading the value, such as the cursor not being at a value, the column not existing etc.
-
getNoOfColumns
private int getNoOfColumns()
-
getColumnMetadata
public java.util.Map<java.lang.String,ColumnInfo> getColumnMetadata()
Description copied from interface:IItemResultSetReturns the column metadata for the result set. Useful for finding out what column an attribute or an aggregator is mapping to.- Specified by:
getColumnMetadatain interfaceIItemResultSet- Returns:
- the column metadata.
-
next
public boolean next()
Description copied from interface:IItemResultSetAdvances the cursor to the next row in the result set. Returns true if there is still more rows, and false if the end has been reached.- Specified by:
nextin interfaceIItemResultSet- Returns:
- true if there is still more rows, and false if the end has been reached.
-
-