analysis.lami: correctly handle Number (double, long etc.) type graphing
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.lami.core / src / org / eclipse / tracecompass / internal / provisional / analysis / lami / core / aspect / LamiIRQNameAspect.java
CommitLineData
4208b510
AM
1/*******************************************************************************
2 * Copyright (c) 2016 EfficiOS Inc., Philippe Proulx
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
9
10package org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect;
11
12import java.util.Comparator;
13
14import org.eclipse.jdt.annotation.Nullable;
15import org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry;
16import org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiData;
17import org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiIRQ;
18
19/**
20 * Aspect for the IRQ handler names.
21 *
22 * This resolves the interrupt handler name, (like i915) from a given table
23 * entry.
24 *
25 * @author Philippe Proulx
26 */
27public class LamiIRQNameAspect extends LamiTableEntryAspect {
28
29 private final int fColIndex;
30
31 /**
32 * Constructor
33 *
34 * @param colName
35 * Column name
36 * @param colIndex
37 * Column index
38 */
39 public LamiIRQNameAspect(String colName, int colIndex) {
40 super(colName + " (" + Messages.LamiAspect_Name +')', null); //$NON-NLS-1$
41 fColIndex = colIndex;
42 }
43
44 @Override
45 public boolean isContinuous() {
46 return false;
47 }
48
49 @Override
50 public boolean isTimeStamp() {
51 return false;
52 }
53
54 @Override
55 public @Nullable String resolveString(LamiTableEntry entry) {
56 LamiData data = entry.getValue(fColIndex);
57 if (data instanceof LamiIRQ) {
58 return ((LamiIRQ) data).getName();
59 }
60 /* Could be null, unknown, etc. */
61 return data.toString();
62 }
63
64 @Override
5b973e7c 65 public @Nullable Number resolveNumber(LamiTableEntry entry) {
4208b510
AM
66 return null;
67 }
68
69 @Override
70 public Comparator<LamiTableEntry> getComparator() {
71 return (o1, o2) -> {
72 String s1 = resolveString(o1);
73 String s2 = resolveString(o2);
74
5b973e7c 75 if (s1 == null && s2 == null) {
4208b510
AM
76 return 0;
77 }
5b973e7c
JR
78 if (s1 == null) {
79 return 1;
80 }
81
82 if (s2 == null) {
83 return -1;
84 }
4208b510
AM
85
86 return s1.compareTo(s2);
87 };
88 }
89
90}
This page took 0.028011 seconds and 5 git commands to generate.