Merge branch 'master' into lttng-kepler
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / filter / model / TmfFilterContainsNode.java
index a00af6f4ec7db3ecd8ff86f58f5e73ae530b23c2..97410f98f34bf8d107f4f259d7baa75c8fc799de 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
- * Filter node for the 'contains' operation\r
- *\r
- * @version 1.0\r
- * @author Patrick Tasse\r
- */\r
-@SuppressWarnings("javadoc")\r
-public class TmfFilterContainsNode extends TmfFilterTreeNode {\r
-\r
-       public static final String NODE_NAME = "CONTAINS"; //$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 String fValueUpperCase;\r
-       private boolean fIgnoreCase = false;\r
-\r
-       /**\r
-        * @param parent the parent node\r
-        */\r
-       public TmfFilterContainsNode(ITmfFilterTreeNode parent) {\r
-               super(parent);\r
-       }\r
-\r
-       /**\r
-        * @return the NOT state\r
-        */\r
-       public boolean isNot() {\r
-               return fNot;\r
-       }\r
-\r
-       /**\r
-        * @param not the NOT state\r
-        */\r
-       public void setNot(boolean not) {\r
-               this.fNot = not;\r
-       }\r
-\r
-       /**\r
-        * @return the field name\r
-        */\r
-       public String getField() {\r
-               return fField;\r
-       }\r
-\r
-       /**\r
-        * @param field the field name\r
-        */\r
-       public void setField(String field) {\r
-               this.fField = field;\r
-       }\r
-\r
-       /**\r
-        * @return the contains value\r
-        */\r
-       public String getValue() {\r
-               return fValue;\r
-       }\r
-\r
-       /**\r
-        * @param value the contains value\r
-        */\r
-       public void setValue(String value) {\r
-               this.fValue = value;\r
-               fValueUpperCase = value.toUpperCase();\r
-       }\r
-\r
-       /**\r
-        * @return the ignoreCase state\r
-        */\r
-       public boolean isIgnoreCase() {\r
-               return fIgnoreCase;\r
-       }\r
-\r
-       /**\r
-        * @param ignoreCase the ignoreCase state\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 (fIgnoreCase) {\r
-            return valueString.toUpperCase().contains(fValueUpperCase) ^ fNot;\r
-        }\r
-        return valueString.contains(fValue) ^ fNot;\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" : "") + " contains \"" + fValue + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$\r
-       }\r
-\r
-       @Override\r
-       public ITmfFilterTreeNode clone() {\r
-               TmfFilterContainsNode clone = (TmfFilterContainsNode) super.clone();\r
-               clone.fField = fField;\r
-               clone.setValue(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 'contains' operation
+ *
+ * @version 1.0
+ * @author Patrick Tasse
+ */
+@SuppressWarnings("javadoc")
+public class TmfFilterContainsNode extends TmfFilterTreeNode {
+
+       public static final String NODE_NAME = "CONTAINS"; //$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 String fValueUpperCase;
+       private boolean fIgnoreCase = false;
+
+       /**
+        * @param parent the parent node
+        */
+       public TmfFilterContainsNode(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 contains value
+        */
+       public String getValue() {
+               return fValue;
+       }
+
+       /**
+        * @param value the contains value
+        */
+       public void setValue(String value) {
+               this.fValue = value;
+               fValueUpperCase = value.toUpperCase();
+       }
+
+       /**
+        * @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 (fIgnoreCase) {
+            return valueString.toUpperCase().contains(fValueUpperCase) ^ fNot;
+        }
+        return valueString.contains(fValue) ^ fNot;
+       }
+
+       @Override
+       public List<String> getValidChildren() {
+               return new ArrayList<String>(0);
+       }
+
+       @Override
+       public String toString() {
+               return fField + (fNot ? " not" : "") + " contains \"" + fValue + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+       }
+
+       @Override
+       public ITmfFilterTreeNode clone() {
+               TmfFilterContainsNode clone = (TmfFilterContainsNode) super.clone();
+               clone.fField = fField;
+               clone.setValue(fValue);
+               return clone;
+       }
+}
This page took 0.032615 seconds and 5 git commands to generate.