Source Code Cross Referenced for SimpleCompletionData.java in  » Science » Cougaar12_4 » org » cougaar » planning » servlet » data » completion » 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 » Science » Cougaar12_4 » org.cougaar.planning.servlet.data.completion 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * <copyright>
003:         *  
004:         *  Copyright 2001-2004 BBNT Solutions, LLC
005:         *  under sponsorship of the Defense Advanced Research Projects
006:         *  Agency (DARPA).
007:         * 
008:         *  You can redistribute this software and/or modify it under the
009:         *  terms of the Cougaar Open Source License as published on the
010:         *  Cougaar Open Source Website (www.cougaar.org).
011:         * 
012:         *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
013:         *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
014:         *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
015:         *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
016:         *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017:         *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
018:         *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
019:         *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
020:         *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
021:         *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
022:         *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
023:         *  
024:         * </copyright>
025:         */
026:        package org.cougaar.planning.servlet.data.completion;
027:
028:        import java.io.IOException;
029:
030:        import org.cougaar.planning.servlet.data.xml.DeXMLable;
031:        import org.cougaar.planning.servlet.data.xml.UnexpectedXMLException;
032:        import org.cougaar.planning.servlet.data.xml.XMLWriter;
033:        import org.xml.sax.Attributes;
034:
035:        /**
036:         * Represents the data leaving the Completion PSP --
037:         * <code>SimpleCompletionData</code> only contains counters of the
038:         * Tasks, not <code>AbstractTask</code>s.
039:         *
040:         * @see FullCompletionData
041:         * @see CompletionData
042:         **/
043:        public class SimpleCompletionData extends CompletionData {
044:
045:            //Variables:
046:            ////////////
047:
048:            public static final String NAME_TAG = "SimpleCompletion";
049:
050:            public static final String NUMBER_OF_UNPLANNED_TASKS_ATTR = "NumUnplannedTasks";
051:            public static final String NUMBER_OF_UNESTIMATED_TASKS_ATTR = "NumUnestimatedTasks";
052:            public static final String NUMBER_OF_UNCONFIDENT_TASKS_ATTR = "NumUnconfidentTasks";
053:            public static final String NUMBER_OF_FAILED_TASKS_ATTR = "NumFailedTasks";
054:            public static final String NUMBER_OF_ROOT_PS_TASKS_ATTR = "NumRootProjectSupplyTasks";
055:            public static final String NUMBER_OF_ROOT_SUPPLY_TASKS_ATTR = "NumRootSupplyTasks";
056:            public static final String NUMBER_OF_ROOT_TRANSPORT_TASKS_ATTR = "NumRootTransportTasks";
057:
058:            protected int numUnplannedTasks;
059:            protected int numUnestimatedTasks;
060:            protected int numUnconfidentTasks;
061:            protected int numFailedTasks;
062:
063:            //Constructors:
064:            ///////////////
065:
066:            public SimpleCompletionData() {
067:            }
068:
069:            //Setters:
070:            //////////
071:
072:            public void setNumberOfUnplannedTasks(int numUnplannedTasks) {
073:                this .numUnplannedTasks = numUnplannedTasks;
074:            }
075:
076:            public void setNumberOfUnestimatedTasks(int numUnestimatedTasks) {
077:                this .numUnestimatedTasks = numUnestimatedTasks;
078:            }
079:
080:            public void setNumberOfUnconfidentTasks(int numUnconfidentTasks) {
081:                this .numUnconfidentTasks = numUnconfidentTasks;
082:            }
083:
084:            public void setNumberOfFailedTasks(int numFailedTasks) {
085:                this .numFailedTasks = numFailedTasks;
086:            }
087:
088:            //Getters:
089:            //////////
090:
091:            public int getNumberOfUnplannedTasks() {
092:                return numUnplannedTasks;
093:            }
094:
095:            public int getNumberOfUnestimatedTasks() {
096:                return numUnestimatedTasks;
097:            }
098:
099:            public int getNumberOfUnconfidentTasks() {
100:                return numUnconfidentTasks;
101:            }
102:
103:            public int getNumberOfFailedTasks() {
104:                return numFailedTasks;
105:            }
106:
107:            public UnplannedTask getUnplannedTaskAt(int i) {
108:                throw new UnsupportedOperationException("Only totals gathered!");
109:            }
110:
111:            public UnestimatedTask getUnestimatedTaskAt(int i) {
112:                throw new UnsupportedOperationException("Only totals gathered!");
113:            }
114:
115:            public UnconfidentTask getUnconfidentTaskAt(int i) {
116:                throw new UnsupportedOperationException("Only totals gathered!");
117:            }
118:
119:            public FailedTask getFailedTaskAt(int i) {
120:                throw new UnsupportedOperationException("Only totals gathered!");
121:            }
122:
123:            //XMLable members:
124:            //----------------
125:
126:            /**
127:             * Write this class out to the Writer in XML format
128:             * @param w output Writer
129:             **/
130:            public void toXML(XMLWriter w) throws IOException {
131:                w.optagln(NAME_TAG);
132:                w.tagln(TIME_MILLIS_ATTR, getTimeMillis());
133:                w.tagln(RATIO_ATTR, getRatio());
134:                w.tagln(NUMBER_OF_TASKS_ATTR, getNumberOfTasks());
135:                w.tagln(NUMBER_OF_UNPLANNED_TASKS_ATTR,
136:                        getNumberOfUnplannedTasks());
137:                w.tagln(NUMBER_OF_UNESTIMATED_TASKS_ATTR,
138:                        getNumberOfUnestimatedTasks());
139:                w.tagln(NUMBER_OF_UNCONFIDENT_TASKS_ATTR,
140:                        getNumberOfUnconfidentTasks());
141:                w.tagln(NUMBER_OF_FAILED_TASKS_ATTR, getNumberOfFailedTasks());
142:                w.tagln(NUMBER_OF_ROOT_PS_TASKS_ATTR,
143:                        getNumberOfRootProjectSupplyTasks());
144:                w.tagln(NUMBER_OF_ROOT_SUPPLY_TASKS_ATTR,
145:                        getNumberOfRootSupplyTasks());
146:                w.tagln(NUMBER_OF_ROOT_TRANSPORT_TASKS_ATTR,
147:                        getNumberOfRootTransportTasks());
148:                w.cltagln(NAME_TAG);
149:            }
150:
151:            //DeXMLable members:
152:            //------------------
153:
154:            /**
155:             * Report a startElement that pertains to THIS object, not any
156:             * sub objects.  Call also provides the elements Attributes and data.  
157:             * Note, that  unlike in a SAX parser, data is guaranteed to contain 
158:             * ALL of this tag's data, not just a 'chunk' of it.
159:             * @param name startElement tag
160:             * @param attr attributes for this tag
161:             * @param data data for this tag
162:             **/
163:            public void openTag(String name, Attributes attr, String data)
164:                    throws UnexpectedXMLException {
165:                try {
166:                    if (name.equals(NAME_TAG)) {
167:                    } else if (name.equals(TIME_MILLIS_ATTR)) {
168:                        timeMillis = Long.parseLong(data);
169:                    } else if (name.equals(RATIO_ATTR)) {
170:                        ratio = Double.parseDouble(data);
171:                    } else if (name.equals(NUMBER_OF_TASKS_ATTR)) {
172:                        numTasks = Integer.parseInt(data);
173:                    } else if (name.equals(NUMBER_OF_UNPLANNED_TASKS_ATTR)) {
174:                        numUnplannedTasks = Integer.parseInt(data);
175:                    } else if (name.equals(NUMBER_OF_UNESTIMATED_TASKS_ATTR)) {
176:                        numUnestimatedTasks = Integer.parseInt(data);
177:                    } else if (name.equals(NUMBER_OF_UNCONFIDENT_TASKS_ATTR)) {
178:                        numUnconfidentTasks = Integer.parseInt(data);
179:                    } else if (name.equals(NUMBER_OF_FAILED_TASKS_ATTR)) {
180:                        numFailedTasks = Integer.parseInt(data);
181:                    } else if (name.equals(NUMBER_OF_ROOT_PS_TASKS_ATTR)) {
182:                        numRootProjectSupplyTasks = Integer.parseInt(data);
183:                    } else if (name.equals(NUMBER_OF_ROOT_SUPPLY_TASKS_ATTR)) {
184:                        numRootSupplyTasks = Integer.parseInt(data);
185:                    } else if (name.equals(NUMBER_OF_ROOT_TRANSPORT_TASKS_ATTR)) {
186:                        numRootTransportTasks = Integer.parseInt(data);
187:                    } else {
188:                        throw new UnexpectedXMLException("Unexpected tag: "
189:                                + name);
190:                    }
191:                } catch (NumberFormatException e) {
192:                    throw new UnexpectedXMLException("Malformed Number: "
193:                            + name + " : " + data);
194:                }
195:            }
196:
197:            /**
198:             * Report an endElement.
199:             * @param name endElement tag
200:             * @return true iff the object is DONE being DeXMLized
201:             **/
202:            public boolean closeTag(String name) throws UnexpectedXMLException {
203:                return name.equals(NAME_TAG);
204:            }
205:
206:            /**
207:             * This function will be called whenever a subobject has
208:             * completed de-XMLizing and needs to be encorporated into
209:             * this object.
210:             * @param name the startElement tag that caused this subobject
211:             * to be created
212:             * @param obj the object itself
213:             **/
214:            public void completeSubObject(String name, DeXMLable obj)
215:                    throws UnexpectedXMLException {
216:                throw new UnexpectedXMLException("Unexpected object: " + obj);
217:            }
218:
219:            //Inner Classes:
220:
221:            /** 
222:             * Set the serialVersionUID to keep the object serializer from seeing
223:             * xerces (org.xml.sax.Attributes).
224:             */
225:            private static final long serialVersionUID = 2789998238928387475L;
226:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.