| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2010, 2014 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.Arrays; |
| 16 | import java.util.List; |
| 17 | |
| 18 | import org.eclipse.tracecompass.tmf.core.event.ITmfEvent; |
| 19 | |
| 20 | /** |
| 21 | * The Filter tree root node |
| 22 | * |
| 23 | * @version 1.0 |
| 24 | * @author Patrick Tasse |
| 25 | */ |
| 26 | public class TmfFilterRootNode extends TmfFilterTreeNode { |
| 27 | |
| 28 | @SuppressWarnings("javadoc") |
| 29 | public static final String NODE_NAME = "ROOT"; //$NON-NLS-1$ |
| 30 | |
| 31 | private static final String[] VALID_CHILDREN = { |
| 32 | TmfFilterNode.NODE_NAME |
| 33 | }; |
| 34 | |
| 35 | /** |
| 36 | * Default constructor |
| 37 | */ |
| 38 | public TmfFilterRootNode() { |
| 39 | super(null); |
| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | public String getNodeName() { |
| 44 | return NODE_NAME; |
| 45 | } |
| 46 | |
| 47 | @Override |
| 48 | public boolean matches(ITmfEvent event) { |
| 49 | for (ITmfFilterTreeNode node : getChildren()) { |
| 50 | if (! node.matches(event)) { |
| 51 | return false; |
| 52 | } |
| 53 | } |
| 54 | return true; |
| 55 | } |
| 56 | |
| 57 | @Override |
| 58 | public List<String> getValidChildren() { |
| 59 | return Arrays.asList(VALID_CHILDREN); |
| 60 | } |
| 61 | |
| 62 | } |