ga4robot
类 GeneGroup

java.lang.Object
  继承者 ga4robot.GeneGroup

public class GeneGroup
extends java.lang.Object

代选基因组


构造方法摘要
GeneGroup(int id, int n)
          基因组构造函数
 
方法摘要
 void addGene(int id, Gene gene)
          添加基因
 Gene getGene(int id)
          获取基因
static GeneGroup getGroup(int id)
          获取组
static int getGroupSize()
           
 Gene getRandomGene()
          随机获取基因
 int getSize()
          基因组大小
static void initGroup(int n)
          随机初始化测试数据
static void loadGroup(java.io.InputStream config)
          加载基因组
static void saveGroup(java.io.OutputStream config)
          保存基因组
 void setGene(int id, Gene gene)
          设置基因
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

GeneGroup

public GeneGroup(int id,
                 int n)
基因组构造函数

参数:
id - 基因位
n - 基因组大小
方法详细信息

setGene

public void setGene(int id,
                    Gene gene)
设置基因

参数:
id - 基因位
gene - 基因

addGene

public void addGene(int id,
                    Gene gene)
添加基因

参数:
id - 基因位
gene - 基因

getGene

public Gene getGene(int id)
获取基因

参数:
id - 基因位
返回:
基因

getRandomGene

public Gene getRandomGene()
随机获取基因

返回:
基因

getSize

public int getSize()
基因组大小

返回:

initGroup

public static void initGroup(int n)
                      throws java.io.IOException
随机初始化测试数据

参数:
n - 基因位数
抛出:
java.io.IOException

saveGroup

public static void saveGroup(java.io.OutputStream config)
                      throws java.io.IOException,
                             org.xml.sax.SAXException,
                             javax.xml.parsers.ParserConfigurationException
保存基因组

参数:
config - 输出流
抛出:
java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

loadGroup

public static void loadGroup(java.io.InputStream config)
                      throws java.io.IOException,
                             org.xml.sax.SAXException,
                             javax.xml.parsers.ParserConfigurationException
加载基因组

参数:
config - 输入流
抛出:
java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

getGroup

public static GeneGroup getGroup(int id)
获取组

参数:
id - 基因位
返回:
基因组

getGroupSize

public static int getGroupSize()
返回:
基因组数,即基因位数