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<?,?>>
aggregators
private java.util.List<IAttribute<?>>
attributes
private int
cursor
private java.util.ArrayList<java.lang.Object[]>
data
private java.util.Map<java.lang.String,ColumnInfo>
info
private IItemQuery
query
-
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 void
calculateData(IItemCollection input)
java.util.Map<java.lang.String,ColumnInfo>
getColumnMetadata()
Returns the column metadata for the result set.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.private int
getNoOfColumns()
IItemQuery
getQuery()
Returns the query used to create the result set.java.lang.Object
getValue(int column)
Returns the value for the specified column, at the current row.private void
initializeMetadata()
private java.lang.Object[]
newRow()
boolean
next()
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:IItemResultSet
Returns the query used to create the result set.- Specified by:
getQuery
in interfaceIItemResultSet
- Returns:
- the query used to create the result set.
-
getValue
public java.lang.Object getValue(int column) throws ItemResultSetException
Description copied from interface:IItemResultSet
Returns the value for the specified column, at the current row.- Specified by:
getValue
in 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:IItemResultSet
Returns the column metadata for the result set. Useful for finding out what column an attribute or an aggregator is mapping to.- Specified by:
getColumnMetadata
in interfaceIItemResultSet
- Returns:
- the column metadata.
-
next
public boolean next()
Description copied from interface:IItemResultSet
Advances 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:
next
in interfaceIItemResultSet
- Returns:
- true if there is still more rows, and false if the end has been reached.
-
-