<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns=“www.w3.org/1999/xhtml” xml:lang=“en” lang=“en”>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>

Class: NEAT::Graph::DependencyResolver

  &mdash; Documentation by YARD 0.8.7.3

</title>

<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />

<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />

<script type=“text/javascript” charset=“utf-8”>

hasFrames = window.top.frames.main ? true : false;
relpath = '../../';
framesUrl = "../../frames.html#!" + escape(window.location.href);

</script>

<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>

<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>

</head>
<body>
  <div id="header">
    <div id="menu">

  <a href="../../_index.html">Index (D)</a> &raquo;
  <span class='title'><span class='object_link'><a href="../../NEAT.html" title="NEAT (module)">NEAT</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Graph.html" title="NEAT::Graph (module)">Graph</a></span></span>
   &raquo; 
  <span class="title">DependencyResolver</span>

<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>

</div>

  <div id="search">

<a class="full_list_link" id="class_list_link"
    href="../../class_list.html">
  Class List
</a>

<a class="full_list_link" id="method_list_link"
    href="../../method_list.html">
  Method List
</a>

<a class="full_list_link" id="file_list_link"
    href="../../file_list.html">
  File List
</a>

</div>

  <div class="clear"></div>
</div>

<iframe id="search_frame"></iframe>

<div id="content"><h1>Class: NEAT::Graph::DependencyResolver

</h1>

<dl class=“box”>

<dt class="r1">Inherits:</dt>
<dd class="r1">
  <span class="inheritName"><span class='object_link'><a href="../NeatOb.html" title="NEAT::NeatOb (class)">NeatOb</a></span></span>

    <ul class="fullTree">
      <li>Object</li>

        <li class="next"><span class='object_link'><a href="../NeatOb.html" title="NEAT::NeatOb (class)">NeatOb</a></span></li>

        <li class="next">NEAT::Graph::DependencyResolver</li>

    </ul>
    <a href="#" class="inheritanceTree">show all</a>

  </dd>

<dt class="r2 last">Defined in:</dt>
<dd class="r2 last">lib/rubyneat/graph.rb</dd>

</dl> <div class=“clear”></div>

<h2>Overview</h2><div class=“docstring”>

<div class="discussion">

<p>Create an instantiation of this and pass it a list of nodes to resolve.</p>

</div>

</div> <div class=“tags”>

</div>

<h2>Instance Attribute Summary</h2>

<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="../NeatOb.html" title="NEAT::NeatOb (class)">NeatOb</a></span></h3>
<p class="inherited"><span class='object_link'><a href="../NeatOb.html#controller-instance_method" title="NEAT::NeatOb#controller (method)">#controller</a></span>, <span class='object_link'><a href="../NeatOb.html#name-instance_method" title="NEAT::NeatOb#name (method)">#name</a></span></p>

  <h2>
    Class Method Summary
    <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
  </h2>

  <ul class="summary">

      <li class="public ">
<span class="summary_signature">

    <a href="#%5B%5D-class_method" title="[] (class method)">+ (Object) <strong>[]</strong>(*outs) </a>

</span>

  <span class="summary_desc"><div class='inline'>

<p>Create a DependencyResolver from either an array of outputs or a parameter list of outputs.</p> </div></span>

</li>

  </ul>

  <h2>
    Instance Method Summary
    <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
  </h2>

  <ul class="summary">

      <li class="public ">
<span class="summary_signature">

    <a href="#initialize-instance_method" title="#initialize (instance method)">- (DependencyResolver) <strong>initialize</strong>(outputs, &amp;block) </a>

</span>

  <span class="note title constructor">constructor</span>

  <span class="summary_desc"><div class='inline'>

<p>Given a list of output nodes, we shall work backwards from them to resolve their dependencies.</p> </div></span>

</li>

      <li class="public ">
<span class="summary_signature">

    <a href="#resolve-instance_method" title="#resolve (instance method)">- (Object) <strong>resolve</strong> </a>

</span>

  <span class="summary_desc"><div class='inline'>

<p>Resolve dependencies, and return [dependency_list, circular_ref_node_list] Note that circular_ref_node_list shall be nil if there are no dependencies!.</p> </div></span>

</li>

      <li class="public ">
<span class="summary_signature">

    <a href="#resolve%21-instance_method" title="#resolve! (instance method)">- (Object) <strong>resolve!</strong> </a>

</span>

  <span class="summary_desc"><div class='inline'>

<p>Throw an exception if dependencies are found.</p> </div></span>

</li>

  </ul>

<h3 class="inherited">Methods inherited from <span class='object_link'><a href="../NeatOb.html" title="NEAT::NeatOb (class)">NeatOb</a></span></h3>
<p class="inherited"><span class='object_link'><a href="../NeatOb.html#log-instance_method" title="NEAT::NeatOb#log (method)">#log</a></span>, <span class='object_link'><a href="../NeatOb.html#log-class_method" title="NEAT::NeatOb.log (method)">log</a></span>, <span class='object_link'><a href="../NeatOb.html#to_s-instance_method" title="NEAT::NeatOb#to_s (method)">#to_s</a></span></p>

<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>

  <div class="method_details first">
