use of org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry in project tracecompass by tracecompass.
the class LamiReportViewTabPage method getEntriesIntersectingTimerange.
// ------------------------------------------------------------------------
// Util methods
// ------------------------------------------------------------------------
/**
* Util method that returns {@link LamiTableEntry} that intersects a
* {@link TmfTimeRange}.
*
* @param table
* The result table to search for entries
* @param range
* The time range itself
* @return The set of entries that intersect with the time range
*/
private static Set<Object> getEntriesIntersectingTimerange(LamiResultTable table, TmfTimeRange range) {
Set<Object> entries = new HashSet<>();
for (LamiTableEntry entry : table.getEntries()) {
LamiTimeRange lamiTimeRange = entry.getCorrespondingTimeRange();
/* Make sure the table has time ranges */
if (lamiTimeRange == null) {
return entries;
}
/* Get the timestamps from the time range */
/**
* TODO: Consider low and high limits of timestamps here.
*/
Number tsBeginValueNumber = lamiTimeRange.getBegin().getValue();
Number tsEndValueNumber = lamiTimeRange.getEnd().getValue();
if (tsBeginValueNumber == null || tsEndValueNumber == null) {
return entries;
}
/* Convert the timestamps into TMF timestamps */
ITmfTimestamp start = TmfTimestamp.fromNanos(tsBeginValueNumber.longValue());
ITmfTimestamp end = TmfTimestamp.fromNanos(tsEndValueNumber.longValue());
/* Add iff the time range intersects the the signal */
TmfTimeRange tempTimeRange = new TmfTimeRange(start, end);
if (tempTimeRange.getIntersection(range) != null) {
entries.add(entry);
}
}
return entries;
}
Aggregations