1 /*******************************************************************************
2 * Copyright (c) 2009, 2013 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 * Alexandre Montplaisir - Consolidated constructors
12 *******************************************************************************/
14 package org
.eclipse
.linuxtools
.tmf
.core
.request
;
16 import org
.eclipse
.linuxtools
.internal
.tmf
.core
.TmfCoreTracer
;
17 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEvent
;
18 import org
.eclipse
.linuxtools
.tmf
.core
.timestamp
.TmfTimeRange
;
21 * An extension of TmfDataRequest for timestamped events.
24 * @author Francois Chouinard
26 public abstract class TmfEventRequest
extends TmfDataRequest
implements ITmfEventRequest
{
28 // ------------------------------------------------------------------------
30 // ------------------------------------------------------------------------
32 private final TmfTimeRange fRange
; // The requested events time range
34 // ------------------------------------------------------------------------
36 // ------------------------------------------------------------------------
39 * Request 'n' events of a given type for the given time range (given
40 * priority). Events are returned in blocks of the given size.
43 * The requested data type.
45 * The time range of the requested events. You can use
46 * {@link TmfTimeRange#ETERNITY} to indicate you want to cover
49 * The index of the first event to retrieve. You can use '0' to
50 * start at the beginning of the trace.
52 * The number of events requested. You can use
53 * {@link TmfEventRequest#ALL_DATA} to indicate you want all
54 * events in the time range.
56 * The requested execution priority.
59 public TmfEventRequest(Class
<?
extends ITmfEvent
> dataType
,
63 ExecutionType priority
) {
64 super(dataType
, index
, nbRequested
, priority
);
67 if (TmfCoreTracer
.isRequestTraced()) {
68 String type
= getClass().getName();
69 type
= type
.substring(type
.lastIndexOf('.') + 1);
70 @SuppressWarnings("nls")
71 String message
= "CREATED "
72 + (getExecType() == ITmfDataRequest
.ExecutionType
.BACKGROUND ?
"(BG)" : "(FG)")
73 + " Type=" + type
+ " Index=" + getIndex() + " NbReq=" + getNbRequested()
74 + " Range=" + getRange()
75 + " DataType=" + getDataType().getSimpleName();
76 TmfCoreTracer
.traceRequest(this, message
);
80 // ------------------------------------------------------------------------
82 // ------------------------------------------------------------------------
85 * @return the requested time range
89 public TmfTimeRange
getRange() {
93 // ------------------------------------------------------------------------
95 // ------------------------------------------------------------------------
98 * this method is called by the event provider to set the index
99 * corresponding to the time range start time once it is known
105 public void setStartIndex(int index
) {
109 // ------------------------------------------------------------------------
111 // ------------------------------------------------------------------------
114 // All requests have a unique id
115 public int hashCode() {
116 return getRequestId();
120 public boolean equals(Object other
) {
121 if (other
instanceof TmfEventRequest
) {
122 TmfEventRequest request
= (TmfEventRequest
) other
;
123 return super.equals(other
) && request
.fRange
.equals(fRange
);
129 @SuppressWarnings("nls")
130 public String
toString() {
131 String name
= getClass().getName();
132 int dot
= name
.lastIndexOf('.');
134 name
= name
.substring(dot
+ 1);
136 return "[" + name
+ "(" + getRequestId() + "," + getDataType().getSimpleName() + "," + getExecType()
137 + "," + getRange() + "," + getIndex() + "," + getNbRequested() + ")]";
This page took 0.036214 seconds and 6 git commands to generate.