<h3 class="signature first" id="initialize-instance_method">

  - (<tt><span class='object_link'><a href="" title="NEAT::Graph::DependencyResolver (class)">DependencyResolver</a></span></tt>) <strong>initialize</strong>(outputs, &amp;block)

</h3><div class=“docstring”>

<div class="discussion">

<p>Given a list of output nodes, we shall work backwards from them to resolve their dependencies.</p>

</div>

</div> <div class=“tags”>

</div><table class=“source_code”>

<tr>
  <td>
    <pre class="lines">

40 41 42 43 44</pre>

</td>
<td>
  <pre class="code"><span class="info file"># File 'lib/rubyneat/graph.rb', line 40</span>

<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_outputs'>outputs</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>

<span class='ivar'>@outputs</span> <span class='op'>=</span> <span class='id identifier rubyid_outputs'>outputs</span>
<span class='kw'>super</span>
<span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>

<span class='kw'>end</span></pre>

  </td>
</tr>

</table> </div>

</div>

<div id="class_method_details" class="method_details_list">
  <h2>Class Method Details</h2>

    <div class="method_details first">
<h3 class="signature first" id="[]-class_method">

  + (<tt>Object</tt>) <strong>[]</strong>(*outs)

</h3><div class=“docstring”>

<div class="discussion">

<p>Create a DependencyResolver from either an array of outputs or a parameter list of outputs.</p>

</div>

</div> <div class=“tags”>

</div><table class=“source_code”>

<tr>
  <td>
    <pre class="lines">

48 49 50 51</pre>

</td>
<td>
  <pre class="code"><span class="info file"># File 'lib/rubyneat/graph.rb', line 48</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='op'>[]</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_outs'>outs</span><span class='rparen'>)</span>

<span class='id identifier rubyid_outs'>outs</span> <span class='op'>=</span> <span class='id identifier rubyid_outs'>outs</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='kw'>if</span> <span class='id identifier rubyid_outs'>outs</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span> <span class='const'>Array</span>
<span class='const'>DependencyResolver</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='id identifier rubyid_outs'>outs</span>

<span class='kw'>end</span></pre>

  </td>
</tr>

</table> </div>

</div>

<div id="instance_method_details" class="method_details_list">
  <h2>Instance Method Details</h2>

    <div class="method_details first">
<h3 class="signature first" id="resolve-instance_method">

  - (<tt>Object</tt>) <strong>resolve</strong>

</h3><div class=“docstring”>

<div class="discussion">

<p>Resolve dependencies, and return [dependency_list, circular_ref_node_list] Note that circular_ref_node_list shall be nil if there are no dependencies!</p>

</div>

</div> <div class=“tags”>

</div><table class=“source_code”>

<tr>
  <td>
    <pre class="lines">

56 57 58 59 60 61 62 63 64</pre>

</td>
<td>
  <pre class="code"><span class="info file"># File 'lib/rubyneat/graph.rb', line 56</span>

<span class='kw'>def</span> <span class='id identifier rubyid_resolve'>resolve</span>

<span class='ivar'>@resolved</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='ivar'>@unresolved</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='ivar'>@circular</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='ivar'>@outputs</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_onode'>onode</span><span class='op'>|</span>
  <span class='id identifier rubyid_rdep'>rdep</span> <span class='id identifier rubyid_onode'>onode</span>
<span class='kw'>end</span>
<span class='lbracket'>[</span><span class='ivar'>@resolved</span><span class='comma'>,</span> <span class='ivar'>@circular</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>?</span> <span class='kw'>nil</span> <span class='op'>:</span> <span class='ivar'>@circular</span><span class='rbracket'>]</span>

<span class='kw'>end</span></pre>

  </td>
</tr>

</table> </div>

    <div class="method_details ">
<h3 class="signature " id="resolve!-instance_method">

  - (<tt>Object</tt>) <strong>resolve!</strong>

</h3><div class=“docstring”>

<div class="discussion">

<p>Throw an exception if dependencies are found. We only return the dependency list since we throw an exception on circular dependencies.</p>

</div>

</div> <div class=“tags”>

</div><table class=“source_code”>

<tr>
  <td>
    <pre class="lines">

69 70 71 72 73</pre>

</td>
<td>
  <pre class="code"><span class="info file"># File 'lib/rubyneat/graph.rb', line 69</span>

<span class='kw'>def</span> <span class='id identifier rubyid_resolve!'>resolve!</span>

<span class='id identifier rubyid_dl'>dl</span><span class='comma'>,</span> <span class='id identifier rubyid_cl'>cl</span> <span class='op'>=</span> <span class='id identifier rubyid_resolve'>resolve</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>GraphException</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Circular Dependency Detected: %s</span><span class='tstring_end'>&quot;</span></span> <span class='op'>%</span> <span class='id identifier rubyid_cl'>cl</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_cl'>cl</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
<span class='id identifier rubyid_dl'>dl</span>

<span class='kw'>end</span></pre>

  </td>
</tr>

</table> </div>

</div>

</div>

  <div id="footer">
Generated on Sun Mar 16 16:36:51 2014 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.7.3 (ruby-2.1.1).

</div>

</body>

</html>