1 /*******************************************************************************
2 * Copyright (c) 2009 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 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.core
.event
;
16 * <b><u>TmfEventField</u></b>
18 * A basic event field.
20 * TODO: Add support for field hierarchy.
22 public class TmfEventField
implements Cloneable
{
24 // ------------------------------------------------------------------------
26 // ------------------------------------------------------------------------
28 protected TmfEventContent fParent
;
29 protected String fFieldId
;
30 protected Object fValue
;
32 // ------------------------------------------------------------------------
34 // ------------------------------------------------------------------------
36 @SuppressWarnings("unused")
37 private TmfEventField() {
38 throw new AssertionError();
46 public TmfEventField(TmfEventContent parent
, String id
, Object value
) {
48 throw new IllegalArgumentException();
58 public TmfEventField(TmfEventField other
) {
60 throw new IllegalArgumentException();
61 fParent
= other
.fParent
;
62 fFieldId
= other
.fFieldId
;
63 fValue
= other
.fValue
;
66 // ------------------------------------------------------------------------
68 // ------------------------------------------------------------------------
73 public TmfEventContent
getParent() {
80 public String
getId() {
87 public Object
getValue() {
92 * @param value new field value
94 protected void setValue(Object value
) {
98 // ------------------------------------------------------------------------
100 // ------------------------------------------------------------------------
103 public int hashCode() {
105 result
= 37 * result
+ fFieldId
.hashCode();
106 result
= 37 * result
+ fValue
.hashCode();
111 public boolean equals(Object other
) {
112 if (!(other
instanceof TmfEventField
))
114 TmfEventField o
= (TmfEventField
) other
;
115 return fParent
.equals(o
.fParent
) && fFieldId
.equals(o
.fFieldId
) && fValue
.equals(o
.fValue
);
119 @SuppressWarnings("nls")
120 public String
toString() {
121 return "[TmfEventField(" + fFieldId
+ ":" + fValue
.toString() + ")]";
124 public TmfEventField
clone() {
125 TmfEventField clone
= null;
127 clone
= (TmfEventField
) super.clone();
128 clone
.fParent
= fParent
;
129 clone
.fFieldId
= new String(fFieldId
);
131 } catch (CloneNotSupportedException e
) {