~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« back to all changes in this revision

Viewing changes to lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/AbsTmfStatisticsTree.java

  • Committer: Package Import Robot
  • Author(s): tony mancill
  • Date: 2013-05-13 21:43:22 UTC
  • mfrom: (1.2.1) (2.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130513214322-6frgd9du1n0w2uo7
Tags: 1.2.1-1
* Team upload.
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*******************************************************************************
2
2
 * Copyright (c) 2011, 2012 Ericsson
3
 
 * 
 
3
 *
4
4
 * All rights reserved. This program and the accompanying materials are
5
5
 * made available under the terms of the Eclipse Public License v1.0 which
6
6
 * accompanies this distribution, and is available at
7
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 
 * 
 
8
 *
9
9
 * Contributors:
10
 
 *   Mathieu Denis      (mathieu.denis@polymtl.ca) - Implementation and Initial API
11
 
 *   
 
10
 *   Mathieu Denis <mathieu.denis@polymtl.ca> - Implementation and Initial API
 
11
 *
12
12
 *******************************************************************************/
13
13
 
14
14
package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
28
28
 * It allow to implement a tree structure while avoiding the need to run through
29
29
 * the tree each time you need to add a node at a given place.
30
30
 * </p>
31
 
 * 
 
31
 *
32
32
 *  @version 1.0
33
33
 *  @author Mathieu Denis
34
34
 */
45
45
 
46
46
    /**
47
47
     * <h4>Function to merge many string with more efficacy.</h4>
48
 
     * 
 
48
     *
49
49
     * @param strings
50
50
     *            Strings to merge.
51
51
     * @return A new string containing all the strings.
52
52
     */
53
53
    public synchronized static String mergeString(String... strings) {
54
54
        fBuilder.setLength(0);
55
 
        for (String s : strings)
 
55
        for (String s : strings) {
56
56
            fBuilder.append(s);
 
57
        }
57
58
                return fBuilder.toString();
58
59
    }
59
60
 
82
83
 
83
84
    /**
84
85
     * <h4>Get a node.</h4>
85
 
     * 
 
86
     *
86
87
     * @param path
87
88
     *            Path to the node.
88
89
     * @return The node or null.
93
94
 
94
95
    /**
95
96
     * <h4>Get the children of a node.</h4>
96
 
     * 
 
97
     *
97
98
     * @param path
98
99
     *            Path to the node.
99
100
     * @return Collection containing the children.
102
103
 
103
104
    /**
104
105
     * <h4>Get every children of a node, even if it doesn't have any registered events, as opposed to getChildren</h4>
105
 
     * 
 
106
     *
106
107
     * @param path
107
108
     *            Path to the node.
108
109
     * @return Collection containing all the children.
109
110
     */
110
111
    public abstract Collection<TmfStatisticsTreeNode> getAllChildren(final TmfFixedArray<String> path);
111
 
    
 
112
 
112
113
    /**
113
114
     * <h4>Get the map of existing elements of path classified by parent.</h4>
114
 
     * 
 
115
     *
115
116
     * @return The map.
116
117
     */
117
118
    public Map<String, Set<String>> getKeys() {
120
121
 
121
122
    /**
122
123
     * <h4>Get or create a node.</h4>
123
 
     * 
 
124
     *
124
125
     * @param path
125
126
     *            Path to the node.
126
127
     * @return The node.
137
138
 
138
139
    /**
139
140
     * <h4>Get the parent of a node.</h4>
140
 
     * 
 
141
     *
141
142
     * @param path
142
143
     *            Path to the node.
143
144
     * @return Parent node or null.
144
145
     */
145
146
    public TmfStatisticsTreeNode getParent(final TmfFixedArray<String> path) {
146
147
        if (path.size() == 1) {
147
 
            if (path.equals(ROOT))
 
148
            if (path.equals(ROOT)) {
148
149
                return null;
149
 
            else
150
 
                return get(ROOT);
 
150
            }
 
151
            return get(ROOT);
151
152
        }
152
153
        return get(path.subArray(0, path.size() - 1));
153
154
    }
184
185
     * Must make sure the {@link #getChildren(TmfFixedArray)} on the parent node
185
186
     * will return the newly created node.
186
187
     * </p>
187
 
     * 
 
188
     *
188
189
     * @param path
189
190
     *            Path of the new node.
190
191
     */
195
196
     * <p>
196
197
     * Work recursively.
197
198
     * </p>
198
 
     * 
 
199
     *
199
200
     * @param path
200
201
     *            Path to the node.
201
202
     */