1 /*******************************************************************************
2 * Copyright (c) 2016 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 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.tmf
.core
.filter
.model
;
15 import java
.util
.ArrayList
;
16 import java
.util
.List
;
18 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.filter
.ITmfFilter
;
22 * Filter node that contains its own filter object
25 * @author Patrick Tasse
28 public class TmfFilterObjectNode
extends TmfFilterTreeNode
{
30 /** filter node name */
31 public static final String NODE_NAME
= "FILTEROBJECT"; //$NON-NLS-1$
32 /** name attribute name */
33 public static final String NAME_ATTR
= "name"; //$NON-NLS-1$
35 private final ITmfFilter fFilter
;
38 * @param filter the filter object
40 public TmfFilterObjectNode(ITmfFilter filter
) {
46 * @param parent the parent node
47 * @param filter the filter object
49 public TmfFilterObjectNode(ITmfFilterTreeNode parent
, ITmfFilter filter
) {
55 * @return the filter object
57 public ITmfFilter
getFilter() {
62 public String
getNodeName() {
67 public boolean matches(ITmfEvent event
) {
68 // There should be at most one child
69 for (ITmfFilterTreeNode node
: getChildren()) {
70 if (node
.matches(event
)) {
78 public List
<String
> getValidChildren() {
79 return new ArrayList
<>(0);
83 public String
toString(boolean explicit
) {
84 if (fFilter
instanceof ITmfFilterTreeNode
) {
85 return ((ITmfFilterTreeNode
) fFilter
).toString(explicit
);
87 return fFilter
.toString();