Commit | Line | Data |
---|---|---|
be222f56 | 1 | /******************************************************************************* |
ed902a2b | 2 | * Copyright (c) 2009, 2014 Ericsson |
be222f56 PT |
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 | * Contributors: | |
10 | * Alvaro Sanchez-Leon - Initial API and implementation | |
11 | * Patrick Tasse - Refactoring | |
12 | *******************************************************************************/ | |
13 | ||
2bdf0193 | 14 | package org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model; |
be222f56 PT |
15 | |
16 | import java.util.Iterator; | |
30652cc3 | 17 | import java.util.List; |
36299425 | 18 | import java.util.regex.Pattern; |
be222f56 | 19 | |
df2597e0 AM |
20 | import org.eclipse.jdt.annotation.NonNull; |
21 | ||
be222f56 PT |
22 | /** |
23 | * Interface for an entry (row) in the time graph view | |
24 | * | |
be222f56 PT |
25 | * @author Alvaro Sanchez-Leon |
26 | * @author Patrick Tasse | |
27 | */ | |
28 | public interface ITimeGraphEntry { | |
29 | ||
30 | /** | |
31 | * Returns the parent of this entry, or <code>null</code> if it has none. | |
32 | * | |
33 | * @return the parent element, or <code>null</code> if it has none | |
34 | */ | |
57a2a5ca | 35 | ITimeGraphEntry getParent(); |
be222f56 PT |
36 | |
37 | /** | |
38 | * Returns whether this entry has children. | |
39 | * | |
40 | * @return <code>true</code> if the given element has children, | |
41 | * and <code>false</code> if it has no children | |
42 | */ | |
57a2a5ca | 43 | boolean hasChildren(); |
be222f56 PT |
44 | |
45 | /** | |
46 | * Returns the child elements of this entry. | |
47 | * | |
48 | * @return an array of child elements | |
49 | */ | |
df2597e0 | 50 | List<@NonNull ? extends ITimeGraphEntry> getChildren(); |
be222f56 PT |
51 | |
52 | /** | |
53 | * Returns the name of this entry. | |
54 | * | |
55 | * @return the entry name | |
56 | */ | |
57a2a5ca | 57 | String getName(); |
be222f56 PT |
58 | |
59 | /** | |
60 | * Returns the start time of this entry in nanoseconds. | |
61 | * | |
62 | * @return the start time | |
63 | */ | |
57a2a5ca | 64 | long getStartTime(); |
be222f56 PT |
65 | |
66 | /** | |
67 | * Returns the end time of this entry in nanoseconds. | |
68 | * | |
69 | * @return the end time | |
70 | */ | |
57a2a5ca | 71 | long getEndTime(); |
be222f56 PT |
72 | |
73 | /** | |
74 | * Returns whether this entry has time events. | |
75 | * If true, the time events iterator should not be null. | |
76 | * | |
77 | * @return true if the entry has time events | |
78 | * | |
79 | * @see #getTimeEventsIterator | |
80 | * @see #getTimeEventsIterator(long, long, long) | |
81 | */ | |
57a2a5ca | 82 | boolean hasTimeEvents(); |
be222f56 PT |
83 | |
84 | /** | |
85 | * Get an iterator which returns all time events. | |
86 | * | |
87 | * @return the iterator | |
88 | */ | |
df2597e0 | 89 | Iterator<@NonNull ? extends ITimeEvent> getTimeEventsIterator(); |
be222f56 PT |
90 | |
91 | /** | |
df2597e0 AM |
92 | * Get an iterator which only returns events that fall within the start time |
93 | * and the stop time. The visible duration is the event duration below which | |
94 | * further detail is not discernible. If no such iterator is implemented, | |
95 | * provide a basic iterator which returns all events. | |
be222f56 | 96 | * |
df2597e0 AM |
97 | * @param startTime |
98 | * start time in nanoseconds | |
99 | * @param stopTime | |
100 | * stop time in nanoseconds | |
101 | * @param visibleDuration | |
102 | * duration of one pixel in nanoseconds | |
be222f56 PT |
103 | * |
104 | * @return the iterator | |
105 | */ | |
df2597e0 | 106 | <T extends ITimeEvent> Iterator<@NonNull T> getTimeEventsIterator(long startTime, long stopTime, long visibleDuration); |
36299425 JCK |
107 | |
108 | /** | |
109 | * Test if this time graph entry matches with this pattern | |
110 | * | |
111 | * @param pattern | |
112 | * The pattern to match | |
113 | * @return True if it matches, false otherwise. | |
114 | * @since 2.0 | |
115 | */ | |
116 | boolean matches(@NonNull Pattern pattern); | |
be222f56 | 117 | } |