analysis: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / filter / model / TmfFilterRootNode.java
1 /*******************************************************************************
2 * Copyright (c) 2010, 2015 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 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.tracecompass.tmf.core.filter.model;
14
15 import java.util.ArrayList;
16 import java.util.Arrays;
17 import java.util.List;
18
19 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
20
21 /**
22 * The Filter tree root node
23 *
24 * @version 1.0
25 * @author Patrick Tasse
26 */
27 public class TmfFilterRootNode extends TmfFilterTreeNode {
28
29 /** root node name */
30 public static final String NODE_NAME = "ROOT"; //$NON-NLS-1$
31
32 private static final String[] VALID_CHILDREN = {
33 TmfFilterNode.NODE_NAME
34 };
35
36 /**
37 * Default constructor
38 */
39 public TmfFilterRootNode() {
40 super(null);
41 }
42
43 @Override
44 public String getNodeName() {
45 return NODE_NAME;
46 }
47
48 @Override
49 public boolean matches(ITmfEvent event) {
50 for (ITmfFilterTreeNode node : getChildren()) {
51 if (! node.matches(event)) {
52 return false;
53 }
54 }
55 return true;
56 }
57
58 @Override
59 public List<String> getValidChildren() {
60 return Arrays.asList(VALID_CHILDREN);
61 }
62
63 @Override
64 public String toString(boolean explicit) {
65 StringBuffer buf = new StringBuffer("root"); //$NON-NLS-1$
66 if (getChildrenCount() > 0) {
67 buf.append(' ');
68 List<String> strings = new ArrayList<>();
69 for (ITmfFilterTreeNode child : getChildren()) {
70 strings.add(child.toString(explicit));
71 }
72 buf.append(strings.toString());
73 }
74 return buf.toString();
75 }
76 }
This page took 0.04252 seconds and 5 git commands to generate.