1 /*******************************************************************************
2 * Copyright (c) 2015 EfficiOS Inc., Alexandre Montplaisir
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Alexandre Montplaisir - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.segmentstore
.core
;
15 import java
.io
.Serializable
;
17 import org
.eclipse
.jdt
.annotation
.NonNull
;
20 * Generic interface for any segment (like a time range) that can be used in the
23 * @author Alexandre Montplaisir
25 public interface ISegment
extends Serializable
, Comparable
<@NonNull ISegment
> {
28 * The start position/time of the segment.
30 * @return The start position
35 * The end position/time of the segment
37 * @return The end position
42 default int compareTo(@NonNull ISegment arg0
) {
43 return SegmentComparators
.INTERVAL_START_COMPARATOR
44 .thenComparing(SegmentComparators
.INTERVAL_END_COMPARATOR
)
49 * The length/duration of the segment.
51 * @return The duration
53 default long getLength() {
54 return getEnd() - getStart();