-/*******************************************************************************\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 java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;\r
-\r
-/**\r
- * Filter node for the event match operation\r
- *\r
- * @version 1.0\r
- * @author Patrick Tasse\r
- */\r
-@SuppressWarnings("javadoc")\r
-public class TmfFilterNode extends TmfFilterTreeNode {\r
-\r
- public static final String NODE_NAME = "FILTER"; //$NON-NLS-1$\r
- public static final String NAME_ATTR = "name"; //$NON-NLS-1$\r
-\r
- String fFilterName;\r
-\r
- /**\r
- * @param filterName the filter name\r
- */\r
- public TmfFilterNode(String filterName) {\r
- super(null);\r
- fFilterName = filterName;\r
- }\r
-\r
- /**\r
- * @param parent the parent node\r
- * @param filterName the filter name\r
- */\r
- public TmfFilterNode(ITmfFilterTreeNode parent, String filterName) {\r
- super(parent);\r
- fFilterName = filterName;\r
- }\r
-\r
- /**\r
- * @return the filer name\r
- */\r
- public String getFilterName() {\r
- return fFilterName;\r
- }\r
-\r
- /**\r
- * @param filterName the filer name\r
- */\r
- public void setFilterName(String filterName) {\r
- fFilterName = filterName;\r
- }\r
-\r
- @Override\r
- public String getNodeName() {\r
- return NODE_NAME;\r
- }\r
-\r
- @Override\r
- public boolean matches(ITmfEvent event) {\r
- // There should be at most one child\r
- for (ITmfFilterTreeNode node : getChildren()) {\r
- if (node.matches(event)) {\r
- return true;\r
- }\r
- }\r
- return false;\r
- }\r
-\r
- @Override\r
- public List<String> getValidChildren() {\r
- if (getChildrenCount() == 0) {\r
- return super.getValidChildren();\r
- }\r
- return new ArrayList<String>(0); // only one child allowed\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- StringBuffer buf = new StringBuffer();\r
- if (getChildrenCount() > 1) {\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(" and "); //$NON-NLS-1$\r
- }\r
- }\r
- if (getChildrenCount() > 1) {\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 java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+
+/**
+ * Filter node for the event match operation
+ *
+ * @version 1.0
+ * @author Patrick Tasse
+ */
+@SuppressWarnings("javadoc")
+public class TmfFilterNode extends TmfFilterTreeNode {
+
+ public static final String NODE_NAME = "FILTER"; //$NON-NLS-1$
+ public static final String NAME_ATTR = "name"; //$NON-NLS-1$
+
+ String fFilterName;
+
+ /**
+ * @param filterName the filter name
+ */
+ public TmfFilterNode(String filterName) {
+ super(null);
+ fFilterName = filterName;
+ }
+
+ /**
+ * @param parent the parent node
+ * @param filterName the filter name
+ */
+ public TmfFilterNode(ITmfFilterTreeNode parent, String filterName) {
+ super(parent);
+ fFilterName = filterName;
+ }
+
+ /**
+ * @return the filer name
+ */
+ public String getFilterName() {
+ return fFilterName;
+ }
+
+ /**
+ * @param filterName the filer name
+ */
+ public void setFilterName(String filterName) {
+ fFilterName = filterName;
+ }
+
+ @Override
+ public String getNodeName() {
+ return NODE_NAME;
+ }
+
+ @Override
+ public boolean matches(ITmfEvent event) {
+ // There should be at most one child
+ for (ITmfFilterTreeNode node : getChildren()) {
+ if (node.matches(event)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public List<String> getValidChildren() {
+ if (getChildrenCount() == 0) {
+ return super.getValidChildren();
+ }
+ return new ArrayList<String>(0); // only one child allowed
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ if (getChildrenCount() > 1) {
+ 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(" and "); //$NON-NLS-1$
+ }
+ }
+ if (getChildrenCount() > 1) {
+ buf.append(" )"); //$NON-NLS-1$
+ }
+ return buf.toString();
+ }
+}