Source Code Cross Referenced for JobMeasurements.java in  » Workflow-Engines » pegasus-2.1.0 » org » griphyn » cPlanner » visualize » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Workflow Engines » pegasus 2.1.0 » org.griphyn.cPlanner.visualize 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file or a portion of this file is licensed under the terms of
003:         * the Globus Toolkit Public License, found in file GTPL, or at
004:         * http://www.globus.org/toolkit/download/license.html. This notice must
005:         * appear in redistributions of this file, with or without modification.
006:         *
007:         * Redistributions of this Software, with or without modification, must
008:         * reproduce the GTPL in: (1) the Software, or (2) the Documentation or
009:         * some other similar material which is provided with the Software (if
010:         * any).
011:         *
012:         * Copyright 1999-2004 University of Chicago and The University of
013:         * Southern California. All rights reserved.
014:         */
015:
016:        package org.griphyn.cPlanner.visualize;
017:
018:        import java.util.Date;
019:        import java.util.List;
020:        import java.util.Iterator;
021:        import java.util.ArrayList;
022:
023:        /**
024:         * A data class that associates at most three measurements with the job
025:         * corresponding to the GRIDSTART_PREJOB, GRIDSTART_MAINJOB and GRIDSTART_POSTJOB.
026:         *
027:         * @author Karan Vahi vahi@isi.edu
028:         * @version $Revision: 50 $
029:         */
030:
031:        public class JobMeasurements {
032:
033:            /**
034:             * The PREJOB data index.
035:             */
036:            public static final int GRIDSTART_PREJOB_EVENT_TYPE = 0;
037:
038:            /**
039:             * The MAINJOB data index.
040:             */
041:            public static final int GRIDSTART_MAINJOB_EVENT_TYPE = 1;
042:
043:            /**
044:             * The POSTJOB data index.
045:             */
046:            public static final int GRIDSTART_POSTJOB_EVENT_TYPE = 2;
047:
048:            /**
049:             * The name of the job.
050:             */
051:            private String mName;
052:
053:            /**
054:             * The list of Measurement objects.
055:             */
056:            private List mMeasurementList;
057:
058:            /**
059:             * The corresponding list of Date objects signifying the times at which
060:             * an event happened.
061:             */
062:            private List mTimeList;
063:
064:            /**
065:             * The default constructor.
066:             */
067:            public JobMeasurements() {
068:                mMeasurementList = new ArrayList(3);
069:                for (int i = 0; i < 3; i++) {
070:                    mMeasurementList.add(null);
071:                }
072:
073:                mTimeList = new ArrayList(3);
074:                for (int i = 0; i < 3; i++) {
075:                    mTimeList.add(null);
076:                }
077:            }
078:
079:            /**
080:             * The overloaded constructor.
081:             *
082:             * @param name  the name of the job
083:             */
084:            public JobMeasurements(String name) {
085:                this ();
086:                mName = name;
087:            }
088:
089:            /**
090:             * Adds a measurement for a particular event type.
091:             *
092:             * @param measurement the measurement to be associated
093:             * @param type        the event type
094:             */
095:            public void setMeasurement(Measurement measurement, int type) {
096:                if (!typeInRange(type)) {
097:                    throw new NumberFormatException(
098:                            "Event type specified is not in range " + type);
099:                }
100:
101:                mMeasurementList.set(type, measurement);
102:                //mTimeList.set( type, measurement.getTime() );
103:            }
104:
105:            /**
106:             * Adds a time for a particular event type.
107:             *
108:             * @param time  the time
109:             * @param type  the event type
110:             */
111:            public void setTime(Date time, int type) {
112:                if (!typeInRange(type)) {
113:                    throw new NumberFormatException(
114:                            "Event type specified is not in range " + type);
115:                }
116:
117:                mTimeList.set(type, time);
118:            }
119:
120:            /**
121:             * Returns the measurement corresponding to the event type.
122:             *
123:             * @param type event type.
124:             *
125:             * @return <code>Measurement</code> object if data exists else null
126:             */
127:            public Measurement getMeasurement(int type) {
128:                if (!typeInRange(type)) {
129:                    throw new NumberFormatException(
130:                            "Event type specified is not in range " + type);
131:                }
132:                Object obj = mMeasurementList.get(type);
133:                return (obj == null) ? null : (Measurement) obj;
134:
135:            }
136:
137:            /**
138:             * Returns the readings iterator. Values can be null.
139:             *
140:             * @return iterator to measurements.
141:             */
142:            public Iterator measurementsIterator() {
143:                return mMeasurementList.iterator();
144:            }
145:
146:            /**
147:             * Returns a boolean indicating whether the event type is in range of not.
148:             *
149:             * @param type the type value
150:             */
151:            public boolean typeInRange(int type) {
152:                return (type >= GRIDSTART_PREJOB_EVENT_TYPE && type <= GRIDSTART_POSTJOB_EVENT_TYPE);
153:            }
154:
155:            /**
156:             * Returns a textual description of the object.
157:             *
158:             * @return description
159:             */
160:            public String toString() {
161:                StringBuffer sb = new StringBuffer();
162:                sb.append(mName).append(" ").append(mMeasurementList);
163:                return sb.toString();
164:            }
165:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.