1 /*******************************************************************************
2 * Copyright (c) 2012, 2013 Ericsson
3 * Copyright (c) 2010, 2011 École Polytechnique de Montréal
4 * Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
6 * All rights reserved. This program and the accompanying materials are
7 * made available under the terms of the Eclipse Public License v1.0 which
8 * accompanies this distribution, and is available at
9 * http://www.eclipse.org/legal/epl-v10.html
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.core
.interval
;
15 import org
.eclipse
.linuxtools
.tmf
.core
.statevalue
.ITmfStateValue
;
18 * The StateInterval represents the "state" a particular attribute was in, at a
19 * given time. It is the main object being returned from queries to the state
23 * @author Alexandre Montplaisir
25 public final class TmfStateInterval
implements ITmfStateInterval
{
27 private final long start
;
28 private final long end
;
29 private final int attribute
;
30 private final ITmfStateValue sv
;
33 * Construct an interval from its given parameters
40 * Attribute linked to this interval
42 * State value this interval will contain
44 public TmfStateInterval(long start
, long end
, int attribute
,
48 this.attribute
= attribute
;
53 public long getStartTime() {
58 public long getEndTime() {
63 public long getViewerEndTime() {
68 public int getAttribute() {
73 public ITmfStateValue
getStateValue() {
78 public boolean intersects(long timestamp
) {
79 if (start
<= timestamp
) {
80 if (end
>= timestamp
) {
88 public String
toString() {
89 /* Only used for debugging */
90 StringBuffer buf
= new StringBuffer(start
+ " to "); //$NON-NLS-1$
91 buf
.append(end
+ ", "); //$NON-NLS-1$
92 buf
.append(String
.format("key = %4d, ", attribute
)); //$NON-NLS-1$
93 buf
.append("value = " + sv
.toString()); //$NON-NLS-1$
94 return buf
.toString();
This page took 0.031513 seconds and 5 git commands to generate.