Commit | Line | Data |
---|---|---|
b6eb4dce VP |
1 | /******************************************************************************* |
2 | * Copyright (c) 2014 Ericsson | |
3 | * | |
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 | |
8 | * | |
9 | * Contributors: | |
10 | * Vincent Perot - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
2bdf0193 | 13 | package org.eclipse.tracecompass.internal.tmf.pcap.core.event; |
b6eb4dce | 14 | |
71f2817f | 15 | import org.eclipse.tracecompass.internal.pcap.core.packet.Packet; |
2bdf0193 AM |
16 | import org.eclipse.tracecompass.tmf.core.event.ITmfEventField; |
17 | import org.eclipse.tracecompass.tmf.core.event.TmfEventField; | |
b6eb4dce VP |
18 | |
19 | /** | |
20 | * Class that represents a TMF Pcap Event Field. It is identical to a | |
21 | * TmfEventField, except that it overrides the toString() method. | |
22 | * | |
23 | * @author Vincent Perot | |
24 | */ | |
25 | public class PcapEventField extends TmfEventField { | |
26 | ||
27 | private final String fSummaryString; | |
28 | ||
29 | /** | |
30 | * Full constructor | |
31 | * | |
32 | * @param name | |
33 | * The event field id. | |
34 | * @param value | |
35 | * The event field value. | |
36 | * @param fields | |
37 | * The list of subfields. | |
38 | * @param packet | |
39 | * The packet from which to take the fields from. | |
40 | * @throws IllegalArgumentException | |
41 | * If 'name' is null, or if 'fields' has duplicate field names. | |
42 | */ | |
aa353506 | 43 | public PcapEventField(String name, Object value, ITmfEventField[] fields, Packet packet) { |
b6eb4dce VP |
44 | super(name, value, fields); |
45 | fSummaryString = packet.getLocalSummaryString(); | |
46 | } | |
47 | ||
48 | /** | |
49 | * Copy constructor | |
50 | * | |
51 | * @param field | |
52 | * the other event field | |
53 | */ | |
54 | public PcapEventField(final PcapEventField field) { | |
55 | super(field); | |
56 | fSummaryString = field.fSummaryString; | |
57 | } | |
58 | ||
59 | @Override | |
60 | public String toString() { | |
61 | return fSummaryString; | |
62 | } | |
63 | } |