/*******************************************************************************
- * 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
/**
* A basic implementation of ITmfEventType.
- *
+ *
* @version 1.0
* @author Francois Chouinard
- *
+ *
* @see ITmfEvent
* @see ITmfEventField
*/
-public class TmfEventType implements ITmfEventType, Cloneable {
+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
/**
* Full constructor
- *
+ *
* @param context the type context
* @param typeId the type name
* @param root the root field
/**
* Copy constructor
- *
+ *
* @param type the other type
*/
public TmfEventType(final ITmfEventType type) {
// 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() : 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;
return result;
}
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
@Override
public boolean equals(final Object obj) {
if (this == obj) {
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
+}