| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2009, 2014 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 | * Alvaro Sanchez-Leon - Initial API and implementation |
| 11 | * Patrick Tasse - Refactoring |
| 12 | *******************************************************************************/ |
| 13 | |
| 14 | package org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model; |
| 15 | |
| 16 | /** |
| 17 | * Interface for time events, for use in the timegraph view |
| 18 | * |
| 19 | * @version 1.0 |
| 20 | * @author Alvaro Sanchez-Leon |
| 21 | * @author Patrick Tasse |
| 22 | */ |
| 23 | public interface ITimeEvent { |
| 24 | |
| 25 | /** |
| 26 | * Get the entry matching this time event. |
| 27 | * |
| 28 | * @return The time graph entry |
| 29 | */ |
| 30 | ITimeGraphEntry getEntry(); |
| 31 | |
| 32 | /** |
| 33 | * Get the timestamp of this event. |
| 34 | * |
| 35 | * @return The event's time |
| 36 | */ |
| 37 | long getTime(); |
| 38 | |
| 39 | /** |
| 40 | * @return |
| 41 | * <list> |
| 42 | * <li>-1: Considers duration to be from current event till the next</li> |
| 43 | * <li>0: Duration is not relevant e.g. a Burst / no state associated</li> |
| 44 | * <li>>0: Valid duration value specified</li> |
| 45 | * </list> |
| 46 | * <p> |
| 47 | */ |
| 48 | long getDuration(); |
| 49 | |
| 50 | /** |
| 51 | * Split an event in two at the specified time and keep the part before the |
| 52 | * split. If the time is smaller or equal to the event's start, the returned |
| 53 | * event is null. |
| 54 | * |
| 55 | * @param splitTime |
| 56 | * the time at which the event is to be split |
| 57 | * @return The part before the split time |
| 58 | */ |
| 59 | ITimeEvent splitBefore(long splitTime); |
| 60 | |
| 61 | /** |
| 62 | * Split an event in two at the specified time and keep the part after the |
| 63 | * split. If the time is greater or equal to the event's end, the returned |
| 64 | * event is null. |
| 65 | * |
| 66 | * @param splitTime |
| 67 | * the time at which the event is to be split |
| 68 | * @return The part after the split time |
| 69 | */ |
| 70 | ITimeEvent splitAfter(long splitTime); |
| 71 | } |