KickJava   Java API By Example, From Geeks To Geeks.

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


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
14 /**
15  * Default and simple implementation for IWorkerReturnStrategy.
16  *
17  * @author Klaus Meffert
18  * @since 3.2
19  */

20 public class DefaultWorkerReturnStrategy
21     implements IWorkerReturnStrategy {
22   /** String containing the CVS revision. Read out via reflection!*/
23   private final static String JavaDoc CVS_REVISION = "$Revision: 1.1 $";
24
25   /**
26    * Simple returns the fittest chromosome.
27    *
28    * @param a_req JGAPRequest
29    * @param a_genotype Genotype
30    * @return JGAPResult
31    *
32    * @author Klaus Meffert
33    * @since 3.2
34    */

35   public JGAPResult assembleResult(JGAPRequest a_req, Genotype a_genotype) {
36     try {
37       IChromosome fittest = a_genotype.getFittestChromosome();
38       Population pop = new Population(a_req.getConfiguration(), fittest);
39       JGAPResult result = new JGAPResult(a_req.getSessionName(), a_req.getRID(),
40           pop, 1);
41       return result;
42     } catch (Throwable JavaDoc t) {
43       throw new RuntimeException JavaDoc(t);
44     }
45   }
46 }
47
Popular Tags