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
.ArrayList
;
13 import java
.util
.Collections
;
14 import java
.util
.List
;
16 import com
.google
.common
.collect
.ImmutableList
;
18 public class TimeGraphTreeModel
{
20 private final List
<TimeGraphTreeElement
> fTreeElements
= Collections
.synchronizedList(new ArrayList
<>());
22 public TimeGraphTreeModel() {
25 public int getNbElements() {
26 return fTreeElements
.size();
29 public void addElement(TimeGraphTreeElement element
) {
30 fTreeElements
.add(element
);
33 public TimeGraphTreeRender
getSnapshot() {
34 /* Safe to use concurrently */
35 List
<TimeGraphTreeElement
> list
= ImmutableList
.copyOf(fTreeElements
);
36 return new TimeGraphTreeRender(list
);