ss: Implement ISegment#getLength() as a default method
[deliverable/tracecompass.git] / statesystem / org.eclipse.tracecompass.segmentstore.core / src / org / eclipse / tracecompass / segmentstore / core / ISegment.java
CommitLineData
26a6a7eb
AM
1/*******************************************************************************
2 * Copyright (c) 2015 EfficiOS Inc., Alexandre Montplaisir
3 *
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
8 *
9 * Contributors:
10 * Alexandre Montplaisir - Initial API and implementation
11 *******************************************************************************/
12
13package org.eclipse.tracecompass.segmentstore.core;
14
15import java.io.Serializable;
16
17/**
18 * Generic interface for any segment (like a time range) that can be used in the
19 * segment store.
20 *
21 * @author Alexandre Montplaisir
22 */
e5083481 23public interface ISegment extends Serializable, Comparable<ISegment> {
26a6a7eb
AM
24
25 /**
26 * The start position/time of the segment.
27 *
28 * @return The start position
29 */
30 long getStart();
31
32 /**
33 * The end position/time of the segment
34 *
35 * @return The end position
36 */
37 long getEnd();
38
39 /**
524d1e78 40 * The length/duration of the segment.
26a6a7eb
AM
41 *
42 * @return The duration
43 */
524d1e78
AM
44 default long getLength() {
45 return getEnd() - getStart();
46 }
26a6a7eb 47}
This page took 0.038133 seconds and 5 git commands to generate.