Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d8acb7d0d38f884cfd26d9bdccba3d6eafd649ad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*******************************************************************************
 * Copyright (c) 2012, 2013 Ericsson
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Patrick Tasse - Initial API and implementation
 *******************************************************************************/

package org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources;

import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources.ResourcesEntry.Type;
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.TimeEvent;

/**
 * Time Event implementation specific to the Resource View
 *
 * @author Patrick Tasse
 */
public class ResourcesEvent extends TimeEvent {

    private final Type fType;
    private int fValue;

    /**
     * Standard constructor
     *
     * @param entry
     *            The entry that this event affects
     * @param time
     *            The start time of the event
     * @param duration
     *            The duration of the event
     * @param value
     *            The value type associated to this event
     */
    public ResourcesEvent(ResourcesEntry entry, long time, long duration,
            int value) {
        super(entry, time, duration);
        fType = entry.getType();
        fValue = value;
    }

    /**
     * Base constructor, with no value assigned
     *
     * @param entry
     *            The entry that this event affects
     * @param time
     *            The start time of the event
     * @param duration
     *            The duration of the event
     */
    public ResourcesEvent(ResourcesEntry entry, long time, long duration) {
        super(entry, time, duration);
        fType = Type.NULL;
    }

    /**
     * Retrieve the value associated with this event
     *
     * @return The integer value
     */
    public int getValue() {
        return fValue;
    }

    /**
     * Retrieve the type of this entry. Uses the ResourcesEntry.Type interface.
     *
     * @return The entry type
     */
    public Type getType() {
        return fType;
    }

    @Override
    public String toString() {
        return "ResourcesEvent start=" + fTime + " end=" + (fTime + fDuration) + " duration=" + fDuration + " type=" + fType + " value=" + fValue; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
    }
}

Back to the top