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
.eclipse
.tracecompass
.internal
.provisional
.tmf
.core
.views
.timegraph2
;
12 import java
.util
.Collections
;
14 import java
.util
.function
.Supplier
;
16 import org
.eclipse
.jdt
.annotation
.Nullable
;
18 import com
.google
.common
.base
.Objects
;
20 public class TimeGraphStateInterval
{
22 public enum LineThickness
{
27 private final TimeGraphEvent fStartEvent
;
28 private final TimeGraphEvent fEndEvent
;
30 private final String fStateName
;
31 private final ColorDefinition fColor
;
32 private final LineThickness fLineThickness
;
34 private final @Nullable Supplier
<Map
<String
, String
>> fPropertySupplier
;
36 public TimeGraphStateInterval(long start
,
38 TimeGraphTreeElement treeElement
,
40 ColorDefinition color
,
41 LineThickness lineThickness
,
42 @Nullable Supplier
<Map
<String
, String
>> propertySupplier
) {
44 fStartEvent
= new TimeGraphEvent(start
, treeElement
);
45 fEndEvent
= new TimeGraphEvent(end
, treeElement
);
47 fStateName
= stateName
;
49 fLineThickness
= lineThickness
;
50 fPropertySupplier
= propertySupplier
;
54 public TimeGraphEvent
getStartEvent() {
58 public TimeGraphEvent
getEndEvent() {
62 public String
getStateName() {
66 public ColorDefinition
getColorDefinition() {
70 public LineThickness
getLineThickness() {
71 return fLineThickness
;
74 public Map
<String
, String
> getProperties() {
75 Supplier
<Map
<String
, String
>> supplier
= fPropertySupplier
;
76 if (supplier
== null) {
77 return Collections
.EMPTY_MAP
;
79 return supplier
.get();
83 public String
toString() {
84 return Objects
.toStringHelper(this)
85 .add("start", fStartEvent
.getTimestamp())
86 .add("end", fEndEvent
.getTimestamp())
87 .add("name", fStateName
)