tmf: Transition custom parsers to the new location
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / event / TmfEventType.java
index b683b5c7f28a66c0a1c0f3057527f3f360354cdc..9cc400a0a952011f61727b5fb92b675536201ff1 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2012 Ericsson
- * 
+ * Copyright (c) 2009, 2013 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:
  *   Francois Chouinard - Initial API and implementation
  *   Francois Chouinard - Updated as per TMF Event Model 1.0
 
 package org.eclipse.linuxtools.tmf.core.event;
 
-
 /**
- * <b><u>TmfEventType</u></b>
- * <p>
  * A basic implementation of ITmfEventType.
+ *
+ * @version 1.0
+ * @author Francois Chouinard
+ *
+ * @see ITmfEvent
+ * @see ITmfEventField
  */
 public class TmfEventType implements ITmfEventType {
 
@@ -25,9 +28,9 @@ public class TmfEventType implements ITmfEventType {
     // Attributes
     // ------------------------------------------------------------------------
 
-    private String fContext;
-    private String fTypeId;
-    private ITmfEventField fRootField;
+    private final String fContext;
+    private final String fTypeId;
+    private final ITmfEventField fRootField;
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -42,14 +45,15 @@ public class TmfEventType implements ITmfEventType {
 
     /**
      * Full constructor
-     * 
+     *
      * @param context the type context
      * @param typeId the type name
      * @param root the root field
      */
     public TmfEventType(final String context, final String typeId, final ITmfEventField root) {
-        if (context == null || typeId == null)
+        if (context == null || typeId == null) {
             throw new IllegalArgumentException();
+        }
         fContext = context;
         fTypeId = typeId;
         fRootField = root;
@@ -60,12 +64,13 @@ public class TmfEventType implements ITmfEventType {
 
     /**
      * Copy constructor
-     * 
+     *
      * @param type the other type
      */
     public TmfEventType(final ITmfEventType type) {
-        if (type == null)
+        if (type == null) {
             throw new IllegalArgumentException();
+        }
         fContext = type.getContext();
         fTypeId  = type.getName();
         fRootField = type.getRootField();
@@ -75,74 +80,35 @@ public class TmfEventType implements ITmfEventType {
     // ITmfEventType
     // ------------------------------------------------------------------------
 
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventType#getContext()
-     */
     @Override
     public String getContext() {
         return fContext;
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventType#getName()
-     */
     @Override
     public String getName() {
         return fTypeId;
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventType#getRootField()
-     */
     @Override
     public ITmfEventField getRootField() {
         return fRootField;
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventType#getFieldNames()
-     */
     @Override
     public String[] getFieldNames() {
-        return (fRootField != null) ? fRootField.getFieldNames() : null;
+        return (fRootField != null) ? fRootField.getFieldNames() : new String[0];
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventType#getFieldName(int)
-     */
     @Override
     public String getFieldName(final int index) {
         return (fRootField != null) ? fRootField.getFieldName(index) : null;
     }
 
-    // ------------------------------------------------------------------------
-    // Cloneable
-    // ------------------------------------------------------------------------
-
-    /* (non-Javadoc)
-     * @see java.lang.Object#clone()
-     */
-    @Override
-    public TmfEventType clone() {
-        TmfEventType clone = null;
-        try {
-            clone = (TmfEventType) super.clone();
-            clone.fContext = fContext;
-            clone.fTypeId = fTypeId;
-            clone.fRootField = (fRootField != null) ? fRootField.clone() : null;
-        }
-        catch (final CloneNotSupportedException e) {
-        }
-        return clone;
-    }
-
     // ------------------------------------------------------------------------
     // Object
     // ------------------------------------------------------------------------
 
-    /* (non-Javadoc)
-     * @see java.lang.Object#hashCode()
-     */
     @Override
     public int hashCode() {
         final int prime = 31;
@@ -152,32 +118,31 @@ public class TmfEventType implements ITmfEventType {
         return result;
     }
 
-    /* (non-Javadoc)
-     * @see java.lang.Object#equals(java.lang.Object)
-     */
     @Override
     public boolean equals(final Object obj) {
-        if (this == obj)
+        if (this == obj) {
             return true;
-        if (obj == null)
+        }
+        if (obj == null) {
             return false;
-        if (!(obj instanceof TmfEventType))
+        }
+        if (!(obj instanceof TmfEventType)) {
             return false;
+        }
         final TmfEventType other = (TmfEventType) obj;
-        if (!fContext.equals(other.fContext))
+        if (!fContext.equals(other.fContext)) {
             return false;
-        if (!fTypeId.equals(other.fTypeId))
+        }
+        if (!fTypeId.equals(other.fTypeId)) {
             return false;
+        }
         return true;
     }
 
-    /* (non-Javadoc)
-     * @see java.lang.Object#toString()
-     */
     @Override
     @SuppressWarnings("nls")
     public String toString() {
         return "TmfEventType [fContext=" + fContext + ", fTypeId=" + fTypeId + "]";
     }
 
-}
\ No newline at end of file
+}
This page took 0.028486 seconds and 5 git commands to generate.