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
.request
;
15 import java
.util
.Vector
;
17 import org
.eclipse
.linuxtools
.tmf
.event
.TmfData
;
20 * <b><u>TmfCoalescedDataRequest</u></b>
22 * TODO: Implement me. Please.
24 public class TmfCoalescedDataRequest
<T
extends TmfData
> extends TmfDataRequest
<T
> {
26 // ------------------------------------------------------------------------
28 // ------------------------------------------------------------------------
30 protected Vector
<ITmfDataRequest
<T
>> fRequests
= new Vector
<ITmfDataRequest
<T
>>();
32 // ------------------------------------------------------------------------
34 // ------------------------------------------------------------------------
39 public TmfCoalescedDataRequest(Class
<T
> dataType
) {
40 this(dataType
, 0, ALL_DATA
, DEFAULT_BLOCK_SIZE
, ExecutionType
.FOREGROUND
);
43 public TmfCoalescedDataRequest(Class
<T
> dataType
, ExecutionType execType
) {
44 this(dataType
, 0, ALL_DATA
, DEFAULT_BLOCK_SIZE
, execType
);
50 public TmfCoalescedDataRequest(Class
<T
> dataType
, int index
) {
51 this(dataType
, index
, ALL_DATA
, DEFAULT_BLOCK_SIZE
, ExecutionType
.FOREGROUND
);
54 public TmfCoalescedDataRequest(Class
<T
> dataType
, int index
, ExecutionType execType
) {
55 this(dataType
, index
, ALL_DATA
, DEFAULT_BLOCK_SIZE
, execType
);
62 public TmfCoalescedDataRequest(Class
<T
> dataType
, int index
, int nbRequested
) {
63 this(dataType
, index
, nbRequested
, DEFAULT_BLOCK_SIZE
, ExecutionType
.FOREGROUND
);
66 public TmfCoalescedDataRequest(Class
<T
> dataType
, int index
, int nbRequested
, ExecutionType execType
) {
67 this(dataType
, index
, nbRequested
, DEFAULT_BLOCK_SIZE
, execType
);
75 public TmfCoalescedDataRequest(Class
<T
> dataType
, int index
, int nbRequested
, int blockSize
) {
76 super(dataType
, index
, nbRequested
, blockSize
, ExecutionType
.FOREGROUND
);
79 public TmfCoalescedDataRequest(Class
<T
> dataType
, int index
, int nbRequested
, int blockSize
, ExecutionType execType
) {
80 super(dataType
, index
, nbRequested
, blockSize
, execType
);
83 // ------------------------------------------------------------------------
85 // ------------------------------------------------------------------------
87 public void addRequest(ITmfDataRequest
<T
> request
) {
88 fRequests
.add(request
);
91 public synchronized boolean isCompatible(ITmfDataRequest
<T
> request
) {
93 boolean ok
= !isCompleted();
94 ok
&= request
.getIndex() == getIndex();
95 ok
&= request
.getNbRequested() == getNbRequested();
96 ok
&= request
.getBlockize() == getBlockize();
97 ok
&= request
.getExecType() == getExecType();
102 // ------------------------------------------------------------------------
104 // ------------------------------------------------------------------------
107 public synchronized void handleData() {
108 for (ITmfDataRequest
<T
> request
: fRequests
) {
109 request
.setData(getData());
110 request
.handleData();
115 public synchronized void done() {
116 for (ITmfDataRequest
<T
> request
: fRequests
) {
123 public synchronized void fail() {
124 for (ITmfDataRequest
<T
> request
: fRequests
) {
131 public synchronized void cancel() {
132 for (ITmfDataRequest
<T
> request
: fRequests
) {
138 // ------------------------------------------------------------------------
140 // ------------------------------------------------------------------------
143 // All requests have a unique id
144 public int hashCode() {
145 return super.hashCode();
149 public boolean equals(Object other
) {
150 if (other
instanceof TmfCoalescedDataRequest
<?
>) {
151 TmfCoalescedDataRequest
<?
> request
= (TmfCoalescedDataRequest
<?
>) other
;
152 return (request
.getDataType() == getDataType()) &&
153 (request
.getIndex() == getIndex()) &&
154 (request
.getNbRequested() == getNbRequested() &&
155 (request
.getExecType() == getExecType()));
161 public String
toString() {
162 return "[TmfCoalescedDataRequest(" + getRequestId() + "," + getDataType().getSimpleName()
163 + "," + getIndex() + "," + getNbRequested() + "," + getBlockize() + ")]";
This page took 0.033847 seconds and 5 git commands to generate.