tmf: Use tabs in statistics view for each traces
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / internal / lttng / ui / views / statistics / model / StatisticsTreeRootFactory.java
1 /*******************************************************************************
2 * Copyright (c) 2009 Ericsson
3 *
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 *
9 * Contributors:
10 * Yann N. Dauphin (dhaemon@gmail.com) - Implementation for stats
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model;
14
15 import java.util.HashMap;
16 import java.util.Map;
17
18 public class StatisticsTreeRootFactory {
19
20 // -----------------------------------------------------------------------
21 // Data
22 // -----------------------------------------------------------------------
23
24 private static final Map<String, StatisticsData> fTreeInstances = new HashMap<String, StatisticsData>();
25
26 // -----------------------------------------------------------------------
27 // Methods
28 // -----------------------------------------------------------------------
29
30 /**
31 * Provide a statisticsTree instance per trace
32 *
33 * @return
34 */
35 public static StatisticsTreeNode getStatTreeRoot(String traceUniqueId) {
36 return getStatTree(traceUniqueId).getOrCreate(StatisticsData.ROOT);
37 }
38 public static StatisticsData getStatTree(String traceUniqueId) {
39 if(traceUniqueId == null)
40 return null;
41
42 StatisticsData tree = fTreeInstances.get(traceUniqueId);
43 if(tree == null) {
44 tree = new KernelStatisticsData(traceUniqueId); // NOTE
45 fTreeInstances.put(traceUniqueId, tree);
46 }
47 return tree;
48 }
49 /**
50 * @param traceUniqueId
51 * @return
52 */
53 public static boolean containsTreeRoot(String traceUniqueId) {
54 return fTreeInstances.containsKey(traceUniqueId);
55 }
56
57 /**
58 * Remove previously registered statistics tree.
59 * @param traceUniqueId
60 */
61 public static void removeStatTreeRoot(String traceUniqueId) {
62 if (traceUniqueId != null && fTreeInstances.containsKey(traceUniqueId)) {
63 fTreeInstances.remove(traceUniqueId);
64 }
65 }
66
67 /**
68 * Remove all tree and root instances
69 */
70 public static void removeAll() {
71 fTreeInstances.clear();
72 }
73 }
This page took 0.039998 seconds and 5 git commands to generate.