ss: Move plugins to Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / filter / model / TmfFilterEventTypeNode.java
index 4da5bd32c358d80fd82c9cfe8f66933244f04502..55bead9a1bfd242c0db8c195b4a8d301485e5860 100644 (file)
@@ -26,52 +26,90 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 @SuppressWarnings("javadoc")
 public class TmfFilterEventTypeNode extends TmfFilterTreeNode {
 
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((fName == null) ? 0 : fName.hashCode());
+        result = prime * result + ((fType == null) ? 0 : fType.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        TmfFilterEventTypeNode other = (TmfFilterEventTypeNode) obj;
+        if (fName == null) {
+            if (other.fName != null) {
+                return false;
+            }
+        } else if (!fName.equals(other.fName)) {
+            return false;
+        }
+        if (fType == null) {
+            if (other.fType != null) {
+                return false;
+            }
+        } else if (!fType.equals(other.fType)) {
+            return false;
+        }
+        return true;
+    }
+
     public static final String NODE_NAME = "EVENTTYPE"; //$NON-NLS-1$
-       public static final String TYPE_ATTR = "type"; //$NON-NLS-1$
-       public static final String NAME_ATTR = "name"; //$NON-NLS-1$
-
-       private String fType;
-       private String fName;
-
-       /**
-        * @param parent the parent node
-        */
-       public TmfFilterEventTypeNode(ITmfFilterTreeNode parent) {
-               super(parent);
-       }
-
-       @Override
-       public String getNodeName() {
-               return NODE_NAME;
-       }
-
-       /**
-        * @return the event type
-        */
-       public String getEventType() {
-               return fType;
-       }
-
-       /**
-        * @param type the event type
-        */
-       public void setEventType(String type) {
-               this.fType = type;
-       }
-
-       /**
-        * @return TBD
-        */
-       public String getName() {
-               return fName;
-       }
-
-       /**
-        * @param name TBD
-        */
-       public void setName(String name) {
-               this.fName = name;
-       }
+    public static final String TYPE_ATTR = "type"; //$NON-NLS-1$
+    public static final String NAME_ATTR = "name"; //$NON-NLS-1$
+
+    private String fType;
+    private String fName;
+
+    /**
+     * @param parent the parent node
+     */
+    public TmfFilterEventTypeNode(ITmfFilterTreeNode parent) {
+        super(parent);
+    }
+
+    @Override
+    public String getNodeName() {
+        return NODE_NAME;
+    }
+
+    /**
+     * @return the event type
+     */
+    public String getEventType() {
+        return fType;
+    }
+
+    /**
+     * @param type the event type
+     */
+    public void setEventType(String type) {
+        this.fType = type;
+    }
+
+    /**
+     * @return the category and trace type name
+     */
+    public String getName() {
+        return fName;
+    }
+
+    /**
+     * @param name the category and trace type name
+     */
+    public void setName(String name) {
+        this.fName = name;
+    }
 
     @Override
     public boolean matches(ITmfEvent event) {
@@ -100,34 +138,34 @@ public class TmfFilterEventTypeNode extends TmfFilterTreeNode {
         return false;
     }
 
-       @Override
-       public List<String> getValidChildren() {
-               if (getChildrenCount() == 0) {
-                       return super.getValidChildren();
-               }
+    @Override
+    public List<String> getValidChildren() {
+        if (getChildrenCount() == 0) {
+            return super.getValidChildren();
+        }
         return new ArrayList<>(0); // only one child allowed
-       }
-
-       @Override
-       public String toString() {
-               StringBuffer buf = new StringBuffer();
-               buf.append("EventType is " + fName); //$NON-NLS-1$
-               if (getChildrenCount() > 0) {
-                       buf.append(" and "); //$NON-NLS-1$
-               }
-               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();
-       }
+    }
+
+    @Override
+    public String toString() {
+        StringBuffer buf = new StringBuffer();
+        buf.append("EventType is " + fName); //$NON-NLS-1$
+        if (getChildrenCount() > 0) {
+            buf.append(" and "); //$NON-NLS-1$
+        }
+        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();
+    }
 }
This page took 0.028872 seconds and 5 git commands to generate.