import java.util.Comparator;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
/**
}
};
- /**
- * Trace Comparator (uses trace start time and name)
- */
- Comparator<ITimeGraphEntry> TRACE_COMPARATOR = new Comparator<ITimeGraphEntry>() {
- @Override
- public int compare(@Nullable ITimeGraphEntry o1, @Nullable ITimeGraphEntry o2) {
- if (o1 == null || o2 == null) {
- throw new IllegalArgumentException();
- }
- int result = 0;
- if ((o1 instanceof ControlFlowEntry) && (o2 instanceof ControlFlowEntry)) {
- ITmfTrace trace1 = ((ControlFlowEntry) o1).getTrace();
- ITmfTrace trace2 = ((ControlFlowEntry) o2).getTrace();
- result = trace1.getStartTime().compareTo(trace2.getStartTime());
- if (result == 0) {
- result = trace1.getName().compareTo(trace2.getName());
- }
- }
- return result;
- }
- };
-
}