Import "views" plugins
[deliverable/tracecompass.git] / tmf / org.lttng.scope.tmf2.views.core / src / org / lttng / scope / tmf2 / views / core / timegraph / model / render / states / TimeGraphStateInterval.java
CommitLineData
c879c4db
AM
1/*
2 * Copyright (C) 2017 EfficiOS Inc., Alexandre Montplaisir <alexmonthy@efficios.com>
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
10package org.lttng.scope.tmf2.views.core.timegraph.model.render.states;
11
12import java.util.Map;
13
14import org.eclipse.jdt.annotation.Nullable;
15import org.lttng.scope.tmf2.views.core.config.ConfigOption;
16import org.lttng.scope.tmf2.views.core.timegraph.model.render.ColorDefinition;
17import org.lttng.scope.tmf2.views.core.timegraph.model.render.LineThickness;
18import org.lttng.scope.tmf2.views.core.timegraph.model.render.TimeGraphEvent;
19import org.lttng.scope.tmf2.views.core.timegraph.model.render.tree.TimeGraphTreeElement;
20
21/**
22 * Base interface for time graph state interval, which is defined by a start
23 * time, end time, and a state.
24 *
25 * @author Alexandre Montplaisir
26 */
27public interface TimeGraphStateInterval {
28
29 /**
30 * Return the start event of this interval.
31 *
32 * @return The start event
33 */
34 TimeGraphEvent getStartEvent();
35
36 /**
37 * Return the end event of this interval.
38 *
39 * @return The end event
40 */
41 TimeGraphEvent getEndEvent();
42
43 /**
44 * Get the name of the state represented by this interval.
45 *
46 * @return The state name
47 */
48 String getStateName();
49
50 /**
51 * Get the label of this interval. This means the text that is meant to be
52 * displayed alongside the interval's color. It may or may not be the same
53 * as the {@link #getStateName()}.
54 *
55 * @return The optional label of this interval
56 */
57 @Nullable String getLabel();
58
59 /**
60 * Get the color suggested for this interval.
61 *
62 * @return The color of this interval
63 */
64 ConfigOption<ColorDefinition> getColorDefinition();
65
66 /**
67 * Get the suggested line thickness of this interval.
68 *
69 * @return The line thickness
70 */
71 ConfigOption<LineThickness> getLineThickness();
72
73 /**
74 * Indicate if this interval represents multiple states, or a single one.
75 *
76 * @return If this interval is a multi-state one
77 */
78 boolean isMultiState();
79
80 /**
81 * Get the properties associated with this state interval. This is extra,
82 * generic data that can be attached to the interval. Views can display
83 * those in a tooltip, for example.
84 *
85 * @return The additional properties.
86 */
87 Map<String, String> getProperties();
88
89 /**
90 * Get the start time of this interval, which is effectively the timestamp
91 * of the start event.
92 *
93 * @return The start time
94 */
95 default long getStartTime() {
96 return getStartEvent().getTimestamp();
97 }
98
99 /**
100 * Get the end time of this interval, which is effectively the timestamp of
101 * the end event.
102 *
103 * @return The end time
104 */
105 default long getEndTime() {
106 return getEndEvent().getTimestamp();
107 }
108
109 /**
110 * Get the duration of this interval, effectively end time minus start time.
111 *
112 * @return The duration
113 */
114 default long getDuration() {
115 return (getEndTime() - getStartTime());
116 }
117
118 /**
119 * Get the tree element of this interval's start and end events.
120 *
121 * @return The tree element
122 */
123 default TimeGraphTreeElement getTreeElement() {
124 return getStartEvent().getTreeElement();
125 }
126
127}
This page took 0.027623 seconds and 5 git commands to generate.