KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgap > distr > grid > GridConfigurationBase


1 /*
2  * This file is part of JGAP.
3  *
4  * JGAP offers a dual license model containing the LGPL as well as the MPL.
5  *
6  * For licencing information please see the file license.txt included with JGAP
7  * or have a look at the top of class org.jgap.Chromosome which representatively
8  * includes the JGAP license policy applicable for any file delivered with JGAP.
9  */

10 package org.jgap.distr.grid;
11
12 import org.jgap.*;
13 import org.homedns.dade.jcgrid.client.*;
14
15 /**
16  * Abstract base class for the important grid configuration. It holds any
17  * information necessary to describe a problem and the way it is solved
18  * distributedly.
19  *
20  * @author Klaus Meffert
21  * @since 3.2
22  */

23 public abstract class GridConfigurationBase
24     implements IGridConfiguration {
25   /** String containing the CVS revision. Read out via reflection!*/
26   private final static String JavaDoc CVS_REVISION = "$Revision: 1.1 $";
27
28   private IClientFeedback m_clientFeedback;
29
30   private IRequestSplitStrategy m_splitStrategy;
31
32   private Configuration m_config;
33
34   private IClientEvolveStrategy m_clientEvolveStrategy;
35
36   private IWorkerEvolveStrategy m_workerEvolveStrategy;
37
38   private IWorkerReturnStrategy m_workerReturnStrategy;
39
40   private IGenotypeInitializer m_genotypeInitializer;
41   private String JavaDoc m_packageName;
42
43   public GridConfigurationBase() {
44 // m_packageName = getClass().getPackage().getName();
45
}
46
47   public String JavaDoc getPackageName() {
48     return m_packageName;
49   }
50
51   public IClientFeedback getClientFeedback() {
52     return m_clientFeedback;
53   }
54
55   public IClientEvolveStrategy getClientEvolveStrategy() {
56     return m_clientEvolveStrategy;
57   }
58
59   public IRequestSplitStrategy getRequestSplitStrategy() {
60     return m_splitStrategy;
61   }
62
63   public Configuration getConfiguration() {
64     return m_config;
65   }
66
67   public void setConfiguration(Configuration a_config) {
68     m_config = a_config;
69   }
70
71   public IWorkerEvolveStrategy getWorkerEvolveStrategy() {
72     return m_workerEvolveStrategy;
73   }
74
75   public IWorkerReturnStrategy getWorkerReturnStrategy() {
76     return m_workerReturnStrategy;
77   }
78
79   public IGenotypeInitializer getGenotypeInitializer() {
80     return m_genotypeInitializer;
81   }
82
83   public void setGenotypeInitializer(IGenotypeInitializer a_initializer) {
84     m_genotypeInitializer = a_initializer;
85   }
86
87   public void setWorkerReturnStrategy(IWorkerReturnStrategy a_strategy) {
88     m_workerReturnStrategy = a_strategy;
89   }
90
91   public void setWorkerEvolveStrategy(IWorkerEvolveStrategy a_strategy) {
92     m_workerEvolveStrategy = a_strategy;
93   }
94
95   /**
96    * Write your initialization of the private attributes here!
97    *
98    * @param a_gridconfig current grid node client configuration (provided via
99    * the command line at startup)
100    * @throws Exception in case of any error
101    */

102   public abstract void initialize(GridNodeClientConfig a_gridconfig)
103       throws Exception JavaDoc;
104
105   /**
106    * Called immediately before starting the grid computation. Verify here,
107    * if your configuration is setup properly and all fields are initialized
108    * correctly.
109    *
110    * @throws Exception
111    */

112   public abstract void validate()
113       throws Exception JavaDoc;
114
115   public void setClientEvolveStrategy(IClientEvolveStrategy
116                                       a_strategy) {
117     m_clientEvolveStrategy = a_strategy;
118   }
119
120   public void setClientFeedback(IClientFeedback a_clientFeedback) {
121     m_clientFeedback = a_clientFeedback;
122   }
123
124   public void setRequestSplitStrategy(IRequestSplitStrategy a_splitStrategy) {
125     m_splitStrategy = a_splitStrategy;
126   }
127 }
128
Popular Tags