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
.core
.filter
.model
;
15 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEvent
;
19 * Filter node for the 'and' operation
22 * @author Patrick Tasse
24 public class TmfFilterAndNode
extends TmfFilterTreeNode
{
26 public static final String NODE_NAME
= "AND"; //$NON-NLS-1$
27 public static final String NOT_ATTR
= "not"; //$NON-NLS-1$
29 private boolean fNot
= false;
31 public TmfFilterAndNode(ITmfFilterTreeNode parent
) {
35 public boolean isNot() {
39 public void setNot(boolean not
) {
44 public String
getNodeName() {
49 public boolean matches(ITmfEvent event
) {
50 for (ITmfFilterTreeNode node
: getChildren()) {
51 if (! node
.matches(event
)) {
59 public String
toString() {
60 StringBuffer buf
= new StringBuffer();
62 buf
.append("not "); //$NON-NLS-1$
64 if (getParent() != null && !(getParent() instanceof TmfFilterRootNode
) && !(getParent() instanceof TmfFilterNode
)) {
65 buf
.append("( "); //$NON-NLS-1$
67 for (int i
= 0; i
< getChildrenCount(); i
++) {
68 ITmfFilterTreeNode node
= getChildren()[i
];
69 buf
.append(node
.toString());
70 if (i
< getChildrenCount() - 1) {
71 buf
.append(" and "); //$NON-NLS-1$
74 if (getParent() != null && !(getParent() instanceof TmfFilterRootNode
) && !(getParent() instanceof TmfFilterNode
)) {
75 buf
.append(" )"); //$NON-NLS-1$
77 return buf
.toString();