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 // ------------------------------------------------------------------------
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;
59 private long indexBegin
= Long
.MAX_VALUE
;
61 private long indexEnd
= Long
.MAX_VALUE
;
63 // ------------------------------------------------------------------------
65 // ------------------------------------------------------------------------
68 * Constructs an index entry.
71 * The offset of the packet in the file, in bytes.
74 public StreamInputPacketIndexEntry(long offset
) {
75 this.offsetBytes
= offset
;
78 // ------------------------------------------------------------------------
80 // ------------------------------------------------------------------------
83 * Returns whether the packet includes (inclusively) the given timestamp in
84 * the begin-end timestamp range.
87 * The timestamp to check.
88 * @return True if the packet includes the timestamp.
90 boolean includes(long ts
) {
91 return (ts
>= timestampBegin
) && (ts
<= timestampEnd
);
94 boolean includesIndex(long index
){
95 return (index
>= indexBegin
) && (index
<= indexEnd
);
98 * @see java.lang.Object#toString()
101 public String
toString() {
102 return "StreamInputPacketIndexEntry [offsetBytes=" + offsetBytes
//$NON-NLS-1$
103 + ", timestampBegin=" + timestampBegin
+ ", timestampEnd=" //$NON-NLS-1$ //$NON-NLS-2$
104 + timestampEnd
+ ", indexBegin=" + indexBegin
+ ", indexEnd=" //$NON-NLS-1$ //$NON-NLS-2$
105 + indexEnd
+ "]"; //$NON-NLS-1$
108 // ------------------------------------------------------------------------
109 // Getters and Setters
110 // ------------------------------------------------------------------------
113 * @return the offsetBytes
115 public long getOffsetBytes() {
120 * @return the dataOffsetBits
122 public int getDataOffsetBits() {
123 return dataOffsetBits
;
127 * @param dataOffsetBits the dataOffsetBits to set
129 public void setDataOffsetBits(int dataOffsetBits
) {
130 this.dataOffsetBits
= dataOffsetBits
;
134 * @return the packetSizeBits
136 public int getPacketSizeBits() {
137 return packetSizeBits
;
141 * @param packetSizeBits the packetSizeBits to set
143 public void setPacketSizeBits(int packetSizeBits
) {
144 this.packetSizeBits
= packetSizeBits
;
148 * @return the contentSizeBits
150 public int getContentSizeBits() {
151 return contentSizeBits
;
155 * @param contentSizeBits 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 the timestampBegin to set
171 public void setTimestampBegin(long timestampBegin
) {
172 this.timestampBegin
= timestampBegin
;
176 * @return the timestampEnd
178 public long getTimestampEnd() {
183 * @param timestampEnd the timestampEnd to set
185 public void setTimestampEnd(long timestampEnd
) {
186 this.timestampEnd
= timestampEnd
;
190 * @return the indexBegin
192 public long getIndexBegin() {
197 * @param indexBegin the indexBegin to set
199 public void setIndexBegin(long indexBegin
) {
200 this.indexBegin
= indexBegin
;
204 * @return the indexEnd
206 public long getIndexEnd() {
211 * @param indexEnd the indexEnd to set
213 public void setIndexEnd(long indexEnd
) {
214 this.indexEnd
= indexEnd
;