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 * William Bourque (wbourque@gmail.com) - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.lttng
.event
;
15 import org
.eclipse
.linuxtools
.tmf
.event
.TmfEventContent
;
18 * <b><u>LttngEventContent</u></b>
20 * Lttng specific implementation of the TmfEventContent
22 * Lttng LttngEventContent is very similar from TMF basic one. <br>
24 public class LttngEventContent
extends TmfEventContent
{
27 * Constructor with parameters<br>
29 * Content will be null as no parsed content is given.
31 * @param thisFormat The LttngEventFormat relative to the JniEvent
33 public LttngEventContent(LttngEventFormat thisFormat
) {
34 super(null, thisFormat
);
38 * Constructor with parameters<br>
40 * @param thisFormat The LttngEventFormat relative to this JniEvent
41 * @param thisParsedContent The string content of the JniEvent, already parsed
44 public LttngEventContent(LttngEventFormat thisFormat
, String thisParsedContent
, LttngEventField
[] thisFields
) {
45 super(thisParsedContent
, thisFormat
);
46 setFields(thisFields
);
51 * @see org.eclipse.linuxtools.tmf.event.TmfEventContent#getFields()
54 public LttngEventField
[] getFields() {
56 // Request the field variable from the inherited class
57 LttngEventField
[] fields
= (LttngEventField
[])super.getFields();
59 // Field may be null if the content hasn't been parse yet
60 // If that's the case, call the parsing function
62 fields
= ((LttngEventFormat
) this.getFormat()).parse(this.getContent());
69 * @see org.eclipse.linuxtools.tmf.event.TmfEventContent#getField(int)
72 public LttngEventField
getField(int id
) {
73 assert id
>= 0 && id
< this.getNbFields();
75 LttngEventField returnedField
= null;
76 LttngEventField
[] allFields
= this.getFields();
78 if ( allFields
!= null ) {
79 returnedField
= allFields
[id
];
89 public LttngEventField
[] getFields(LttngEvent thisEvent
) {
91 // Request the field variable from the inherited class
92 LttngEventField
[] fields
= (LttngEventField
[])super.getFields();
94 // Field may be null if the content hasn't been parse yet
95 // If that's the case, call the parsing function
97 fields
= ((LttngEventFormat
)this.getFormat()).parse(thisEvent
);
108 public LttngEventField
getField(int id
, LttngEvent thisEvent
) {
109 assert id
>= 0 && id
< this.getNbFields();
111 LttngEventField returnedField
= null;
112 LttngEventField
[] allFields
= this.getFields(thisEvent
);
114 if ( allFields
!= null ) {
115 returnedField
= allFields
[id
];
118 return returnedField
;
123 * basic toString() method.
125 * @return Attributes of the object concatenated in String
127 public String
toString() {
128 return getContent().toString();