1 /*******************************************************************************
2 * Copyright (c) 2009 Ericsson
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
10 * Yann N. Dauphin (dhaemon@gmail.com) - Implementation for stats
11 *******************************************************************************/
12 package org
.eclipse
.linuxtools
.lttng
.ui
.views
.statistics
.model
;
14 import java
.util
.HashMap
;
17 public class StatisticsTreeRootFactory
{
18 // ========================================================================
20 // =======================================================================
22 private static final Map
<String
, StatisticsTreeNode
> rootInstances
= new HashMap
<String
, StatisticsTreeNode
>();
24 // ========================================================================
26 // =======================================================================
29 * Provide a statisticsTree instance per trace
33 public static StatisticsTreeNode
getStatTreeRoot(String traceUniqueId
) {
34 if (traceUniqueId
== null) {
38 if (rootInstances
.containsKey(traceUniqueId
)) {
39 return rootInstances
.get(traceUniqueId
);
42 StatisticsTreeNode tree
= new StatisticsTreeNode(traceUniqueId
);
44 rootInstances
.put(traceUniqueId
, tree
);
50 * @param traceUniqueId
53 public static boolean containsTreeRoot(String traceUniqueId
) {
54 return rootInstances
.containsKey(traceUniqueId
);
58 * Remove previously registered statistics tree.
59 * @param traceUniqueId
61 public static void removeStatTreeRoot(String traceUniqueId
) {
62 if (traceUniqueId
!= null && rootInstances
.containsKey(traceUniqueId
)) {
63 rootInstances
.remove(traceUniqueId
);
68 * Remove all tree root instances
70 public static void removeAll() {
71 rootInstances
.clear();