[290580] JNI updates
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf / src / org / eclipse / linuxtools / tmf / event / TmfTimeRange.java
CommitLineData
8c8bf09f
ASL
1/*******************************************************************************
2 * Copyright (c) 2009 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.event;
14
15/**
1f506a43 16 * <b><u>TmfTimeWindow</u></b>
8c8bf09f
ASL
17 * <p>
18 * A utility class to define time ranges.
19 */
20public class TmfTimeRange {
21
62d1696a
FC
22 // ========================================================================
23 // Constants
24 // ========================================================================
25
26 public static TmfTimeRange Eternity = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
27
1f506a43 28 // ========================================================================
8c8bf09f 29 // Attributes
1f506a43 30 // ========================================================================
8c8bf09f
ASL
31
32 private final TmfTimestamp fStartTime;
33 private final TmfTimestamp fEndTime;
34
1f506a43 35 // ========================================================================
8c8bf09f 36 // Constructors
1f506a43 37 // ========================================================================
8c8bf09f
ASL
38
39 /**
40 * @param startTime
41 * @param endTime
42 */
43 public TmfTimeRange(TmfTimestamp startTime, TmfTimestamp endTime) {
1f506a43
FC
44 fStartTime = startTime;
45 fEndTime = endTime;
8c8bf09f
ASL
46 }
47
1f506a43 48 // ========================================================================
8c8bf09f 49 // Accessors
1f506a43 50 // ========================================================================
8c8bf09f
ASL
51
52 /**
53 * @return The time range start time
54 */
55 public TmfTimestamp getStartTime() {
1f506a43 56 return fStartTime;
8c8bf09f
ASL
57 }
58
59 /**
60 * @return The time range end time
61 */
62 public TmfTimestamp getEndTime() {
1f506a43 63 return fEndTime;
8c8bf09f
ASL
64 }
65
1f506a43 66 // ========================================================================
8c8bf09f 67 // Predicates
1f506a43 68 // ========================================================================
8c8bf09f
ASL
69
70 /**
71 * Check if the timestamp is within the time range
72 *
73 * @param ts
74 * @return
75 */
76 public boolean contains(TmfTimestamp ts) {
1f506a43
FC
77 boolean result = (fStartTime.compareTo(ts, true) <= 0) && (fEndTime.compareTo(ts, true) >= 0);
78 return result;
8c8bf09f
ASL
79 }
80
81}
This page took 0.028929 seconds and 5 git commands to generate.