KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgap > gui > MockConfigInfoForTest


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.gui;
11
12 import org.jgap.data.config.*;
13 import java.util.*;
14
15 /**
16  * A Mock implementation of IConfigInfo to test the proper generation of a
17  * Config File.
18  * @author Siddhartha Azad
19  * @since 2.3
20  * */

21 public class MockConfigInfoForTest
22     implements IConfigInfo {
23   final static String JavaDoc CVS_REVISION = "$Revision: 1.2 $";
24
25   // The ConfigData instance that will be populated and returned
26
private ConfigData m_conData;
27
28   /**
29    * @author Siddhartha Azad
30    * @since 2.3
31    */

32   public MockConfigInfoForTest() {
33     m_conData = new ConfigData();
34     // populate the ConfigData instance
35
m_conData.setNS("Configurable");
36     // add the TextField properties
37
m_conData.addTextData("text1", "text1_value");
38     m_conData.addTextData("text2", "text2_value");
39     m_conData.addTextData("text3", "text3_value");
40     // add the List properties
41
List listData;
42     String JavaDoc listName = "";
43     for (int i = 0; i < 3; i++) {
44       listName = "List" + (i + 1);
45       listData = new ArrayList();
46       listData.add(listName + "_value_1");
47       listData.add(listName + "_value_2");
48       listData.add(listName + "_value_3");
49       m_conData.addListData(listName, listData);
50     }
51   }
52
53   public ConfigData getConfigData() {
54     return m_conData;
55   }
56
57   /**
58    * Get the config file to write to.
59    * @return the config file name to write to
60    * */

61   public String JavaDoc getFileName() {
62     // A temporary config file
63
return "jgapTmp.con";
64   }
65
66 }
67
Popular Tags