1 /*******************************************************************************
2 * Copyright (c) 2009, 2010 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made 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
10 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.core
.request
;
15 import org
.eclipse
.linuxtools
.internal
.tmf
.core
.Tracer
;
16 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEvent
;
17 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfTimeRange
;
20 * <b><u>TmfEventRequest</u></b>
22 * Implement me. Please.
24 public abstract class TmfEventRequest
<T
extends ITmfEvent
> extends TmfDataRequest
<T
> implements ITmfEventRequest
<T
> {
26 // ------------------------------------------------------------------------
28 // ------------------------------------------------------------------------
30 private final TmfTimeRange fRange
; // The requested events time range
32 // ------------------------------------------------------------------------
34 // ------------------------------------------------------------------------
37 * Request all the events of a given type (high priority)
38 * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
40 * @param dataType the requested data type
42 public TmfEventRequest(Class
<T
> dataType
) {
43 this(dataType
, TmfTimeRange
.ETERNITY
, 0, ALL_DATA
, DEFAULT_BLOCK_SIZE
, ExecutionType
.FOREGROUND
);
47 * Request all the events of a given type (given priority)
48 * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
50 * @param dataType the requested data type
51 * @param priority the requested execution priority
53 public TmfEventRequest(Class
<T
> dataType
, ExecutionType priority
) {
54 this(dataType
, TmfTimeRange
.ETERNITY
, 0, ALL_DATA
, DEFAULT_BLOCK_SIZE
, priority
);
58 * Request all the events of a given type for the given time range (high priority)
59 * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
61 * @param dataType the requested data type
62 * @param range the time range of the requested events
64 public TmfEventRequest(Class
<T
> dataType
, TmfTimeRange range
) {
65 this(dataType
, range
, 0, ALL_DATA
, DEFAULT_BLOCK_SIZE
, ExecutionType
.FOREGROUND
);
69 * Request all the events of a given type for the given time range (given priority)
70 * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
72 * @param dataType the requested data type
73 * @param range the time range of the requested events
74 * @param priority the requested execution priority
76 public TmfEventRequest(Class
<T
> dataType
, TmfTimeRange range
, ExecutionType priority
) {
77 this(dataType
, range
, 0, ALL_DATA
, DEFAULT_BLOCK_SIZE
, priority
);
81 * Request 'n' events of a given type from the given time range (high priority)
82 * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
84 * @param dataType the requested data type
85 * @param range the time range of the requested events
86 * @param nbRequested the number of events requested
88 public TmfEventRequest(Class
<T
> dataType
, TmfTimeRange range
, int nbRequested
) {
89 this(dataType
, range
, 0, nbRequested
, DEFAULT_BLOCK_SIZE
, ExecutionType
.FOREGROUND
);
93 * Request 'n' events of a given type for the given time range (given priority)
94 * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
96 * @param dataType the requested data type
97 * @param range the time range of the requested events
98 * @param nbRequested the number of events requested
99 * @param priority the requested execution priority
101 public TmfEventRequest(Class
<T
> dataType
, TmfTimeRange range
, int nbRequested
, ExecutionType priority
) {
102 this(dataType
, range
, 0, nbRequested
, DEFAULT_BLOCK_SIZE
, priority
);
106 * Request 'n' events of a given type for the given time range (high priority).
107 * Events are returned in blocks of the given size.
109 * @param dataType the requested data type
110 * @param range the time range of the requested events
111 * @param nbRequested the number of events requested
112 * @param blockSize the number of events per block
114 public TmfEventRequest(Class
<T
> dataType
, TmfTimeRange range
, int nbRequested
, int blockSize
) {
115 this(dataType
, range
, 0, nbRequested
, blockSize
, ExecutionType
.FOREGROUND
);
119 * Request 'n' events of a given type for the given time range (high priority).
120 * Events are returned in blocks of the given size.
122 * @param dataType the requested data type
123 * @param range the time range of the requested events
124 * @param index the index of the first event to retrieve
125 * @param nbRequested the number of events requested
126 * @param blockSize the number of events per block
128 public TmfEventRequest(Class
<T
> dataType
, TmfTimeRange range
, long index
, int nbRequested
, int blockSize
) {
129 this(dataType
, range
, index
, nbRequested
, blockSize
, ExecutionType
.FOREGROUND
);
133 * Request 'n' events of a given type for the given time range (given priority).
134 * Events are returned in blocks of the given size.
136 * @param dataType the requested data type
137 * @param range the time range of the requested events
138 * @param nbRequested the number of events requested
139 * @param blockSize the number of events per block
140 * @param priority the requested execution priority
142 public TmfEventRequest(Class
<T
> dataType
, TmfTimeRange range
, int nbRequested
, int blockSize
, ExecutionType priority
) {
143 this(dataType
, range
, 0, nbRequested
, blockSize
, priority
);
147 * Request 'n' events of a given type for the given time range (given priority).
148 * Events are returned in blocks of the given size.
150 * @param dataType the requested data type
151 * @param range the time range of the requested events
152 * @param index the index of the first event to retrieve
153 * @param nbRequested the number of events requested
154 * @param blockSize the number of events per block
155 * @param priority the requested execution priority
157 public TmfEventRequest(Class
<T
> dataType
, TmfTimeRange range
, long index
, int nbRequested
, int blockSize
, ExecutionType priority
) {
158 super(dataType
, index
, nbRequested
, blockSize
, priority
);
161 if (Tracer
.isRequestTraced()) {
162 String type
= getClass().getName();
163 type
= type
.substring(type
.lastIndexOf('.') + 1);
164 @SuppressWarnings("nls")
165 String message
= "CREATED "
166 + (getExecType() == ITmfDataRequest
.ExecutionType
.BACKGROUND ?
"(BG)" : "(FG)")
167 + " Type=" + type
+ " Index=" + getIndex() + " NbReq=" + getNbRequested()
168 + " Range=" + getRange()
169 + " DataType=" + getDataType().getSimpleName();
170 Tracer
.traceRequest(this, message
);
174 // ------------------------------------------------------------------------
176 // ------------------------------------------------------------------------
179 * @return the requested time range
182 public TmfTimeRange
getRange() {
186 // ------------------------------------------------------------------------
188 // ------------------------------------------------------------------------
191 * this method is called by the event provider to set the index corresponding
192 * to the time range start time once it is known
194 * @param index the start index
197 public void setStartIndex(int index
) {
201 // ------------------------------------------------------------------------
203 // ------------------------------------------------------------------------
206 // All requests have a unique id
207 public int hashCode() {
208 return getRequestId();
212 public boolean equals(Object other
) {
213 if (other
instanceof TmfEventRequest
<?
>) {
214 TmfEventRequest
<?
> request
= (TmfEventRequest
<?
>) other
;
215 return super.equals(other
) && request
.fRange
.equals(fRange
);
221 @SuppressWarnings("nls")
222 public String
toString() {
223 return "[TmfEventRequest(" + getRequestId() + "," + getDataType().getSimpleName()
224 + "," + getRange() + "," + getIndex() + "," + getNbRequested() + "," + getBlockSize() + ")]";
This page took 0.036952 seconds and 6 git commands to generate.