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
;
20 * A basic implementation of ITmfEventType.
23 * @author Francois Chouinard
28 public class TmfEventType
implements ITmfEventType
{
30 // ------------------------------------------------------------------------
32 // ------------------------------------------------------------------------
34 private final String fTypeId
;
35 private final ITmfEventField fRootField
;
37 // ------------------------------------------------------------------------
39 // ------------------------------------------------------------------------
44 public TmfEventType() {
45 this(DEFAULT_TYPE_ID
, null);
51 * @param typeId the type name
52 * @param root the root field
54 public TmfEventType(final String typeId
, final ITmfEventField root
) {
56 throw new IllegalArgumentException();
65 * @param type the other type
67 public TmfEventType(final ITmfEventType type
) {
69 throw new IllegalArgumentException();
71 fTypeId
= type
.getName();
72 fRootField
= type
.getRootField();
75 // ------------------------------------------------------------------------
77 // ------------------------------------------------------------------------
80 public String
getName() {
85 public ITmfEventField
getRootField() {
90 public Collection
<String
> getFieldNames() {
91 return (fRootField
!= null) ? fRootField
.getFieldNames() : Collections
.EMPTY_SET
;
94 // ------------------------------------------------------------------------
96 // ------------------------------------------------------------------------
99 public int hashCode() {
100 final int prime
= 31;
102 result
= prime
* result
+ fTypeId
.hashCode();
107 public boolean equals(final Object obj
) {
114 if (!(obj
instanceof TmfEventType
)) {
117 final TmfEventType other
= (TmfEventType
) obj
;
118 if (!fTypeId
.equals(other
.fTypeId
)) {
125 @SuppressWarnings("nls")
126 public String
toString() {
127 return "TmfEventType [fTypeId=" + fTypeId
+ "]";