[Bug292967] Implemented items [1] and [2] of of request coalescing. Augmented unit...
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf / src / org / eclipse / linuxtools / tmf / component / TmfEventProvider.java
CommitLineData
8c8bf09f
ASL
1/*******************************************************************************
2 * Copyright (c) 2009, 2010 Ericsson
3 *
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
8 *
9 * Contributors:
10 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
12
13package org.eclipse.linuxtools.tmf.component;
14
15import org.eclipse.linuxtools.tmf.event.TmfEvent;
16import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
fc6ccf6f
FC
17import org.eclipse.linuxtools.tmf.request.TmfDataRequest;
18import org.eclipse.linuxtools.tmf.request.TmfEventRequest;
8c8bf09f
ASL
19
20/**
21 * <b><u>TmfEventProvider</u></b>
22 * <p>
23 * Implement me. Please.
24 */
25public abstract class TmfEventProvider<T extends TmfEvent> extends TmfDataProvider<T> {
26
fc6ccf6f
FC
27 public TmfEventProvider(Class<T> type) {
28 super("TmfEventProvider", type);
8c8bf09f
ASL
29 }
30
fc6ccf6f
FC
31 public TmfEventProvider(Class<T> type, int queueSize) {
32 super("TmfEventProvider", type, queueSize);
8c8bf09f 33 }
fc6ccf6f 34
8c8bf09f 35 @Override
fc6ccf6f 36 public boolean isCompleted(TmfDataRequest<T> request, T data, int nbRead) {
8c8bf09f 37 boolean dataRequestCompleted = super.isCompleted(request, data, nbRead);
fc6ccf6f
FC
38 if (!dataRequestCompleted && request instanceof TmfEventRequest<?> && data != null) {
39 TmfTimestamp endTime = ((TmfEventRequest<?>) request).getRange().getEndTime();
8c8bf09f
ASL
40 return data.getTimestamp().compareTo(endTime, false) > 0;
41 }
42 return dataRequestCompleted;
43 }
44
8c8bf09f 45}
This page took 0.026294 seconds and 5 git commands to generate.