⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 environmentverifier.htm

📁 遗传算法GPE_release_v1.0.tar
💻 HTM
字号:
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Genetic Programming FAQ</title>
</head>

<body>

<div id="nsbanner">
  <table cellSpacing="0" cellPadding="0" width="100%" border="0">
    <tr>
      <td>
      <div id="bannerrow1">
        <table class="bannerparthead" cellSpacing="0">
          <tr id="hdr">
            <td class="runninghead" style="font-size: 70%">
            <font face="Arial"><a class="show" id="design_toggle" title="Show or hide design notes" href="../../index.html"><img src="../../Images/Icons/G.png" width="14" height="14" border="0" align="middle"/></a> Genetic Programming Engine FAQ</font></td>
          </tr>
        </table>
      </div>
      <div id="TitleRow">
        <h1 class="dtH1" style="font-size: 85%; left: 5px; position: relative">
        <font face="Arial">Verifying the Environment</font></h1>
      </div>
      </td>
      <td vAlign="top" align="right">
      <font face="Arial">
      <img src="../../Images/Icons/GP_blue.png" width="191" height="39"></font></td>
    </tr>
  </table>
  <p><font face="Arial">The EnvironmentVerifier verifies that the collection of EnvironmentReferences passed to its constructor 
	each have the appropriate characteristics and implement all required members for an 
	<b>IEnvironment</b> class used by the <b>GPEngine</b>. It initializes a new instance of the EnvironmentVerifier class with the specified 
		EnvironmentReferences and determines if there is an invalid element.<p></div>
<div id="nstext">
  <div align="center">
    <center>
    <div align="center">
      <center>
      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%" id="AutoNumber1">
        <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"> 
          EnvironmentVerifier( EnvironmentReference[] environments ) {</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">//do basic checks</p>
          </font><font SIZE="2">
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">if( environments == 
          null</font><font SIZE="2"><font face="Courier New"> ) {</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">throw new</font><font face="Courier New" SIZE="2"> 
          ArgumentNullException( &quot;environments&quot;, &quot;The array of environment</font></p>
          <p style="margin-top: 0; margin-bottom: 0">
          <font face="Courier New" SIZE="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </font><font SIZE="2"><font face="Courier New">&nbsp;references passed 
          to EnvironmentVerifier.constructor was null.&quot; );</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          }</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">if</font><font SIZE="2"><font face="Courier New">( 
          environments.Length == 0 ) {</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">throw new</font><font face="Courier New" SIZE="2"> 
          ArgumentException( &quot;The array of environment references passed to</font></p>
          <p style="margin-top: 0; margin-bottom: 0">
          <font face="Courier New" SIZE="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </font><font SIZE="2"><font face="Courier New">&nbsp;EnvironmentVerifier.constructor 
          was empty.&quot;, &quot;environments&quot; );</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          }</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">//instantiate each 
          reference</p>
          </font><font SIZE="2">
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          EnvironmentCollection envs = </font></font>
          <font SIZE="2" face="Courier New">null</font><font SIZE="2"><font face="Courier New">;</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">try</font><font SIZE="2"><font face="Courier New"> 
          {</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
          envs = Tester.CreateEnvironments( environments );</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          }</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">catch</font><font SIZE="2"><font face="Courier New">( 
          ArgumentException e ) {</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">throw new</font><font face="Courier New" SIZE="2"> 
          ArgumentException( &quot;The array of environment references passed to</font></p>
          <p style="margin-top: 0; margin-bottom: 0">
          <font face="Courier New" SIZE="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </font><font face="Courier New" SIZE="2">&nbsp;EnvironmentVerifier.constructor 
          had at least one invalid element.&quot;,</font></p>
          <p style="margin-top: 0; margin-bottom: 0">
          <font face="Courier New" SIZE="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </font><font SIZE="2"><font face="Courier New">&nbsp;&quot;environments&quot;, e 
          );</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          }</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">//everything checks 
          out</p>
          </font><font SIZE="2">
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          m_Environments = </font></font><font SIZE="2" face="Courier New">new</font><font SIZE="2"><font face="Courier New"> 
          ReadOnlyEnvironmentReferenceCollection( environments );</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          m_InstantiatedEnvironments = </font></font>
          <font SIZE="2" face="Courier New">new</font><font SIZE="2"><font face="Courier New"> 
          ReadOnlyEnvironmentCollection( envs );</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">}</font></font></td>
        </tr>
      </table>
      </center>
    </div>
    </center>
  <p class="dtH4" align="left"><font face="Arial">The Environments method gets the verified collection of EnvironmentReferences.</font></p>
  </div>
  <div align="center">
    <center>
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%" id="AutoNumber2">
      <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"> 
        ReadOnlyEnvironmentReferenceCollection Environments {</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
        </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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" face="Courier New">return</font><font SIZE="2"><font face="Courier New"> 
        m_Environments;</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
        }</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</font><font SIZE="2"><font face="Courier New"> 
        ReadOnlyEnvironmentReferenceCollection m_Environments;</font></font></td>
      </tr>
    </table>
    </center>
  </div>
  <p class="dtH4" align="left">The InstantiatedEnvironments method gets the collection of instantiated IEnvironments referenced by Environments.
  <br>
&nbsp;<div align="center">
    <center>
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%" id="AutoNumber3">
      <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"> 
        ReadOnlyEnvironmentCollection InstantiatedEnvironments {</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
        </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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" face="Courier New">return</font><font SIZE="2"><font face="Courier New"> 
        m_InstantiatedEnvironments;</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
        }</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</font><font face="Courier New" SIZE="2"> 
        ReadOnlyEnvironmentCollection m_InstantiatedEnvironments;</font></td>
      </tr>
    </table>
    </center>
  </div>
  <p class="dtH4">&nbsp;</p>
  <h4 class="dtH4"><font face="Arial">See Also</font></h4>
  <p>
  <a href="../GPE.htm">GPEngine</a> | <a href="../ProblemSpace/Environment.htm">
  IEnvironment</a></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 + -