Source Code Cross Referenced for JGAPRequest.java in  » Development » jgap » org » jgap » distr » grid » 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 » Development » jgap » org.jgap.distr.grid 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file is part of JGAP.
003:         *
004:         * JGAP offers a dual license model containing the LGPL as well as the MPL.
005:         *
006:         * For licencing information please see the file license.txt included with JGAP
007:         * or have a look at the top of class org.jgap.Chromosome which representatively
008:         * includes the JGAP license policy applicable for any file delivered with JGAP.
009:         */
010:        package org.jgap.distr.grid;
011:
012:        import org.homedns.dade.jcgrid.*;
013:        import org.jgap.*;
014:        import org.jgap.util.*;
015:        import org.homedns.dade.jcgrid.worker.*;
016:
017:        /**
018:         * An instance that creates single requests to be sent to a worker.
019:         *
020:         * @author Klaus Meffert
021:         * @since 3.1
022:         */
023:        public class JGAPRequest extends WorkRequest implements  ICloneable {
024:            /** String containing the CVS revision. Read out via reflection!*/
025:            private final static String CVS_REVISION = "$Revision: 1.9 $";
026:
027:            private Configuration m_config;
028:
029:            private Population m_pop;
030:
031:            private IWorkerEvolveStrategy m_evolveStrategy;
032:
033:            private IWorkerReturnStrategy m_returnStrategy;
034:
035:            private IGenotypeInitializer m_genotypeInitializer;
036:
037:            private GridWorkerFeedback m_workerFeedback;
038:
039:            /**
040:             * Constructor.
041:             *
042:             * @param a_name String
043:             * @param a_id int
044:             * @param a_config Configuration
045:             * @param a_strategy the strategy to choose for evolution
046:             *
047:             * @author Klaus Meffert
048:             * @since 3.1
049:             */
050:            public JGAPRequest(String a_name, int a_id, Configuration a_config,
051:                    IWorkerEvolveStrategy a_strategy) {
052:                super (a_name, a_id);
053:                m_config = a_config;
054:                m_evolveStrategy = a_strategy;
055:            }
056:
057:            /**
058:             * Constructor.
059:             *
060:             * @param a_name session name
061:             * @param a_id request id
062:             * @param a_config Configuration
063:             *
064:             * @author Klaus Meffert
065:             * @since 3.1
066:             */
067:            public JGAPRequest(String a_name, int a_id, Configuration a_config) {
068:                this (a_name, a_id, a_config, new DefaultEvolveStrategy());
069:            }
070:
071:            /**
072:             * Constructor. Allows to specify a preset population with which the genotype
073:             * will be initialized.
074:             *
075:             * @param a_name session name
076:             * @param a_id request id
077:             * @param a_config Configuration
078:             * @param a_pop Population
079:             * @param a_strategy the strategy to choose for evolution
080:             *
081:             * @author Klaus Meffert
082:             * @since 3.2
083:             */
084:            public JGAPRequest(String a_name, int a_id, Configuration a_config,
085:                    Population a_pop, IWorkerEvolveStrategy a_strategy) {
086:                this (a_name, a_id, a_config, a_strategy);
087:                m_pop = a_pop;
088:            }
089:
090:            /**
091:             * Constructor. Allows to specify a preset population with which the genotype
092:             * will be initialized.
093:             *
094:             * @param a_name session name
095:             * @param a_id request id
096:             * @param a_config Configuration
097:             * @param a_pop Population
098:             *
099:             * @author Klaus Meffert
100:             * @since 3.2
101:             */
102:            public JGAPRequest(String a_name, int a_id, Configuration a_config,
103:                    Population a_pop) {
104:                this (a_name, a_id, a_config, a_pop, new DefaultEvolveStrategy());
105:            }
106:
107:            /**
108:             * Sets the strategy to use for executing the evolution with a worker for
109:             * a single request.
110:             *
111:             * @param a_evolveStrategy the evolve strategy to use
112:             *
113:             * @author Klaus Meffert
114:             * @since 3.2
115:             */
116:            public void setEvolveStrategy(IWorkerEvolveStrategy a_evolveStrategy) {
117:                m_evolveStrategy = a_evolveStrategy;
118:            }
119:
120:            /**
121:             * @return the evolve strategy set
122:             *
123:             * @author Klaus Meffert
124:             * @since 3.2
125:             */
126:            public IWorkerEvolveStrategy getWorkerEvolveStrategy() {
127:                return m_evolveStrategy;
128:            }
129:
130:            public void setWorkerReturnStrategy(IWorkerReturnStrategy a_strategy) {
131:                m_returnStrategy = a_strategy;
132:            }
133:
134:            /**
135:             * @return the strategy which part of a result is returned by a worker
136:             *
137:             * @author Klaus Meffert
138:             * @since 3.2
139:             */
140:            public IWorkerReturnStrategy getWorkerReturnStrategy() {
141:                return m_returnStrategy;
142:            }
143:
144:            public GridWorkerFeedback getWorkerFeedback() {
145:                return m_workerFeedback;
146:            }
147:
148:            public void setWorkerFeedback(GridWorkerFeedback a_feedback) {
149:                m_workerFeedback = a_feedback;
150:            }
151:
152:            /**
153:             * @param a_initializer the IGenotypeInitializer to use
154:             *
155:             * @author Klaus Meffert
156:             * @since 3.2
157:             */
158:            public void setGenotypeInitializer(
159:                    IGenotypeInitializer a_initializer) {
160:                m_genotypeInitializer = a_initializer;
161:            }
162:
163:            /**
164:             * @return the IGenotypeInitializer set
165:             *
166:             * @author Klaus Meffert
167:             * @since 3.2
168:             */
169:            public IGenotypeInitializer getGenotypeInitializer() {
170:                return m_genotypeInitializer;
171:            }
172:
173:            /**
174:             * Sets the Population to store in this request so that it can be passed to
175:             * workers.
176:             *
177:             * @param a_pop the Population to store
178:             *
179:             * @author Klaus Meffert
180:             * @since 3.2
181:             */
182:            public void setPopulation(Population a_pop) {
183:                m_pop = a_pop;
184:            }
185:
186:            /**
187:             * @return the configuration set
188:             *
189:             * @author Klaus Meffert
190:             * @since 3.1
191:             */
192:            public Configuration getConfiguration() {
193:                return m_config;
194:            }
195:
196:            /**
197:             * Set a modified configuration. Should only be used to re-set a configuration
198:             * because some parts have not been serialized.
199:             * @param a_conf the Configuration to set
200:             *
201:             * @author Klaus Meffert
202:             * @since 3.2
203:             */
204:            public void setConfiguration(Configuration a_conf) {
205:                m_config = a_conf;
206:            }
207:
208:            /**
209:             * @return the population used to initialize new requests. May be null or
210:             * empty
211:             *
212:             * @author Klaus Meffert
213:             * @since 3.2
214:             */
215:            public Population getPopulation() {
216:                return m_pop;
217:            }
218:
219:            /**
220:             * @return deep clone of current instance
221:             *
222:             * @author Klaus Meffert
223:             * @since 3.2
224:             */
225:            public Object clone() {
226:                JGAPRequest result = newInstance(getSessionName(), getRID());
227:                return result;
228:            }
229:
230:            /**
231:             * Creates a new instance using the given name and ID. Reason for this method:
232:             * ID cannot be set other than with construction!
233:             *
234:             * @param a_name the name to set
235:             * @param a_ID unique ID to set
236:             * @return newly created JGAPRequest object
237:             *
238:             * @author Klaus Meffert
239:             * @since 3.2
240:             */
241:            public JGAPRequest newInstance(String a_name, int a_ID) {
242:                JGAPRequest result = new JGAPRequest(a_name, a_ID,
243:                        getConfiguration(), getPopulation());
244:                result.setEvolveStrategy(getWorkerEvolveStrategy());
245:                result.setGenotypeInitializer(getGenotypeInitializer());
246:                result.setWorkerReturnStrategy(getWorkerReturnStrategy());
247:                return result;
248:            }
249:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.