📄 individualinfo.htm
字号:
m_Generation;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
}</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">}</font></p>
<p style="margin-top: 0; margin-bottom: 0"></font>
<font SIZE="2" face="Courier New">private readonly int m_Generation;</font></td>
</tr>
</table>
</center>
</div>
<p class="dtH4"><font face="Arial">The Number method gets the number of the
individual in the generation. </font></p>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%" id="AutoNumber4">
<tr>
<td width="100%"><font SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"></font>
<font SIZE="2" face="Courier New">public int</font><font SIZE="2"><font face="Courier New">
Number {</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</font></font><font SIZE="2" face="Courier New">get</font><font SIZE="2"><font face="Courier New">
{</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</font></font><font SIZE="2" face="Courier New">return</font><font SIZE="2"><font face="Courier New">
m_Number;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
}</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">}</font></p>
<p style="margin-top: 0; margin-bottom: 0"></font>
<font SIZE="2" face="Courier New">private readonly int m_Number;</font></td>
</tr>
</table>
</center>
</div>
<p class="dtH4"><font face="Arial">The BaseClass method gets the type of the
IIndividual Base Class of the individual.</font></p>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%" id="AutoNumber5">
<tr>
<td width="100%"><font SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"></font>
<font SIZE="2" face="Courier New">public</font><font SIZE="2"><font face="Courier New">
Type BaseClass {</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</font></font><font SIZE="2" face="Courier New">get</font><font SIZE="2"><font face="Courier New">
{</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</font></font><font SIZE="2" face="Courier New">return</font><font SIZE="2"><font face="Courier New">
m_BaseClass;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
}</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">}</font></p>
<p style="margin-top: 0; margin-bottom: 0"></font>
<font SIZE="2" face="Courier New">private readonly Type m_BaseClass;</font></td>
</tr>
</table>
</center>
</div>
<p class="dtH4"><font face="Arial">The Parents method gets the Parents of
the individual.</font></p>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%" id="AutoNumber6">
<tr>
<td width="100%"><font SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"></font>
<font SIZE="2" face="Courier New">public</font><font SIZE="2"><font face="Courier New">
ReadOnlyStringCollection Parents {</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</font></font><font SIZE="2" face="Courier New">get</font><font SIZE="2"><font face="Courier New">
{</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</font></font><font SIZE="2" face="Courier New">return</font><font SIZE="2"><font face="Courier New">
m_Parents;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
}</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">}</font></p>
<p style="margin-top: 0; margin-bottom: 0"></font>
<font SIZE="2" face="Courier New">private readonly
ReadOnlyStringCollection m_Parents;</font></td>
</tr>
</table>
</center>
</div>
<p class="dtH4"><font face="Arial">The PrecodeTree method gets the
IPrecodeTree of the individual.</font></p>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%" id="AutoNumber7">
<tr>
<td width="100%"><font SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"></font>
<font SIZE="2" face="Courier New">public</font><font SIZE="2"><font face="Courier New">
IPrecodeTree PrecodeTree {</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</font></font><font SIZE="2" face="Courier New">get</font><font SIZE="2"><font face="Courier New">
{</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</font></font><font SIZE="2" face="Courier New">return</font><font SIZE="2"><font face="Courier New">
m_PrecodeTree;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
}</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">}</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">[NonSerializedAttribute]</font></p>
<p style="margin-top: 0; margin-bottom: 0"></font>
<font SIZE="2" face="Courier New">private readonly IPrecodeTree
m_PrecodeTree;</font></td>
</tr>
</table>
</center>
</div>
<p class="dtH4"><font face="Arial">The CodeTypeDeclaration method generates
the CodeTypeDeclaration for this individual.</font></p>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%" id="AutoNumber8">
<tr>
<td width="100%"><font SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"></font>
<font SIZE="2" face="Courier New">public</font><font SIZE="2"><font face="Courier New">
CodeTypeDeclaration GenerateCodeDomClass() {</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</font></font><font SIZE="2" face="Courier New">//create class
declaration with inheritance from the base type</p>
</font><font SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
CodeTypeDeclaration individualClass = </font></font>
<font SIZE="2" face="Courier New">new</font><font SIZE="2"><font face="Courier New">
CodeTypeDeclaration( Name );</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
individualClass.BaseTypes.Add( BaseClass );</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</font></font><font SIZE="2" face="Courier New">//create Test method</p>
</font><font SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
CodeMemberMethod testMethod = </font></font>
<font SIZE="2" face="Courier New">new</font><font SIZE="2"><font face="Courier New">
CodeMemberMethod();</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
testMethod.ReturnType = </font></font>
<font SIZE="2" face="Courier New">new CodeTypeReference( typeof(void</font><font SIZE="2"><font face="Courier New">)
);</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
testMethod.Attributes = MemberAttributes.Public |
MemberAttributes.Override;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
testMethod.Name = "Test";</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</font></font><font SIZE="2" face="Courier New">//add statements to
method, and add method to type</p>
</font><font SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
testMethod.Statements.AddRange(
m_PrecodeTree.GenerateCodeDomStatements() );</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
individualClass.Members.Add( testMethod );</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</font></font><font SIZE="2" face="Courier New">//return class
declaration</p>
</font><font SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</font></font><font SIZE="2" face="Courier New">return</font><font SIZE="2"><font face="Courier New">
individualClass;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">}</font></font></td>
</tr>
</table>
</center>
</div>
<p class="dtH4"> </p>
<h4 class="dtH4"><font face="Arial">See Also</font></h4>
<p><font face="Arial"><a href="../ProblemSpace/Individual.htm">IIndividual</a>
| <a href="../ProblemSpace/Precode/IPrecode.htm">Precode</a> |
<a href="Population.htm">Population</a></font></p>
<hr>
<div id="footer">
<font face="Arial">
<a href="http://www.opensource.org/" target="_top">
<img style="padding-bottom: 5px" src="http://opensource.org/trademarks/open_source_button.png" align="left" border="0"></a>
This software licensed under the
<a href="http://opensource.org/licenses/afl-2.1.php" target="_top">Academic
Free License version 2.1</a>. (<a href="../../afl-2.1.txt">Plain
text</a>)</font></div>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -