~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/libs/jgdi/src/com/sun/grid/jgdi/monitoring/TaskSummaryImpl.java

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*___INFO__MARK_BEGIN__*/
 
2
/*************************************************************************
 
3
 *
 
4
 *  The Contents of this file are made available subject to the terms of
 
5
 *  the Sun Industry Standards Source License Version 1.2
 
6
 *
 
7
 *  Sun Microsystems Inc., March, 2001
 
8
 *
 
9
 *
 
10
 *  Sun Industry Standards Source License Version 1.2
 
11
 *  =================================================
 
12
 *  The contents of this file are subject to the Sun Industry Standards
 
13
 *  Source License Version 1.2 (the "License"); You may not use this file
 
14
 *  except in compliance with the License. You may obtain a copy of the
 
15
 *  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 
16
 *
 
17
 *  Software provided under this License is provided on an "AS IS" basis,
 
18
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 
19
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 
20
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 
21
 *  See the License for the specific provisions governing your rights and
 
22
 *  obligations concerning the Software.
 
23
 *
 
24
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 
25
 *
 
26
 *   Copyright: 2001 by Sun Microsystems, Inc.
 
27
 *
 
28
 *   All Rights Reserved.
 
29
 *
 
30
 ************************************************************************/
 
31
/*___INFO__MARK_END__*/
 
32
package com.sun.grid.jgdi.monitoring;
 
33
 
 
34
import java.io.Serializable;
 
35
 
 
36
/**
 
37
 * Default implementation of the <code>TaskSummary</code> interface
 
38
 */
 
39
public class TaskSummaryImpl implements TaskSummary, Serializable {
 
40
    
 
41
    private String taskId;
 
42
    private String state;
 
43
    private boolean hasCpuUsage;
 
44
    private double cpuUsage;
 
45
    private boolean hasMemUsage;
 
46
    private double memUsage;
 
47
    private boolean hasIoUsage;
 
48
    private double ioUsage;
 
49
    private boolean isRunning;
 
50
    private boolean hasExitStatus;
 
51
    private int exitStatus;
 
52
    
 
53
    /** Creates a new instance of TaskSummary */
 
54
    public TaskSummaryImpl() {
 
55
    }
 
56
    
 
57
    /**
 
58
     *  Get the task id.
 
59
     *  @return the task id
 
60
     */
 
61
    public String getTaskId() {
 
62
        return taskId;
 
63
    }
 
64
    
 
65
    /**
 
66
     *  Set the task id
 
67
     *  @param taskId the task id
 
68
     */
 
69
    public void setTaskId(String taskId) {
 
70
        this.taskId = taskId;
 
71
    }
 
72
    
 
73
    /**
 
74
     *  Get the state of the task
 
75
     *  @return state of the task
 
76
     */
 
77
    public String getState() {
 
78
        return state;
 
79
    }
 
80
    
 
81
    /**
 
82
     *  Set the state of the task
 
83
     *  @param state state of the task
 
84
     */
 
85
    public void setState(String state) {
 
86
        this.state = state;
 
87
    }
 
88
    
 
89
    /**
 
90
     *  Determine if the task has cpu usage
 
91
     *  @return <code>true</code> if the task has cpu usage
 
92
     */
 
93
    public boolean hasCpuUsage() {
 
94
        return hasCpuUsage;
 
95
    }
 
96
    
 
97
    /**
 
98
     *  Get the cpu usage of the task. Returns only a meanful value
 
99
     *  if {@link #hasCpuUsage} returns true.
 
100
     *  @return the cpu usage of the task
 
101
     */
 
102
    public double getCpuUsage() {
 
103
        return cpuUsage;
 
104
    }
 
105
    
 
106
    /**
 
107
     *  Set the cpu usage of the task.
 
108
     *  @param cpuUsage the cpu usage
 
109
     */
 
110
    public void setCpuUsage(double cpuUsage) {
 
111
        this.cpuUsage = cpuUsage;
 
112
        hasCpuUsage = true;
 
113
    }
 
114
    
 
115
    /**
 
116
     *  Determine if the task has mem usage
 
117
     *  @return <code>true</code> if the task has mem usage
 
118
     */
 
119
    public boolean hasMemUsage() {
 
120
        return hasMemUsage;
 
121
    }
 
122
    
 
123
    /**
 
124
     *  Get the mem usage of the task. Returns only a meanful value
 
125
     *  if {@link #hasMemUsage} returns true.
 
126
     *  @return the mem usage of the task
 
127
     */
 
128
    public double getMemUsage() {
 
129
        return memUsage;
 
130
    }
 
131
    
 
132
    /**
 
133
     *  Set the mem usage of the task.
 
134
     *  @param memUsage the mem usage
 
135
     */
 
136
    public void setMemUsage(double memUsage) {
 
137
        this.memUsage = memUsage;
 
138
        hasMemUsage = true;
 
139
    }
 
140
    
 
141
    /**
 
142
     *  Determine if the task has io usage
 
143
     *  @return <code>true</code> if the task has io usage
 
144
     */
 
145
    public boolean hasIoUsage() {
 
146
        return hasIoUsage;
 
147
    }
 
148
    
 
149
    /**
 
150
     *  Get the io usage of the task. Returns only a meanful value
 
151
     *  if {@link #hasIoUsage} returns true.
 
152
     *  @return the io usage of the task
 
153
     */
 
154
    public double getIoUsage() {
 
155
        return ioUsage;
 
156
    }
 
157
    
 
158
    /**
 
159
     *  Set the io usage of the task.
 
160
     *  @param ioUsage the io usage
 
161
     */
 
162
    public void setIoUsage(double ioUsage) {
 
163
        this.ioUsage = ioUsage;
 
164
        hasIoUsage = true;
 
165
    }
 
166
    
 
167
    /**
 
168
     * Determine if the task is running
 
169
     * @return <code>true</code> if task is running
 
170
     */
 
171
    public boolean isRunning() {
 
172
        return isRunning;
 
173
    }
 
174
    
 
175
    /**
 
176
     * Set the running flag of the task
 
177
     * @param isRunning the running flag
 
178
     */
 
179
    public void setRunning(boolean isRunning) {
 
180
        this.isRunning = isRunning;
 
181
    }
 
182
    
 
183
    /**
 
184
     *  Determine if the task has an exit status.
 
185
     *  @return <code>true</code> if the task has an exit status
 
186
     */
 
187
    public boolean hasExitStatus() {
 
188
        return hasExitStatus;
 
189
    }
 
190
    
 
191
    /**
 
192
     *  Get the exit status of the task. Returns only a meanful value if
 
193
     *  {@link #hasExitStatus} returns <code>true</code>.
 
194
     *  @return the exit status of the task
 
195
     */
 
196
    public int getExitStatus() {
 
197
        return exitStatus;
 
198
    }
 
199
    
 
200
    /**
 
201
     *  Set the exit status of the task
 
202
     *  @param exitStatus the exit status
 
203
     */
 
204
    public void setExitStatus(int exitStatus) {
 
205
        this.exitStatus = exitStatus;
 
206
        hasExitStatus = true;
 
207
    }
 
208
    
 
209
}