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; |
be222f56 | 18 | |
df2597e0 AM |
19 | import org.eclipse.jdt.annotation.NonNull; |
20 | ||
be222f56 PT |
21 | /** |
22 | * Interface for an entry (row) in the time graph view | |
23 | * | |
be222f56 PT |
24 | * @author Alvaro Sanchez-Leon |
25 | * @author Patrick Tasse | |
26 | */ | |
27 | public interface ITimeGraphEntry { | |
28 | ||
29 | /** | |
30 | * Returns the parent of this entry, or <code>null</code> if it has none. | |
31 | * | |
32 | * @return the parent element, or <code>null</code> if it has none | |
33 | */ | |
57a2a5ca | 34 | ITimeGraphEntry getParent(); |
be222f56 PT |
35 | |
36 | /** | |
37 | * Returns whether this entry has children. | |
38 | * | |
39 | * @return <code>true</code> if the given element has children, | |
40 | * and <code>false</code> if it has no children | |
41 | */ | |
57a2a5ca | 42 | boolean hasChildren(); |
be222f56 PT |
43 | |
44 | /** | |
45 | * Returns the child elements of this entry. | |
46 | * | |
47 | * @return an array of child elements | |
48 | */ | |
df2597e0 | 49 | List<@NonNull ? extends ITimeGraphEntry> getChildren(); |
be222f56 PT |
50 | |
51 | /** | |
52 | * Returns the name of this entry. | |
53 | * | |
54 | * @return the entry name | |
55 | */ | |
57a2a5ca | 56 | String getName(); |
be222f56 PT |
57 | |
58 | /** | |
59 | * Returns the start time of this entry in nanoseconds. | |
60 | * | |
61 | * @return the start time | |
62 | */ | |
57a2a5ca | 63 | long getStartTime(); |
be222f56 PT |
64 | |
65 | /** | |
66 | * Returns the end time of this entry in nanoseconds. | |
67 | * | |
68 | * @return the end time | |
69 | */ | |
57a2a5ca | 70 | long getEndTime(); |
be222f56 PT |
71 | |
72 | /** | |
73 | * Returns whether this entry has time events. | |
74 | * If true, the time events iterator should not be null. | |
75 | * | |
76 | * @return true if the entry has time events | |
77 | * | |
78 | * @see #getTimeEventsIterator | |
79 | * @see #getTimeEventsIterator(long, long, long) | |
80 | */ | |
57a2a5ca | 81 | boolean hasTimeEvents(); |
be222f56 PT |
82 | |
83 | /** | |
84 | * Get an iterator which returns all time events. | |
85 | * | |
86 | * @return the iterator | |
87 | */ | |
df2597e0 | 88 | Iterator<@NonNull ? extends ITimeEvent> getTimeEventsIterator(); |
be222f56 PT |
89 | |
90 | /** | |
df2597e0 AM |
91 | * Get an iterator which only returns events that fall within the start time |
92 | * and the stop time. The visible duration is the event duration below which | |
93 | * further detail is not discernible. If no such iterator is implemented, | |
94 | * provide a basic iterator which returns all events. | |
be222f56 | 95 | * |
df2597e0 AM |
96 | * @param startTime |
97 | * start time in nanoseconds | |
98 | * @param stopTime | |
99 | * stop time in nanoseconds | |
100 | * @param visibleDuration | |
101 | * duration of one pixel in nanoseconds | |
be222f56 PT |
102 | * |
103 | * @return the iterator | |
104 | */ | |
df2597e0 | 105 | <T extends ITimeEvent> Iterator<@NonNull T> getTimeEventsIterator(long startTime, long stopTime, long visibleDuration); |
be222f56 | 106 | } |