Fix a pile of Javadoc warnings
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / filter / model / TmfFilterOrNode.java
CommitLineData
46ab8ce3
FC
1/*******************************************************************************\r
2 * Copyright (c) 2010 Ericsson\r
0283f7ff 3 *\r
46ab8ce3
FC
4 * All rights reserved. This program and the accompanying materials are\r
5 * made available under the terms of the Eclipse Public License v1.0 which\r
6 * accompanies this distribution, and is available at\r
7 * http://www.eclipse.org/legal/epl-v10.html\r
0283f7ff 8 *\r
46ab8ce3
FC
9 * Contributors:\r
10 * Patrick Tasse - Initial API and implementation\r
11 *******************************************************************************/\r
12\r
6c13869b 13package org.eclipse.linuxtools.tmf.core.filter.model;\r
46ab8ce3 14\r
a96d4804 15import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;\r
46ab8ce3 16\r
d37aaa7f
FC
17/**\r
18 * Filter node for the 'or' operation\r
0283f7ff 19 *\r
d37aaa7f
FC
20 * @version 1.0\r
21 * @author Patrick Tasse\r
22 */\r
0283f7ff 23@SuppressWarnings("javadoc")\r
46ab8ce3
FC
24public class TmfFilterOrNode extends TmfFilterTreeNode {\r
25\r
0283f7ff 26 public static final String NODE_NAME = "OR"; //$NON-NLS-1$\r
46ab8ce3 27 public static final String NOT_ATTR = "not"; //$NON-NLS-1$\r
0283f7ff 28\r
46ab8ce3 29 private boolean fNot = false;\r
0283f7ff
FC
30\r
31 /**\r
32 * @param parent the parent node\r
33 */\r
46ab8ce3
FC
34 public TmfFilterOrNode(ITmfFilterTreeNode parent) {\r
35 super(parent);\r
36 }\r
37\r
38 @Override\r
39 public String getNodeName() {\r
40 return NODE_NAME;\r
41 }\r
42\r
0283f7ff
FC
43 /**\r
44 * @return the NOT state\r
45 */\r
46ab8ce3
FC
46 public boolean isNot() {\r
47 return fNot;\r
48 }\r
0283f7ff
FC
49\r
50 /**\r
51 * @param not the NOT state\r
52 */\r
46ab8ce3
FC
53 public void setNot(boolean not) {\r
54 this.fNot = not;\r
55 }\r
0283f7ff 56\r
46ab8ce3 57 @Override\r
a96d4804 58 public boolean matches(ITmfEvent event) {\r
46ab8ce3
FC
59 for (ITmfFilterTreeNode node : getChildren()) {\r
60 if (node.matches(event)) {\r
61 return true ^ fNot;\r
62 }\r
63 }\r
64 return false & fNot;\r
65 }\r
66\r
67 @Override\r
68 public String toString() {\r
69 StringBuffer buf = new StringBuffer();\r
70 if (fNot) {\r
71 buf.append("not "); //$NON-NLS-1$\r
72 }\r
73 if (getParent() != null && !(getParent() instanceof TmfFilterRootNode) && !(getParent() instanceof TmfFilterNode)) {\r
74 buf.append("( "); //$NON-NLS-1$\r
75 }\r
76 for (int i = 0; i < getChildrenCount(); i++) {\r
77 ITmfFilterTreeNode node = getChildren()[i];\r
78 buf.append(node.toString());\r
79 if (i < getChildrenCount() - 1) {\r
80 buf.append(" or "); //$NON-NLS-1$\r
81 }\r
82 }\r
83 if (getParent() != null && !(getParent() instanceof TmfFilterRootNode) && !(getParent() instanceof TmfFilterNode)) {\r
84 buf.append(" )"); //$NON-NLS-1$\r
85 }\r
86 return buf.toString();\r
87 }\r
88}\r
This page took 0.035818 seconds and 5 git commands to generate.