~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« 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
  • Date: 2012-06-29 12:07:30 UTC
  • Revision ID: package-import@ubuntu.com-20120629120730-bfri1xys1i71dpn6
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
 * Copyright (c) 2004, 2008, 2009 Red Hat, Inc.
 
3
 * All rights reserved. This program and the accompanying materials
 
4
 * are made available under the terms of the Eclipse Public License v1.0
 
5
 * which accompanies this distribution, and is available at
 
6
 * http://www.eclipse.org/legal/epl-v10.html
 
7
 *
 
8
 * Contributors:
 
9
 *    Keith Seitz <keiths@redhat.com> - initial API and implementation
 
10
 *    Kent Sebastian <ksebasti@redhat.com> - 
 
11
 *******************************************************************************/ 
 
12
 
 
13
package org.eclipse.linuxtools.internal.oprofile.core.model;
 
14
 
 
15
/**
 
16
 * A class which represents the event collected in a given session.
 
17
 */
 
18
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
        }
 
66
}