[WIP] CFV Refactor
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / internal / provisional / tmf / core / views / timegraph2 / TimeGraphTreeModel.java
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/provisional/tmf/core/views/timegraph2/TimeGraphTreeModel.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/provisional/tmf/core/views/timegraph2/TimeGraphTreeModel.java
new file mode 100644 (file)
index 0000000..5502667
--- /dev/null
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * 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.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import com.google.common.collect.ImmutableList;
+
+public class TimeGraphTreeModel {
+
+    private final List<TimeGraphTreeElement> fTreeElements = Collections.synchronizedList(new ArrayList<>());
+
+    public TimeGraphTreeModel() {
+    }
+
+    public int getNbElements() {
+        return fTreeElements.size();
+    }
+
+    public void addElement(TimeGraphTreeElement element) {
+        fTreeElements.add(element);
+    }
+
+    public TimeGraphTreeRender getSnapshot() {
+        /* Safe to use concurrently */
+        List<TimeGraphTreeElement> list = ImmutableList.copyOf(fTreeElements);
+        return new TimeGraphTreeRender(list);
+    }
+}
This page took 0.025033 seconds and 5 git commands to generate.