Skip to content

Commit

Permalink
tmf: Simplify repeated checks by extracting values
Browse files Browse the repository at this point in the history
Improves legibility too.

Change-Id: Ieab109177e214d4f2340429ac95479a63c813fdd
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/205778
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
  • Loading branch information
MatthewKhouzam committed Feb 6, 2024
1 parent 9ffef04 commit e7c78b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Expand Up @@ -215,10 +215,11 @@ public String getName() {
@Override
protected boolean buildAnalysisSegments(ISegmentStore<ISegment> segmentStore, IProgressMonitor monitor) throws TmfAnalysisException {
try (ScopeLog scope = new ScopeLog(LOGGER, Level.FINER, "SegmentStoreAnalysisModule#buildAnalysisSegment")) { //$NON-NLS-1$
if (fProviders.size() == 0) {
int size = fProviders.size();
if (size == 0) {
return false;
}
if (fProviders.size() == 1) {
if (size == 1) {
segmentStore.addAll(Objects.requireNonNull(fProviders.get(fProviders.keySet().iterator().next())).getSegmentStore());
} else {
for (Entry<String, ISegmentStoreProvider> providerEntry : fProviders.entrySet()) {
Expand Down
Expand Up @@ -507,9 +507,10 @@ protected List<ITimeEvent> createTimeEvents(TimeGraphEntry entry, List<ITimeGrap
if (prev != null) {
long prevEnd = prev.getTime() + prev.getDuration();
ViewFilterDialog viewFilterDialog = getViewFilterDialog();
if (prevEnd < event.getTime() && (viewFilterDialog == null || !viewFilterDialog.hasActiveSavedFilters())) {
long duration = event.getTime() - prevEnd;
if (duration > 0 && (viewFilterDialog == null || !viewFilterDialog.hasActiveSavedFilters())) {
// fill in the gap.
TimeEvent timeEvent = new TimeEvent(entry, prevEnd, event.getTime() - prevEnd);
TimeEvent timeEvent = new TimeEvent(entry, prevEnd, duration);
if (viewFilterDialog != null && viewFilterDialog.isFilterActive()) {
timeEvent.setProperty(CoreFilterProperty.DIMMED, true);
}
Expand Down

0 comments on commit e7c78b9

Please sign in to comment.