-/*******************************************************************************\r
- * Copyright (c) 2010 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- * Patrick Tasse - Initial API and implementation\r
- *******************************************************************************/\r
-\r
-package org.eclipse.linuxtools.tmf.core.filter.model;\r
-\r
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;\r
-\r
-/**\r
- * Filter node for the 'or' operation\r
- * \r
- * @version 1.0\r
- * @author Patrick Tasse\r
- */\r
-public class TmfFilterOrNode extends TmfFilterTreeNode {\r
-\r
- public static final String NODE_NAME = "OR"; //$NON-NLS-1$\r
- public static final String NOT_ATTR = "not"; //$NON-NLS-1$\r
- \r
- private boolean fNot = false;\r
- \r
- public TmfFilterOrNode(ITmfFilterTreeNode parent) {\r
- super(parent);\r
- }\r
-\r
- @Override\r
- public String getNodeName() {\r
- return NODE_NAME;\r
- }\r
-\r
- public boolean isNot() {\r
- return fNot;\r
- }\r
- \r
- public void setNot(boolean not) {\r
- this.fNot = not;\r
- }\r
- \r
- @Override\r
- public boolean matches(ITmfEvent event) {\r
- for (ITmfFilterTreeNode node : getChildren()) {\r
- if (node.matches(event)) {\r
- return true ^ fNot;\r
- }\r
- }\r
- return false & fNot;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- StringBuffer buf = new StringBuffer();\r
- if (fNot) {\r
- buf.append("not "); //$NON-NLS-1$\r
- }\r
- if (getParent() != null && !(getParent() instanceof TmfFilterRootNode) && !(getParent() instanceof TmfFilterNode)) {\r
- buf.append("( "); //$NON-NLS-1$\r
- }\r
- for (int i = 0; i < getChildrenCount(); i++) {\r
- ITmfFilterTreeNode node = getChildren()[i];\r
- buf.append(node.toString());\r
- if (i < getChildrenCount() - 1) {\r
- buf.append(" or "); //$NON-NLS-1$\r
- }\r
- }\r
- if (getParent() != null && !(getParent() instanceof TmfFilterRootNode) && !(getParent() instanceof TmfFilterNode)) {\r
- buf.append(" )"); //$NON-NLS-1$\r
- }\r
- return buf.toString();\r
- }\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2010 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tasse - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.filter.model;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+
+/**
+ * Filter node for the 'or' operation
+ *
+ * @version 1.0
+ * @author Patrick Tasse
+ */
+@SuppressWarnings("javadoc")
+public class TmfFilterOrNode extends TmfFilterTreeNode {
+
+ public static final String NODE_NAME = "OR"; //$NON-NLS-1$
+ public static final String NOT_ATTR = "not"; //$NON-NLS-1$
+
+ private boolean fNot = false;
+
+ /**
+ * @param parent the parent node
+ */
+ public TmfFilterOrNode(ITmfFilterTreeNode parent) {
+ super(parent);
+ }
+
+ @Override
+ public String getNodeName() {
+ return NODE_NAME;
+ }
+
+ /**
+ * @return the NOT state
+ */
+ public boolean isNot() {
+ return fNot;
+ }
+
+ /**
+ * @param not the NOT state
+ */
+ public void setNot(boolean not) {
+ this.fNot = not;
+ }
+
+ @Override
+ public boolean matches(ITmfEvent event) {
+ for (ITmfFilterTreeNode node : getChildren()) {
+ if (node.matches(event)) {
+ return true ^ fNot;
+ }
+ }
+ return false & fNot;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ if (fNot) {
+ buf.append("not "); //$NON-NLS-1$
+ }
+ if (getParent() != null && !(getParent() instanceof TmfFilterRootNode) && !(getParent() instanceof TmfFilterNode)) {
+ buf.append("( "); //$NON-NLS-1$
+ }
+ for (int i = 0; i < getChildrenCount(); i++) {
+ ITmfFilterTreeNode node = getChildren()[i];
+ buf.append(node.toString());
+ if (i < getChildrenCount() - 1) {
+ buf.append(" or "); //$NON-NLS-1$
+ }
+ }
+ if (getParent() != null && !(getParent() instanceof TmfFilterRootNode) && !(getParent() instanceof TmfFilterNode)) {
+ buf.append(" )"); //$NON-NLS-1$
+ }
+ return buf.toString();
+ }
+}