1 /*******************************************************************************
2 * Copyright (c) 2010 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
.linuxtools
.tmf
.filter
.model
;
15 import org
.eclipse
.linuxtools
.tmf
.event
.TmfEvent
;
18 public class TmfFilterAndNode
extends TmfFilterTreeNode
{
20 public static final String NODE_NAME
= "AND"; //$NON-NLS-1$
21 public static final String NOT_ATTR
= "not"; //$NON-NLS-1$
23 private boolean fNot
= false;
25 public TmfFilterAndNode(ITmfFilterTreeNode parent
) {
29 public boolean isNot() {
33 public void setNot(boolean not
) {
38 public String
getNodeName() {
43 public boolean matches(TmfEvent event
) {
44 for (ITmfFilterTreeNode node
: getChildren()) {
45 if (! node
.matches(event
)) {
53 public String
toString() {
54 StringBuffer buf
= new StringBuffer();
56 buf
.append("not "); //$NON-NLS-1$
58 if (getParent() != null && !(getParent() instanceof TmfFilterRootNode
) && !(getParent() instanceof TmfFilterNode
)) {
59 buf
.append("( "); //$NON-NLS-1$
61 for (int i
= 0; i
< getChildrenCount(); i
++) {
62 ITmfFilterTreeNode node
= getChildren()[i
];
63 buf
.append(node
.toString());
64 if (i
< getChildrenCount() - 1) {
65 buf
.append(" and "); //$NON-NLS-1$
68 if (getParent() != null && !(getParent() instanceof TmfFilterRootNode
) && !(getParent() instanceof TmfFilterNode
)) {
69 buf
.append(" )"); //$NON-NLS-1$
71 return buf
.toString();