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 // ------------------------------------------------------------------------
26 public static final long INVALID_INDEX
= Long
.MAX_VALUE
;
29 * Offset of the packet in the file, in bytes
31 final private long offsetBytes
;
34 * Offset of the data in the packet, in bits
36 private int dataOffsetBits
= 0;
39 * Packet size, in bits
41 private int packetSizeBits
= 0;
44 * Content size, in bits
46 private int contentSizeBits
= 0;
51 private long timestampBegin
= 0;
56 private long timestampEnd
= 0;
58 // ------------------------------------------------------------------------
60 // ------------------------------------------------------------------------
63 * Constructs an index entry.
66 * The offset of the packet in the file, in bytes.
69 public StreamInputPacketIndexEntry(long offset
) {
70 this.offsetBytes
= offset
;
73 // ------------------------------------------------------------------------
75 // ------------------------------------------------------------------------
78 * Returns whether the packet includes (inclusively) the given timestamp in
79 * the begin-end timestamp range.
82 * The timestamp to check.
83 * @return True if the packet includes the timestamp.
85 boolean includes(long ts
) {
86 return (ts
>= timestampBegin
) && (ts
<= timestampEnd
);
92 * @see java.lang.Object#toString()
95 public String
toString() {
96 return "StreamInputPacketIndexEntry [offsetBytes=" + offsetBytes
//$NON-NLS-1$
97 + ", timestampBegin=" + timestampBegin
+ ", timestampEnd=" //$NON-NLS-1$ //$NON-NLS-2$
98 + timestampEnd
+ "]"; //$NON-NLS-1$
101 // ------------------------------------------------------------------------
102 // Getters and Setters
103 // ------------------------------------------------------------------------
106 * @return the offsetBytes
108 public long getOffsetBytes() {
113 * @return the dataOffsetBits
115 public int getDataOffsetBits() {
116 return dataOffsetBits
;
120 * @param dataOffsetBits
121 * the dataOffsetBits to set
123 public void setDataOffsetBits(int dataOffsetBits
) {
124 this.dataOffsetBits
= dataOffsetBits
;
128 * @return the packetSizeBits
130 public int getPacketSizeBits() {
131 return packetSizeBits
;
135 * @param packetSizeBits
136 * the packetSizeBits to set
138 public void setPacketSizeBits(int packetSizeBits
) {
139 this.packetSizeBits
= packetSizeBits
;
143 * @return the contentSizeBits
145 public int getContentSizeBits() {
146 return contentSizeBits
;
150 * @param contentSizeBits
151 * the contentSizeBits to set
153 public void setContentSizeBits(int contentSizeBits
) {
154 this.contentSizeBits
= contentSizeBits
;
158 * @return the timestampBegin
160 public long getTimestampBegin() {
161 return timestampBegin
;
165 * @param timestampBegin
166 * the timestampBegin to set
168 public void setTimestampBegin(long timestampBegin
) {
169 this.timestampBegin
= timestampBegin
;
173 * @return the timestampEnd
175 public long getTimestampEnd() {
180 * @param timestampEnd
181 * the timestampEnd to set
183 public void setTimestampEnd(long timestampEnd
) {
184 this.timestampEnd
= timestampEnd
;