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;
57 // ------------------------------------------------------------------------
59 // ------------------------------------------------------------------------
62 * Constructs an index entry.
65 * The offset of the packet in the file, in bytes.
68 public StreamInputPacketIndexEntry(long offset
) {
69 this.offsetBytes
= offset
;
72 // ------------------------------------------------------------------------
74 // ------------------------------------------------------------------------
77 * Returns whether the packet includes (inclusively) the given timestamp in
78 * the begin-end timestamp range.
81 * The timestamp to check.
82 * @return True if the packet includes the timestamp.
84 boolean includes(long ts
) {
85 return (ts
>= timestampBegin
) && (ts
<= timestampEnd
);
91 * @see java.lang.Object#toString()
94 public String
toString() {
95 return "StreamInputPacketIndexEntry [offsetBytes=" + offsetBytes
//$NON-NLS-1$
96 + ", timestampBegin=" + timestampBegin
+ ", timestampEnd=" //$NON-NLS-1$ //$NON-NLS-2$
97 + timestampEnd
+ "]"; //$NON-NLS-1$
100 // ------------------------------------------------------------------------
101 // Getters and Setters
102 // ------------------------------------------------------------------------
105 * @return the offsetBytes
107 public long getOffsetBytes() {
112 * @return the dataOffsetBits
114 public int getDataOffsetBits() {
115 return dataOffsetBits
;
119 * @param dataOffsetBits
120 * the dataOffsetBits to set
122 public void setDataOffsetBits(int dataOffsetBits
) {
123 this.dataOffsetBits
= dataOffsetBits
;
127 * @return the packetSizeBits
129 public int getPacketSizeBits() {
130 return packetSizeBits
;
134 * @param packetSizeBits
135 * the packetSizeBits to set
137 public void setPacketSizeBits(int packetSizeBits
) {
138 this.packetSizeBits
= packetSizeBits
;
142 * @return the contentSizeBits
144 public int getContentSizeBits() {
145 return contentSizeBits
;
149 * @param contentSizeBits
150 * the contentSizeBits to set
152 public void setContentSizeBits(int contentSizeBits
) {
153 this.contentSizeBits
= contentSizeBits
;
157 * @return the timestampBegin
159 public long getTimestampBegin() {
160 return timestampBegin
;
164 * @param timestampBegin
165 * the timestampBegin to set
167 public void setTimestampBegin(long timestampBegin
) {
168 this.timestampBegin
= timestampBegin
;
172 * @return the timestampEnd
174 public long getTimestampEnd() {
179 * @param timestampEnd
180 * the timestampEnd to set
182 public void setTimestampEnd(long timestampEnd
) {
183 this.timestampEnd
= timestampEnd
;