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
);
46 public TmfCoalescedDataRequest(Class
<T
> dataType
, int index
) {
47 this(dataType
, index
, ALL_DATA
, DEFAULT_BLOCK_SIZE
);
54 public TmfCoalescedDataRequest(Class
<T
> dataType
, int index
, int nbRequested
) {
55 this(dataType
, index
, nbRequested
, DEFAULT_BLOCK_SIZE
);
63 public TmfCoalescedDataRequest(Class
<T
> dataType
, int index
, int nbRequested
, int blockSize
) {
64 super(dataType
, index
, nbRequested
, blockSize
);
67 // ------------------------------------------------------------------------
69 // ------------------------------------------------------------------------
71 public void addRequest(ITmfDataRequest
<T
> request
) {
72 fRequests
.add(request
);
75 public boolean isCompatible(ITmfDataRequest
<T
> request
) {
77 boolean ok
= request
.getIndex() == getIndex();
78 ok
&= request
.getNbRequested() == getNbRequested();
79 ok
&= request
.getBlockize() == getBlockize();
84 // ------------------------------------------------------------------------
86 // ------------------------------------------------------------------------
89 public void handleData() {
90 for (ITmfDataRequest
<T
> request
: fRequests
) {
91 request
.setData(getData());
98 for (ITmfDataRequest
<T
> request
: fRequests
) {
106 for (ITmfDataRequest
<T
> request
: fRequests
) {
113 public void cancel() {
114 for (ITmfDataRequest
<T
> request
: fRequests
) {
120 // ------------------------------------------------------------------------
122 // ------------------------------------------------------------------------
125 // All requests have a unique id
126 public int hashCode() {
127 return super.hashCode();
131 public boolean equals(Object other
) {
132 if (other
instanceof TmfCoalescedDataRequest
<?
>) {
133 TmfCoalescedDataRequest
<?
> request
= (TmfCoalescedDataRequest
<?
>) other
;
134 return (request
.getDataType() == getDataType()) &&
135 (request
.getIndex() == getIndex()) &&
136 (request
.getNbRequested() == getNbRequested());
142 public String
toString() {
143 return "[TmfCoalescedDataRequest(" + getRequestId() + "," + getDataType().getSimpleName()
144 + "," + getIndex() + "," + getNbRequested() + "," + getBlockize() + ")]";
This page took 0.033906 seconds and 5 git commands to generate.