Improve javadoc for ctfAdapter in Tmf.Core
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core / src / org / eclipse / linuxtools / internal / ctf / core / trace / StreamInputPacketIndexEntry.java
1 /*******************************************************************************
2 * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
3 *
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
8 *
9 * Contributors: Matthew Khouzam - Initial API and implementation
10 * Contributors: Simon Marchi - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.internal.ctf.core.trace;
14
15 /**
16 * <b><u>StreamInputPacketIndexEntry</u></b>
17 * <p>
18 * Represents an entry in the index of event packets.
19 */
20 public class StreamInputPacketIndexEntry {
21
22 // ------------------------------------------------------------------------
23 // Attributes
24 // ------------------------------------------------------------------------
25
26
27 /**
28 * Offset of the packet in the file, in bytes
29 */
30 final private long offsetBytes;
31
32 /**
33 * Offset of the data in the packet, in bits
34 */
35 private int dataOffsetBits = 0;
36
37 /**
38 * Packet size, in bits
39 */
40 private int packetSizeBits = 0;
41
42 /**
43 * Content size, in bits
44 */
45 private int contentSizeBits = 0;
46
47 /**
48 * Begin timestamp
49 */
50 private long timestampBegin = 0;
51
52 /**
53 * End timestamp
54 */
55 private long timestampEnd = 0;
56
57 // ------------------------------------------------------------------------
58 // Constructors
59 // ------------------------------------------------------------------------
60
61 /**
62 * Constructs an index entry.
63 *
64 * @param offset
65 * The offset of the packet in the file, in bytes.
66 */
67
68 public StreamInputPacketIndexEntry(long offset) {
69 this.offsetBytes = offset;
70 }
71
72 // ------------------------------------------------------------------------
73 // Operations
74 // ------------------------------------------------------------------------
75
76 /**
77 * Returns whether the packet includes (inclusively) the given timestamp in
78 * the begin-end timestamp range.
79 *
80 * @param ts
81 * The timestamp to check.
82 * @return True if the packet includes the timestamp.
83 */
84 boolean includes(long ts) {
85 return (ts >= timestampBegin) && (ts <= timestampEnd);
86 }
87
88 /*
89 * (non-Javadoc)
90 *
91 * @see java.lang.Object#toString()
92 */
93 @Override
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$
98 }
99
100 // ------------------------------------------------------------------------
101 // Getters and Setters
102 // ------------------------------------------------------------------------
103
104 /**
105 * @return the offsetBytes
106 */
107 public long getOffsetBytes() {
108 return offsetBytes;
109 }
110
111 /**
112 * @return the dataOffsetBits
113 */
114 public int getDataOffsetBits() {
115 return dataOffsetBits;
116 }
117
118 /**
119 * @param dataOffsetBits
120 * the dataOffsetBits to set
121 */
122 public void setDataOffsetBits(int dataOffsetBits) {
123 this.dataOffsetBits = dataOffsetBits;
124 }
125
126 /**
127 * @return the packetSizeBits
128 */
129 public int getPacketSizeBits() {
130 return packetSizeBits;
131 }
132
133 /**
134 * @param packetSizeBits
135 * the packetSizeBits to set
136 */
137 public void setPacketSizeBits(int packetSizeBits) {
138 this.packetSizeBits = packetSizeBits;
139 }
140
141 /**
142 * @return the contentSizeBits
143 */
144 public int getContentSizeBits() {
145 return contentSizeBits;
146 }
147
148 /**
149 * @param contentSizeBits
150 * the contentSizeBits to set
151 */
152 public void setContentSizeBits(int contentSizeBits) {
153 this.contentSizeBits = contentSizeBits;
154 }
155
156 /**
157 * @return the timestampBegin
158 */
159 public long getTimestampBegin() {
160 return timestampBegin;
161 }
162
163 /**
164 * @param timestampBegin
165 * the timestampBegin to set
166 */
167 public void setTimestampBegin(long timestampBegin) {
168 this.timestampBegin = timestampBegin;
169 }
170
171 /**
172 * @return the timestampEnd
173 */
174 public long getTimestampEnd() {
175 return timestampEnd;
176 }
177
178 /**
179 * @param timestampEnd
180 * the timestampEnd to set
181 */
182 public void setTimestampEnd(long timestampEnd) {
183 this.timestampEnd = timestampEnd;
184 }
185
186 }
This page took 0.036967 seconds and 6 git commands to generate.