tmf: Add generics to ITmfEventAspect
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / event / aspect / TmfCpuAspect.java
1 /*******************************************************************************
2 * Copyright (c) 2014, 2015 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are made
5 * 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 * Contributors:
10 * Alexandre Montplaisir - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.tracecompass.tmf.core.event.aspect;
14
15 import org.eclipse.jdt.annotation.Nullable;
16 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
17
18 /**
19 * Event aspect representing the CPU of a trace event. Trace types that do have
20 * the notion of CPU can use this to expose it in their traces.
21 *
22 * TODO Move to an eventualy kernel-trace-specific plugin.
23 *
24 * @author Alexandre Montplaisir
25 */
26 public abstract class TmfCpuAspect implements ITmfEventAspect<Integer> {
27
28 @Override
29 public final String getName() {
30 return Messages.getMessage(Messages.AspectName_CPU);
31 }
32
33 @Override
34 public final String getHelpText() {
35 return Messages.getMessage(Messages.AspectHelpText_CPU);
36 }
37
38 /**
39 * Returns the CPU number of the CPU on which this event was executed or
40 * {@code null} if the CPU is not available for an event.
41 */
42 @Override
43 public abstract @Nullable Integer resolve(ITmfEvent event);
44
45 @Override
46 public boolean equals(@Nullable Object other) {
47 /*
48 * Consider all sub-instance of this type "equal", so that they get
49 * merged in a single CPU column/aspect.
50 */
51 if (other instanceof TmfCpuAspect) {
52 return true;
53 }
54 return false;
55 }
56
57 @Override
58 public int hashCode() {
59 return getName().hashCode();
60 }
61 }
This page took 0.049823 seconds and 5 git commands to generate.