--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016 EfficiOS Inc., Alexandre Montplaisir
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.provisional.tmf.core.views.timegraph2;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.function.Supplier;
+
+import org.eclipse.jdt.annotation.Nullable;
+
+import com.google.common.base.Objects;
+
+public class TimeGraphStateInterval {
+
+ public enum LineThickness {
+ NORMAL,
+ SMALL
+ }
+
+ private final TimeGraphEvent fStartEvent;
+ private final TimeGraphEvent fEndEvent;
+
+ private final String fStateName;
+ private final ColorDefinition fColor;
+ private final LineThickness fLineThickness;
+
+ private final @Nullable Supplier<Map<String, String>> fPropertySupplier;
+
+ public TimeGraphStateInterval(long start,
+ long end,
+ TimeGraphTreeElement treeElement,
+ String stateName,
+ ColorDefinition color,
+ LineThickness lineThickness,
+ @Nullable Supplier<Map<String, String>> propertySupplier) {
+
+ fStartEvent = new TimeGraphEvent(start, treeElement);
+ fEndEvent = new TimeGraphEvent(end, treeElement);
+
+ fStateName = stateName;
+ fColor = color;
+ fLineThickness = lineThickness;
+ fPropertySupplier = propertySupplier;
+
+ }
+
+ public TimeGraphEvent getStartEvent() {
+ return fStartEvent;
+ }
+
+ public TimeGraphEvent getEndEvent() {
+ return fEndEvent;
+ }
+
+ public String getStateName() {
+ return fStateName;
+ }
+
+ public ColorDefinition getColorDefinition() {
+ return fColor;
+ }
+
+ public LineThickness getLineThickness() {
+ return fLineThickness;
+ }
+
+ public Map<String, String> getProperties() {
+ Supplier<Map<String, String>> supplier = fPropertySupplier;
+ if (supplier == null) {
+ return Collections.EMPTY_MAP;
+ }
+ return supplier.get();
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("start", fStartEvent.getTimestamp())
+ .add("end", fEndEvent.getTimestamp())
+ .add("name", fStateName)
+ .toString();
+ }
+}