Commit | Line | Data |
---|---|---|
4208b510 AM |
1 | /******************************************************************************* |
2 | * Copyright (c) 2015, 2016 EfficiOS Inc., Alexandre Montplaisir | |
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 | ||
10 | package org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types; | |
11 | ||
12 | import org.eclipse.jdt.annotation.Nullable; | |
13 | ||
14 | /** | |
15 | * Lami time range data type | |
16 | * | |
17 | * @author Alexandre Montplaisir | |
18 | */ | |
19 | public class LamiTimeRange extends LamiData { | |
20 | ||
21 | private final long fStart; | |
22 | private final long fEnd; | |
23 | private final long fDuration; | |
24 | ||
25 | /** | |
26 | * Construct a new time range | |
27 | * | |
28 | * @param start | |
29 | * Start time | |
30 | * @param end | |
31 | * End time | |
32 | */ | |
33 | public LamiTimeRange(long start, long end) { | |
34 | fStart = start; | |
35 | fEnd = end; | |
36 | fDuration = fEnd - fStart; | |
37 | } | |
38 | ||
39 | /** | |
40 | * Get the start time of this time range. | |
41 | * | |
42 | * @return The start time | |
43 | */ | |
44 | public long getStart() { | |
45 | return fStart; | |
46 | } | |
47 | ||
48 | /** | |
49 | * Get the end time of this time range. | |
50 | * | |
51 | * @return The end time | |
52 | */ | |
53 | public long getEnd() { | |
54 | return fEnd; | |
55 | } | |
56 | /** | |
57 | * Get the duration of this time range. | |
58 | * | |
59 | * @return The duration | |
60 | */ | |
61 | public long getDuration() { | |
62 | return fDuration; | |
63 | } | |
64 | ||
65 | @Override | |
66 | public @Nullable String toString() { | |
67 | return "[" + String.valueOf(fStart) + " - " + String.valueOf(fEnd) + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | |
68 | } | |
69 | } |