Source Code Cross Referenced for GraphNode.java in  » Workflow-Engines » pegasus-2.1.0 » org » griphyn » cPlanner » partitioner » 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.partitioner 
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:        package org.griphyn.cPlanner.partitioner;
016:
017:        import org.griphyn.cPlanner.classes.Data;
018:
019:        import java.util.Iterator;
020:        import java.util.List;
021:
022:        /**
023:         * Data class that allows us to construct information about the nodes
024:         * in the abstract graph. Contains for each node the references to it's
025:         * parents and children.
026:         *
027:         * @author Karan Vahi
028:         * @version $Revision: 50 $
029:         */
030:        public class GraphNode extends Data {
031:
032:            //the constants for the color of the nodes
033:            public static final int WHITE_COLOR = 0;
034:            public static final int GRAY_COLOR = 1;
035:            public static final int BLACK_COLOR = 2;
036:
037:            /**
038:             * The logical id of the job as identified in the dax.
039:             */
040:            private String mLogicalID;
041:
042:            /**
043:             * The logical name of the node as identified in the dax.
044:             */
045:            private String mLogicalName;
046:
047:            /**
048:             * The depth of the node from the root or any arbitary node.
049:             */
050:            private int mDepth;
051:
052:            /**
053:             * The color the node is colored.
054:             */
055:            private int mColor;
056:
057:            /**
058:             * The list of parents of the job/node in the abstract graph. Each element
059:             * of the list is a <code>GraphNode</code> object.
060:             */
061:            private List mParents;
062:
063:            /**
064:             * The list of children of the job/node in the abstract graph. Each element
065:             * of the list is a <code>GraphNode</code> object.
066:             */
067:            private List mChildren;
068:
069:            /**
070:             * A Bag of objects that maybe associated with the node.
071:             *
072:             * @see Bag
073:             */
074:            private Bag mBag;
075:
076:            /**
077:             * The default constructor.
078:             */
079:            public GraphNode() {
080:                mLogicalID = new String();
081:                mParents = new java.util.LinkedList();
082:                mChildren = null;
083:                mDepth = -1;
084:                mLogicalName = new String();
085:                mColor = this .WHITE_COLOR;
086:                mBag = null;
087:            }
088:
089:            /**
090:             * The overloaded constructor.
091:             *
092:             * @param id    the logical id of the node.
093:             * @param name  the name of the node.
094:             */
095:            public GraphNode(String id, String name) {
096:                mLogicalID = id;
097:                mParents = new java.util.LinkedList();
098:                mChildren = new java.util.LinkedList();
099:                mDepth = -1;
100:                mLogicalName = name;
101:                mColor = this .WHITE_COLOR;
102:            }
103:
104:            /**
105:             * Sets the bag of objects associated with the node.
106:             */
107:            public void setBag(Bag bag) {
108:                mBag = bag;
109:            }
110:
111:            /**
112:             * It adds the parents to the node. It ends up overwriting all the existing
113:             * parents if some already exist.
114:             */
115:            public void setParents(List parents) {
116:                mParents = parents;
117:            }
118:
119:            /**
120:             * It sets the children to the node. It ends up overwriting all the existing
121:             * parents if some already exist.
122:             */
123:            public void setChildren(List children) {
124:                mChildren = children;
125:            }
126:
127:            /**
128:             * Sets the depth associated with the node.
129:             */
130:            public void setDepth(int depth) {
131:                mDepth = depth;
132:            }
133:
134:            /**
135:             * Returns the bag of objects associated with the node.
136:             *
137:             * @return the bag or null if no bag associated
138:             */
139:            public Bag getBag() {
140:                return mBag;
141:            }
142:
143:            /**
144:             * Returns a reference to the parents of the node.
145:             */
146:            public List getParents() {
147:                return mParents;
148:            }
149:
150:            /**
151:             * Returns a reference to the parents of the node.
152:             */
153:            public List getChildren() {
154:                return mChildren;
155:            }
156:
157:            /**
158:             * Adds a child to end of the child list.
159:             */
160:            public void addChild(GraphNode child) {
161:                mChildren.add(child);
162:            }
163:
164:            /**
165:             * Returns the logical id of the graph node.
166:             */
167:            public String getID() {
168:                return mLogicalID;
169:            }
170:
171:            /**
172:             * Returns the logical name of the graph node.
173:             */
174:            public String getName() {
175:                return mLogicalName;
176:            }
177:
178:            /**
179:             * Returns the depth of the node in the graph.
180:             */
181:            public int getDepth() {
182:                return mDepth;
183:            }
184:
185:            /**
186:             * Returns if the color of the node is as specified.
187:             *
188:             * @param color  color that node should be.
189:             */
190:            public boolean isColor(int color) {
191:                return (mColor == color) ? true : false;
192:            }
193:
194:            /**
195:             * Sets the color of the node to the color specified
196:             *
197:             * @param color  color that node should be.
198:             */
199:            public void setColor(int color) {
200:                mColor = color;
201:            }
202:
203:            /**
204:             * Returns if all the parents of that node have the color that is specified.
205:             *
206:             * @param color the color of the node.
207:             *
208:             * @return  true if there are no parents or all parents are of the color.
209:             *          false in all other  cases.
210:             */
211:            public boolean parentsColored(int color) {
212:                boolean colored = true;
213:                GraphNode par;
214:                if (mParents == null) {
215:                    return colored;
216:                }
217:
218:                Iterator it = mParents.iterator();
219:                while (it.hasNext() && colored) {
220:                    par = (GraphNode) it.next();
221:                    colored = par.isColor(color);
222:                }
223:
224:                return colored;
225:            }
226:
227:            /**
228:             * The textual representation of the graph node.
229:             */
230:            public String toString() {
231:                StringBuffer sb = new StringBuffer();
232:                Iterator it;
233:
234:                sb.append("ID->").append(mLogicalID).append(" name->").append(
235:                        mLogicalName).append(" parents->{");
236:                if (mParents != null) {
237:                    it = mParents.iterator();
238:                    while (it.hasNext()) {
239:                        sb.append(((GraphNode) it.next()).getID()).append(',');
240:                    }
241:
242:                }
243:                sb.append("} children->{");
244:                it = mChildren.iterator();
245:                while (it.hasNext()) {
246:                    sb.append(((GraphNode) it.next()).getID()).append(',');
247:                }
248:                sb.append("}");
249:                sb.append(" Bag-{").append(getBag()).append("}");
250:                return sb.toString();
251:            }
252:
253:            /**
254:             * Returns a copy of the object.
255:             */
256:            public Object clone() {
257:                return new java.lang.CloneNotSupportedException(
258:                        "Clone() not implemented in GraphNode");
259:            }
260:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.