Merge branch 'master' into lttng-kepler
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / filter / model / TmfFilterEqualsNode.java
index 52231427e4bff75e3dfee82c26dd6025ae93dcb7..9bd3efda64dd02e88624f9bd9c583ff20785a63f 100644 (file)
-/*******************************************************************************\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
-public class TmfFilterEqualsNode extends TmfFilterTreeNode {\r
-\r
-       public static final String NODE_NAME = "EQUALS"; //$NON-NLS-1$\r
-       public static final String NOT_ATTR = "not"; //$NON-NLS-1$\r
-       public static final String FIELD_ATTR = "field"; //$NON-NLS-1$\r
-       public static final String VALUE_ATTR = "value"; //$NON-NLS-1$\r
-       public static final String IGNORECASE_ATTR = "ignorecase"; //$NON-NLS-1$\r
-       \r
-       private boolean fNot = false;\r
-       private String fField;\r
-       private String fValue;\r
-       private boolean fIgnoreCase = false;\r
-       \r
-       public TmfFilterEqualsNode(ITmfFilterTreeNode parent) {\r
-               super(parent);\r
-       }\r
-\r
-       public boolean isNot() {\r
-               return fNot;\r
-       }\r
-       \r
-       public void setNot(boolean not) {\r
-               this.fNot = not;\r
-       }\r
-       \r
-       public String getField() {\r
-               return fField;\r
-       }\r
-\r
-       public void setField(String field) {\r
-               this.fField = field;\r
-       }\r
-\r
-       public String getValue() {\r
-               return fValue;\r
-       }\r
-\r
-       public void setValue(String value) {\r
-               this.fValue = value;\r
-       }\r
-\r
-       public boolean isIgnoreCase() {\r
-               return fIgnoreCase;\r
-       }\r
-       \r
-       public void setIgnoreCase(boolean ignoreCase) {\r
-               this.fIgnoreCase = ignoreCase;\r
-       }\r
-       \r
-       @Override\r
-       public String getNodeName() {\r
-               return NODE_NAME;\r
-       }\r
-\r
-       @Override\r
-       public boolean matches(ITmfEvent event) {\r
-        Object value = getFieldValue(event, fField);\r
-        if (value == null) {\r
-            return false ^ fNot;\r
-        }\r
-        String valueString = value.toString();\r
-        if (valueString == null) {\r
-            return false ^ fNot;\r
-        }\r
-        if (fIgnoreCase) {\r
-            return valueString.equalsIgnoreCase(fValue) ^ fNot;\r
-        } else {\r
-            return valueString.equals(fValue) ^ fNot;\r
-        }\r
-       }\r
-\r
-       @Override\r
-       public List<String> getValidChildren() {\r
-               return new ArrayList<String>(0);\r
-       }\r
-\r
-       @Override\r
-       public String toString() {\r
-               return fField + (fNot ? " not" : "") + " equals \"" + fValue + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$\r
-       }\r
-\r
-       @Override\r
-       public ITmfFilterTreeNode clone() {\r
-               TmfFilterEqualsNode clone = (TmfFilterEqualsNode) super.clone();\r
-               clone.fField = fField;\r
-               clone.fValue = fValue;\r
-               return clone;\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 '==' operation
+ *
+ * @version 1.0
+ * @author Patrick Tasse
+ */
+@SuppressWarnings("javadoc")
+public class TmfFilterEqualsNode extends TmfFilterTreeNode {
+
+    public static final String NODE_NAME = "EQUALS"; //$NON-NLS-1$
+       public static final String NOT_ATTR = "not"; //$NON-NLS-1$
+       public static final String FIELD_ATTR = "field"; //$NON-NLS-1$
+       public static final String VALUE_ATTR = "value"; //$NON-NLS-1$
+       public static final String IGNORECASE_ATTR = "ignorecase"; //$NON-NLS-1$
+
+       private boolean fNot = false;
+       private String fField;
+       private String fValue;
+       private boolean fIgnoreCase = false;
+
+       /**
+        * @param parent the aprent node
+        */
+       public TmfFilterEqualsNode(ITmfFilterTreeNode parent) {
+               super(parent);
+       }
+
+       /**
+        * @return the NOT state
+        */
+       public boolean isNot() {
+               return fNot;
+       }
+
+       /**
+        * @param not the NOT state
+        */
+       public void setNot(boolean not) {
+               this.fNot = not;
+       }
+
+    /**
+     * @return the field name
+     */
+       public String getField() {
+               return fField;
+       }
+
+       /**
+        * @param field the field name
+        */
+       public void setField(String field) {
+               this.fField = field;
+       }
+
+       /**
+        * @return the equals value
+        */
+       public String getValue() {
+               return fValue;
+       }
+
+       /**
+        * @param value the equals value
+        */
+       public void setValue(String value) {
+               this.fValue = value;
+       }
+
+       /**
+        * @return the ignoreCase state
+        */
+       public boolean isIgnoreCase() {
+               return fIgnoreCase;
+       }
+
+       /**
+        * @param ignoreCase the ignoreCase state
+        */
+       public void setIgnoreCase(boolean ignoreCase) {
+               this.fIgnoreCase = ignoreCase;
+       }
+
+       @Override
+       public String getNodeName() {
+               return NODE_NAME;
+       }
+
+       @Override
+       public boolean matches(ITmfEvent event) {
+        Object value = getFieldValue(event, fField);
+        if (value == null) {
+            return false ^ fNot;
+        }
+        String valueString = value.toString();
+        if (valueString == null) {
+            return false ^ fNot;
+        }
+        if (fIgnoreCase) {
+            return valueString.equalsIgnoreCase(fValue) ^ fNot;
+        }
+        return valueString.equals(fValue) ^ fNot;
+       }
+
+       @Override
+       public List<String> getValidChildren() {
+               return new ArrayList<String>(0);
+       }
+
+       @Override
+       public String toString() {
+               return fField + (fNot ? " not" : "") + " equals \"" + fValue + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+       }
+
+       @Override
+       public ITmfFilterTreeNode clone() {
+               TmfFilterEqualsNode clone = (TmfFilterEqualsNode) super.clone();
+               clone.fField = fField;
+               clone.fValue = fValue;
+               return clone;
+       }
+}
This page took 0.027907 seconds and 5 git commands to generate.