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 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.internal
.lttng
.ui
.views
.statistics
.model
;
15 import java
.util
.HashMap
;
18 public class StatisticsTreeRootFactory
{
20 // -----------------------------------------------------------------------
22 // -----------------------------------------------------------------------
24 private static final Map
<String
, StatisticsData
> fTreeInstances
= new HashMap
<String
, StatisticsData
>();
26 // -----------------------------------------------------------------------
28 // -----------------------------------------------------------------------
31 * Provide a statisticsTree instance per trace
35 public static StatisticsTreeNode
getStatTreeRoot(String traceUniqueId
) {
36 return getStatTree(traceUniqueId
).getOrCreate(StatisticsData
.ROOT
);
38 public static StatisticsData
getStatTree(String traceUniqueId
) {
39 if(traceUniqueId
== null)
42 StatisticsData tree
= fTreeInstances
.get(traceUniqueId
);
44 tree
= new KernelStatisticsData(traceUniqueId
); // NOTE
45 fTreeInstances
.put(traceUniqueId
, tree
);
50 * @param traceUniqueId
53 public static boolean containsTreeRoot(String traceUniqueId
) {
54 return fTreeInstances
.containsKey(traceUniqueId
);
58 * Remove previously registered statistics tree.
59 * @param traceUniqueId
61 public static void removeStatTreeRoot(String traceUniqueId
) {
62 if (traceUniqueId
!= null && fTreeInstances
.containsKey(traceUniqueId
)) {
63 fTreeInstances
.remove(traceUniqueId
);
68 * Remove all tree and root instances
70 public static void removeAll() {
71 fTreeInstances
.clear();