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 / types / LamiIRQ.java
1 /*******************************************************************************
2 * Copyright (c) 2015, 2016 EfficiOS Inc., Alexandre Montplaisir
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
10 package org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types;
11
12 import org.eclipse.jdt.annotation.Nullable;
13
14 /**
15 * Lami IRQ data type.
16 *
17 * @author Alexandre Montplaisir
18 */
19 public class LamiIRQ extends LamiData {
20
21 /**
22 * IRQ type
23 */
24 public enum Type {
25 /** Hardware IRQ */
26 HARD,
27 /** Software IRQ */
28 SOFT
29 }
30
31 private final Type fType;
32 private final int fNumber;
33 private final @Nullable String fName;
34
35 /**
36 * Constructor
37 *
38 * @param irqType
39 * IRQ type
40 * @param nb
41 * IRQ number
42 * @param name
43 * IRQ name, null if not available
44 */
45 public LamiIRQ(Type irqType, int nb, @Nullable String name) {
46 fType = irqType;
47 fNumber = nb;
48 fName = name;
49 }
50
51 /**
52 * Get this IRQ's name. May be null if unavailable.
53 *
54 * @return The IRQ name
55 */
56 public @Nullable String getName() {
57 return fName;
58 }
59
60 /**
61 * Get this IRQ's type
62 *
63 * @return The IRQ type
64 */
65 public Type getType() {
66 return fType;
67 }
68
69 /**
70 * Get this IRQ's number.
71 *
72 * @return The IRQ number
73 */
74 public Integer getNumber() {
75 return fNumber;
76 }
77
78 @Override
79 public @Nullable String toString() {
80 StringBuilder sb = new StringBuilder();
81 switch (fType) {
82 case SOFT:
83 sb.append(Messages.LamiIRQ_SoftIRQ).append(' ');
84 break;
85 case HARD:
86 default:
87 sb.append(Messages.LamiIRQ_HardwareIRQ).append(' ');
88 break;
89 }
90
91 sb.append(String.valueOf(fNumber));
92
93 if (fName != null) {
94 sb.append(" (" + fName + ')'); //$NON-NLS-1$
95 }
96 return sb.toString();
97 }
98 }
This page took 0.032242 seconds and 5 git commands to generate.