1 /*******************************************************************************
2 * Copyright (c) 2016 EfficiOS Inc., Alexandre Montplaisir
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 *******************************************************************************/
10 package org
.lttng
.scope
.tmf2
.views
.core
.timegraph
.model
.render
.states
;
12 import java
.util
.Collections
;
13 import java
.util
.List
;
15 import org
.lttng
.scope
.tmf2
.views
.core
.TimeRange
;
16 import org
.lttng
.scope
.tmf2
.views
.core
.timegraph
.model
.render
.tree
.TimeGraphTreeElement
;
18 import com
.google
.common
.collect
.ImmutableList
;
21 * "Segment" of a time graph, representing the states of a single tree element
22 * for a given time range.
24 * @author Alexandre Montplaisir
26 public class TimeGraphStateRender
{
28 /** Non-null reference to a dummy/empty render */
29 public static final TimeGraphStateRender EMPTY_RENDER
= new TimeGraphStateRender(TimeRange
.of(0, 0), TimeGraphTreeElement
.DUMMY_ELEMENT
, Collections
.emptyList());
31 private final TimeRange fTimeRange
;
32 private final TimeGraphTreeElement fTreeElement
;
33 private final List
<TimeGraphStateInterval
> fStateIntervals
;
39 * The time range of this state render. This is for informative
40 * use mostly, and usually matches the time range that was
41 * requested for the query that generated this render.
43 * This render contains state intervals of this single tree
45 * @param stateIntervals
46 * The state intervals that are part of this render. Their range
47 * should normally match the 'timeRange' parameter.
49 public TimeGraphStateRender(TimeRange timeRange
,
50 TimeGraphTreeElement treeElement
,
51 List
<TimeGraphStateInterval
> stateIntervals
) {
53 fTimeRange
= timeRange
;
54 fTreeElement
= treeElement
;
55 fStateIntervals
= ImmutableList
.copyOf(stateIntervals
);
59 * Get the time range of this interval.
61 * @return The time range
63 public TimeRange
getTimeRange() {
68 * Get the tree element to which the intervals of this render belongs.
70 * @return The tree element
72 public TimeGraphTreeElement
getTreeElement() {
77 * Get the state intervals that are part of this state render
79 * @return The state intervals
81 public List
<TimeGraphStateInterval
> getStateIntervals() {
82 return fStateIntervals
;