1 /*******************************************************************************
2 * Copyright (c) 2009, 2014 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Francois Chouinard - Initial API and implementation
11 * Francois Chouinard - Updated as per TMF Event Model 1.0
12 *******************************************************************************/
14 package org
.eclipse
.tracecompass
.tmf
.core
.event
;
16 import java
.util
.Collection
;
17 import java
.util
.Collections
;
19 import org
.eclipse
.jdt
.annotation
.NonNull
;
22 * A basic implementation of ITmfEventType.
25 * @author Francois Chouinard
30 public class TmfEventType
implements ITmfEventType
{
32 // ------------------------------------------------------------------------
34 // ------------------------------------------------------------------------
36 private final @NonNull String fTypeId
;
37 private final ITmfEventField fRootField
;
39 // ------------------------------------------------------------------------
41 // ------------------------------------------------------------------------
46 public TmfEventType() {
47 this(DEFAULT_TYPE_ID
, null);
53 * @param typeId the type name
54 * @param root the root field
56 public TmfEventType(final @NonNull String typeId
, final ITmfEventField root
) {
64 * @param type the other type
66 public TmfEventType(@NonNull ITmfEventType type
) {
67 fTypeId
= type
.getName();
68 fRootField
= type
.getRootField();
71 // ------------------------------------------------------------------------
73 // ------------------------------------------------------------------------
76 public String
getName() {
81 public ITmfEventField
getRootField() {
86 public Collection
<String
> getFieldNames() {
87 return (fRootField
!= null) ? fRootField
.getFieldNames() : Collections
.EMPTY_SET
;
90 // ------------------------------------------------------------------------
92 // ------------------------------------------------------------------------
95 public int hashCode() {
98 result
= prime
* result
+ fTypeId
.hashCode();
103 public boolean equals(final Object obj
) {
110 if (!(obj
instanceof TmfEventType
)) {
113 final TmfEventType other
= (TmfEventType
) obj
;
114 if (!fTypeId
.equals(other
.fTypeId
)) {
121 @SuppressWarnings("nls")
122 public String
toString() {
123 return "TmfEventType [fTypeId=" + fTypeId
+ "]";