1 /*******************************************************************************
2 * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
4 * All rights reserved. This program and the accompanying materials are made
5 * 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
9 * Contributors: Matthew Khouzam - Initial API and implementation
10 * Contributors: Simon Marchi - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.internal
.ctf
.core
.trace
;
16 * <b><u>StreamInputPacketIndexEntry</u></b>
18 * Represents an entry in the index of event packets.
20 public class StreamInputPacketIndexEntry
{
22 // ------------------------------------------------------------------------
24 // ------------------------------------------------------------------------
28 * Offset of the packet in the file, in bytes
30 final private long offsetBytes
;
33 * Offset of the data in the packet, in bits
35 private int dataOffsetBits
= 0;
38 * Packet size, in bits
40 private int packetSizeBits
= 0;
43 * Content size, in bits
45 private int contentSizeBits
= 0;
50 private long timestampBegin
= 0;
55 private long timestampEnd
= 0;
58 * How many lost events are there?
60 private long lostEvents
= 0;
62 // ------------------------------------------------------------------------
64 // ------------------------------------------------------------------------
67 * Constructs an index entry.
70 * The offset of the packet in the file, in bytes.
73 public StreamInputPacketIndexEntry(long offset
) {
74 this.offsetBytes
= offset
;
77 // ------------------------------------------------------------------------
79 // ------------------------------------------------------------------------
82 * Returns whether the packet includes (inclusively) the given timestamp in
83 * the begin-end timestamp range.
86 * The timestamp to check.
87 * @return True if the packet includes the timestamp.
89 boolean includes(long ts
) {
90 return (ts
>= timestampBegin
) && (ts
<= timestampEnd
);
96 * @see java.lang.Object#toString()
99 public String
toString() {
100 return "StreamInputPacketIndexEntry [offsetBytes=" + offsetBytes
//$NON-NLS-1$
101 + ", timestampBegin=" + timestampBegin
+ ", timestampEnd=" //$NON-NLS-1$ //$NON-NLS-2$
102 + timestampEnd
+ "]"; //$NON-NLS-1$
105 // ------------------------------------------------------------------------
106 // Getters and Setters
107 // ------------------------------------------------------------------------
110 * @return the offsetBytes
112 public long getOffsetBytes() {
117 * @return the dataOffsetBits
119 public int getDataOffsetBits() {
120 return dataOffsetBits
;
124 * @param dataOffsetBits
125 * the dataOffsetBits to set
127 public void setDataOffsetBits(int dataOffsetBits
) {
128 this.dataOffsetBits
= dataOffsetBits
;
132 * @return the packetSizeBits
134 public int getPacketSizeBits() {
135 return packetSizeBits
;
139 * @param packetSizeBits
140 * the packetSizeBits to set
142 public void setPacketSizeBits(int packetSizeBits
) {
143 this.packetSizeBits
= packetSizeBits
;
147 * @return the contentSizeBits
149 public int getContentSizeBits() {
150 return contentSizeBits
;
154 * @param contentSizeBits
155 * the contentSizeBits to set
157 public void setContentSizeBits(int contentSizeBits
) {
158 this.contentSizeBits
= contentSizeBits
;
162 * @return the timestampBegin
164 public long getTimestampBegin() {
165 return timestampBegin
;
169 * @param timestampBegin
170 * the timestampBegin to set
172 public void setTimestampBegin(long timestampBegin
) {
173 this.timestampBegin
= timestampBegin
;
177 * @return the timestampEnd
179 public long getTimestampEnd() {
184 * @param timestampEnd
185 * the timestampEnd to set
187 public void setTimestampEnd(long timestampEnd
) {
188 this.timestampEnd
= timestampEnd
;
192 * @return the lostEvents
194 public long getLostEvents() {
199 * @param lostEvents the lostEvents to set
201 public void setLostEvents(long lostEvents
) {
202 this.lostEvents
= lostEvents
;