~ubuntu-branches/ubuntu/wily/eclipse-linuxtools/wily

« back to all changes in this revision

Viewing changes to oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/model/OpModelEvent.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam, Jakub Adam, tony mancill
  • Date: 2014-10-11 11:44:05 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20141011114405-yazjvxfzzhmi5sgj
Tags: 3.1.0-1
[ Jakub Adam ]
* New upstream release (Closes: #761524).
* Refreshed d/patches.
* Don't build removed feature org.eclipse.linuxtools.tools.launch
  - merged into org.eclipse.linuxtools.profiling.
* Use javac target 1.7.
* Build new feature org.eclipse.linuxtools.dataviewers.feature
  - required by Valgrind integration.
* Build-depend on eclipse-remote-services-api and eclipse-cdt-autotools.
* Bump Standards-Version to 3.9.6.
* Override incompatible-java-bytecode-format - linuxtools needs Java 7.
* Remove unused codeless-jar override.

[ tony mancill ]
* Tweak short package description to make lintian happy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 *
8
8
 * Contributors:
9
9
 *    Keith Seitz <keiths@redhat.com> - initial API and implementation
10
 
 *    Kent Sebastian <ksebasti@redhat.com> - 
11
 
 *******************************************************************************/ 
 
10
 *    Kent Sebastian <ksebasti@redhat.com> -
 
11
 *******************************************************************************/
12
12
 
13
13
package org.eclipse.linuxtools.internal.oprofile.core.model;
14
14
 
 
15
import org.eclipse.linuxtools.internal.oprofile.core.Oprofile;
 
16
 
15
17
/**
16
18
 * A class which represents the event collected in a given session.
17
19
 */
18
20
public class OpModelEvent {
19
 
        private String eventName;
20
 
        private OpModelSession[] sessions;
21
 
        private String printTabs = "";          //for nice output  //$NON-NLS-1$
22
 
        
23
 
        public OpModelEvent(String name) {
24
 
                eventName = name;
25
 
        }
26
 
 
27
 
        public OpModelSession[] getSessions() {
28
 
                return sessions;
29
 
        }
30
 
 
31
 
        public void setSessions(OpModelSession[] sessions) {
32
 
                this.sessions = sessions;
33
 
        }
34
 
 
35
 
        public String getName() {
36
 
                return eventName;
37
 
        }
38
 
 
39
 
        //populate all sessions
40
 
        public void refreshModel() {
41
 
                if (sessions != null) {
42
 
                        for (int i = 0; i < sessions.length; i++) {
43
 
                                sessions[i].refreshModel();
44
 
                        }
45
 
                }
46
 
        }
47
 
        
48
 
        public String toString(String tabs) {
49
 
                printTabs = tabs;
50
 
                String s = toString();
51
 
                printTabs = ""; //$NON-NLS-1$
52
 
                return s;
53
 
        }
54
 
 
55
 
        @Override
56
 
        public String toString() {
57
 
                String s = eventName + "\n"; //$NON-NLS-1$
58
 
                if (sessions != null) {
59
 
                        for (int i = 0; i < sessions.length; i++) {
60
 
                                s += printTabs + "Session: "; //$NON-NLS-1$
61
 
                                s += sessions[i].toString(printTabs + "\t"); //$NON-NLS-1$
62
 
                        }
63
 
                }
64
 
                return s;
65
 
        }
 
21
    private String eventName;
 
22
    private String printTabs = "";        //for nice output  //$NON-NLS-1$
 
23
    private OpModelImage image;
 
24
    private OpModelSession parentSession;
 
25
 
 
26
 
 
27
    public OpModelEvent(OpModelSession parentSession ,String name) {
 
28
        this.parentSession = parentSession;
 
29
        this.eventName = name;
 
30
    }
 
31
 
 
32
    public String getName() {
 
33
        return eventName;
 
34
    }
 
35
 
 
36
    public OpModelSession getSession() {
 
37
        return parentSession;
 
38
    }
 
39
 
 
40
    //populate all images & dependent images
 
41
    public void refreshModel() {
 
42
        image = getNewImage();
 
43
    }
 
44
 
 
45
    public OpModelImage getImage() {
 
46
        return image;
 
47
    }
 
48
 
 
49
    protected OpModelImage getNewImage() {
 
50
        return Oprofile.getModelData(this.eventName, parentSession.getName());
 
51
    }
 
52
 
 
53
    public int getCount() {
 
54
        if (image == null) {
 
55
            return 0;
 
56
        } else {
 
57
            return image.getCount();
 
58
        }
 
59
    }
 
60
 
 
61
    public String toString(String tabs) {
 
62
        printTabs = tabs;
 
63
        String s = toString();
 
64
        printTabs = ""; //$NON-NLS-1$
 
65
        return s;
 
66
    }
 
67
 
 
68
    @Override
 
69
    public String toString() {
 
70
        String s = eventName + "\n"; //$NON-NLS-1$
 
71
        if (image != null) {
 
72
            s += printTabs + "Image: "; //$NON-NLS-1$
 
73
            s += image.toString(printTabs + "\t"); //$NON-NLS-1$
 
74
        }
 
75
        return s;
 
76
    }
66
77
}