Commit | Line | Data |
---|---|---|
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 | ||
13 | package org.eclipse.linuxtools.tmf.request; | |
14 | ||
15 | import org.eclipse.linuxtools.tmf.event.TmfEvent; | |
16 | import org.eclipse.linuxtools.tmf.event.TmfTimeRange; | |
17 | ||
18 | /** | |
19 | * <b><u>TmfEventRequest</u></b> | |
20 | * <p> | |
21 | * Implement me. Please. | |
22 | */ | |
951d134a | 23 | public abstract class TmfEventRequest<T extends TmfEvent> extends TmfDataRequest<T> implements ITmfEventRequest<T> { |
8c8bf09f ASL |
24 | |
25 | // ------------------------------------------------------------------------ | |
26 | // Attributes | |
27 | // ------------------------------------------------------------------------ | |
28 | ||
29 | private final TmfTimeRange fRange; // The requested events time range | |
30 | ||
31 | // ------------------------------------------------------------------------ | |
32 | // Constructors | |
33 | // ------------------------------------------------------------------------ | |
34 | ||
35 | /** | |
36 | * @param range | |
37 | */ | |
951d134a | 38 | public TmfEventRequest(Class<T> dataType) { |
8c8bf09f ASL |
39 | this(dataType, TmfTimeRange.Eternity, ALL_DATA, DEFAULT_BLOCK_SIZE); |
40 | } | |
41 | ||
42 | /** | |
43 | * @param range | |
44 | */ | |
951d134a | 45 | public TmfEventRequest(Class<T> dataType, TmfTimeRange range) { |
8c8bf09f ASL |
46 | this(dataType, range, ALL_DATA, DEFAULT_BLOCK_SIZE); |
47 | } | |
48 | ||
49 | /** | |
50 | * @param range | |
51 | * @param nbRequested | |
52 | */ | |
951d134a | 53 | public TmfEventRequest(Class<T> dataType, TmfTimeRange range, int nbRequested) { |
8c8bf09f ASL |
54 | this(dataType, range, nbRequested, DEFAULT_BLOCK_SIZE); |
55 | } | |
56 | ||
57 | /** | |
58 | * @param range | |
59 | * @param nbRequested | |
60 | * @param blockSize Size of the largest blocks expected | |
61 | */ | |
951d134a | 62 | public TmfEventRequest(Class<T> dataType, TmfTimeRange range, int nbRequested, int blockSize) { |
8c8bf09f ASL |
63 | super(dataType, 0, nbRequested, blockSize); |
64 | fRange = range; | |
65 | } | |
66 | ||
951d134a FC |
67 | @Override |
68 | public boolean equals(Object other) { | |
69 | if (other instanceof TmfEventRequest<?>) { | |
70 | TmfEventRequest<?> request = (TmfEventRequest<?>) other; | |
71 | return super.equals(other) && request.fRange.equals(fRange); | |
72 | } | |
73 | return false; | |
74 | } | |
75 | ||
8c8bf09f ASL |
76 | // ------------------------------------------------------------------------ |
77 | // Accessors | |
78 | // ------------------------------------------------------------------------ | |
79 | ||
80 | /** | |
81 | * @return the requested time range | |
82 | */ | |
83 | public TmfTimeRange getRange() { | |
84 | return fRange; | |
85 | } | |
86 | ||
8c8bf09f | 87 | } |