Commit | Line | Data |
---|---|---|
360bba4a BH |
1 | /******************************************************************************* |
2 | * Copyright (c) 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 | ||
10 | package org.eclipse.tracecompass.tmf.core.segment; | |
11 | ||
6ad9d1cb BH |
12 | import java.util.Comparator; |
13 | ||
360bba4a BH |
14 | import org.eclipse.jdt.annotation.Nullable; |
15 | import org.eclipse.tracecompass.segmentstore.core.ISegment; | |
16 | ||
17 | /** | |
18 | * An aspect is a piece of information that can be extracted, directly or | |
19 | * indirectly, from a segment {@link ISegment}. | |
20 | * | |
21 | * The aspect can then be used to populate table columns, to filter | |
22 | * on to only keep certain segments, to plot XY charts, etc. | |
23 | * | |
24 | * Inspired by ITmfEventAspect implementation. | |
25 | * | |
26 | * @author Bernd Hufmann | |
27 | * @since 2.0 | |
28 | */ | |
29 | public interface ISegmentAspect { | |
30 | ||
31 | /** | |
32 | * Static definition of an empty string. | |
33 | */ | |
34 | String EMPTY_STRING = ""; //$NON-NLS-1$ | |
35 | ||
36 | /** | |
37 | * Get the name of this aspect. This name will be user-visible and, as such, | |
38 | * should be localized. | |
39 | * | |
40 | * @return The name of this aspect. | |
41 | */ | |
42 | String getName(); | |
43 | ||
44 | /** | |
45 | * Return a descriptive help text of what this aspect does. This could then | |
46 | * be shown in tooltip or in option dialogs for instance. It should also be | |
47 | * localized. | |
48 | * | |
49 | * @return The help text of this aspect | |
50 | */ | |
51 | String getHelpText(); | |
52 | ||
6ad9d1cb BH |
53 | /** |
54 | * Gets the comparator to be used when comparing to segments. | |
55 | * @return the comparator to be used when comparing to segments | |
56 | */ | |
57 | @Nullable Comparator<?> getComparator(); | |
58 | ||
360bba4a BH |
59 | /** |
60 | * The "functor" representing this aspect. Basically, what to do for an | |
61 | * segment that is passed in parameter. | |
62 | * | |
63 | * Users also can (and should) provide a more specific return type than | |
64 | * Object. | |
65 | * | |
66 | * @param segment | |
67 | * The segment to process | |
68 | * @return The resulting information for this segment. | |
69 | */ | |
70 | @Nullable Object resolve(ISegment segment); | |
6ad9d1cb | 71 | |
360bba4a | 72 | } |