<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title> Class: Yk::ESet — Documentation by YARD 0.9.24 </title> <link rel="stylesheet" href="../css/style.css" type="text/css" /> <link rel="stylesheet" href="../css/common.css" type="text/css" /> <script type="text/javascript"> pathId = "Yk::ESet"; relpath = '../'; </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 class="nav_wrap"> <iframe id="nav" src="../class_list.html?1"></iframe> <div id="resizer"></div> </div> <div id="main" tabindex="-1"> <div id="header"> <div id="menu"> <a href="../_index.html">Index (E)</a> » <span class='title'><span class='object_link'><a href="../Yk.html" title="Yk (module)">Yk</a></span></span> » <span class="title">ESet</span> </div> <div id="search"> <a class="full_list_link" id="class_list_link" href="../class_list.html"> <svg width="24" height="24"> <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect> <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect> <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect> </svg> </a> </div> <div class="clear"></div> </div> <div id="content"><h1>Class: Yk::ESet </h1> <div class="box_info"> <dl> <dt>Inherits:</dt> <dd> <span class="inheritName">Object</span> <ul class="fullTree"> <li>Object</li> <li class="next">Yk::ESet</li> </ul> <a href="#" class="inheritanceTree">show all</a> </dd> </dl> <dl> <dt>Defined in:</dt> <dd>for_yard_product.rb</dd> </dl> </div> <h2>Overview</h2><div class="docstring"> <div class="discussion"> <p>ESets are containers with external iterators that store unique elements following a specific order. For use, require 'Yk/ESet';include Yk;</p> </div> </div> <div class="tags"> </div><h2>Defined Under Namespace</h2> <p class="children"> <strong class="classes">Classes:</strong> <span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">Iterator</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="#find-class_method" title="find (class method)">.<strong>find</strong>(first, last, obj = nil) {|obj| ... } ⇒ ESet::Iterator </a> </span> <span class="summary_desc"><div class='inline'> <p>Searches the container for an element with an object equivalent to the third argument and/or validated with the provided block in a range of elements ([first,last)), 'obj' and returns an iterator to it if found, otherwise it returns an iterator to .</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#for_each-class_method" title="for_each (class method)">.<strong>for_each</strong>(first, last) {|obj| ... } ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'> <p>Applies given block to each of the elements in the range [first,last).</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="#begin-instance_method" title="#begin (instance method)">#<strong>begin</strong> ⇒ ESet::Iterator </a> </span> <span class="summary_desc"><div class='inline'> <p>Return iterator to beginning.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#clear-instance_method" title="#clear (instance method)">#<strong>clear</strong> ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'> <p>Clear content.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#end-instance_method" title="#end (instance method)">#<strong>end</strong> ⇒ ESet::Iterator </a> </span> <span class="summary_desc"><div class='inline'> <p>Return iterator to end.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#erase-instance_method" title="#erase (instance method)">#<strong>erase</strong>(first, last) ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'> <p>Removes from the set container a range of elements ([first,last)).</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> {|obj| ... } ⇒ ESet </a> </span> <span class="note title constructor">constructor</span> <span class="summary_desc"><div class='inline'> <p>initlialize with a block which returns comparing basis like Enumerable::sort_by, however using <, not <=>.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#insert-instance_method" title="#insert (instance method)">#<strong>insert</strong>(*args) ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'></div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#lower_bound-instance_method" title="#lower_bound (instance method)">#<strong>lower_bound</strong> ⇒ ESet::Iterator </a> </span> <span class="summary_desc"><div class='inline'> <p>Return iterator to lower bound.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#size-instance_method" title="#size (instance method)">#<strong>size</strong> ⇒ Integer </a> </span> <span class="summary_desc"><div class='inline'> <p>Return container size.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#upper_bound-instance_method" title="#upper_bound (instance method)">#<strong>upper_bound</strong> ⇒ ESet::Iterator </a> </span> <span class="summary_desc"><div class='inline'> <p>Return iterator to upper bound.</p> </div></span> </li> </ul> <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"> #<strong>initialize</strong> {|obj| ... } ⇒ <tt><span class='object_link'><a href="" title="Yk::ESet (class)">ESet</a></span></tt> </h3><div class="docstring"> <div class="discussion"> <p>initlialize with a block which returns comparing basis like Enumerable::sort_by, however using <, not <=>.</p> </div> </div> <div class="tags"> <p class="tag_title">Yield Parameters:</p> <ul class="yieldparam"> <li> <span class='name'>obj</span> <span class='type'>(<tt>Object</tt>)</span> — <div class='inline'> <p>object pointed by an element.</p> </div> </li> </ul> <p class="tag_title">Yield Returns:</p> <ul class="yieldreturn"> <li> <span class='type'>(<tt>Object</tt>)</span> — <div class='inline'> <p>should be comparable with method, '<'.</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 8 9</pre> </td> <td> <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 8</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</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="find-class_method"> .<strong>find</strong>(first, last, obj = nil) {|obj| ... } ⇒ <tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt> </h3><div class="docstring"> <div class="discussion"> <p>Searches the container for an element with an object equivalent to the third argument and/or validated with the provided block in a range of elements ([first,last)), 'obj' and returns an iterator to it if found, otherwise it returns an iterator to .</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>first</span> <span class='type'>(<tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt>)</span> — <div class='inline'> <p>first iterator.</p> </div> </li> <li> <span class='name'>last</span> <span class='type'>(<tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt>)</span> — <div class='inline'> <p>last iterator.</p> </div> </li> <li> <span class='name'>obj</span> <span class='type'></span> <em class="default">(defaults to: <tt>nil</tt>)</em> — <div class='inline'> <p>Object to search equivalency.</p> </div> </li> </ul> <p class="tag_title">Yield Parameters:</p> <ul class="yieldparam"> <li> <span class='name'>obj</span> <span class='type'>(<tt>Object</tt>)</span> — <div class='inline'> <p>object argument pointed by an element passed for validation with the block</p> </div> </li> </ul> <p class="tag_title">Yield Returns:</p> <ul class="yieldreturn"> <li> <span class='type'>(<tt>Object</tt>)</span> — <div class='inline'> <p>validation result from the block</p> </div> </li> </ul> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt>)</span> — <div class='inline'> <p>iterator pointing the element with equivalent object.</p> </div> </li> </ul> <p class="tag_title">Raises:</p> <ul class="raise"> <li> <span class='type'></span> <div class='inline'> <p>ArgumentError raised when an argument is not a compatible iterator.</p> </div> </li> <li> <span class='type'></span> <div class='inline'> <p>ArgumentError raised when first and last iterators are not from the same container.</p> </div> </li> <li> <span class='type'></span> <div class='inline'> <p>ArgumentError raised when neither parameter, obj nor block is provided.</p> </div> </li> <li> <span class='type'></span> <div class='inline'> <p>RangeError raised when dereferencing end iterator</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 59 60</pre> </td> <td> <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 59</span> <span class='kw'>def</span> <span class='const'><span class='object_link'><a href="" title="Yk::ESet (class)">ESet</a></span></span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='id identifier rubyid_first'>first</span><span class='comma'>,</span> <span class='id identifier rubyid_last'>last</span><span class='comma'>,</span> <span class='id identifier rubyid_obj'>obj</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="for_each-class_method"> .<strong>for_each</strong>(first, last) {|obj| ... } ⇒ <tt>Object</tt> </h3><div class="docstring"> <div class="discussion"> <p>Applies given block to each of the elements in the range [first,last).</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>first</span> <span class='type'>(<tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt>)</span> — <div class='inline'> <p>first iterator.</p> </div> </li> <li> <span class='name'>last</span> <span class='type'>(<tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt>)</span> — <div class='inline'> <p>last iterator.</p> </div> </li> </ul> <p class="tag_title">Yield Parameters:</p> <ul class="yieldparam"> <li> <span class='name'>obj</span> <span class='type'>(<tt>Object</tt>)</span> — <div class='inline'> <p>object in an element</p> </div> </li> </ul> <p class="tag_title">Raises:</p> <ul class="raise"> <li> <span class='type'></span> <div class='inline'> <p>ArgumentError raised when an argument is not a compatible iterator.</p> </div> </li> <li> <span class='type'></span> <div class='inline'> <p>ArgumentError raised when first and last iterators are not from the same container.</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 67 68</pre> </td> <td> <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 67</span> <span class='kw'>def</span> <span class='const'><span class='object_link'><a href="" title="Yk::ESet (class)">ESet</a></span></span><span class='period'>.</span><span class='id identifier rubyid_for_each'>for_each</span> <span class='id identifier rubyid_first'>first</span><span class='comma'>,</span> <span class='id identifier rubyid_last'>last</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="begin-instance_method"> #<strong>begin</strong> ⇒ <tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt> </h3><div class="docstring"> <div class="discussion"> <p>Return iterator to beginning</p> </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt>)</span> — <div class='inline'> <p>Return iterator to beginning</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 11 12</pre> </td> <td> <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 11</span> <span class='kw'>def</span> <span class='kw'>begin</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="clear-instance_method"> #<strong>clear</strong> ⇒ <tt>Object</tt> </h3><div class="docstring"> <div class="discussion"> <p>Clear content</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 20 21</pre> </td> <td> <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 20</span> <span class='kw'>def</span> <span class='id identifier rubyid_clear'>clear</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="end-instance_method"> #<strong>end</strong> ⇒ <tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt> </h3><div class="docstring"> <div class="discussion"> <p>Return iterator to end</p> </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt>)</span> — <div class='inline'> <p>Return iterator to end</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 14 15</pre> </td> <td> <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 14</span> <span class='kw'>def</span> <span class='kw'>end</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="erase-instance_method"> #<strong>erase</strong>(first, last) ⇒ <tt>Object</tt> </h3><div class="docstring"> <div class="discussion"> <p>Removes from the set container a range of elements ([first,last)). Iterators specifying a range within the set container to be removed: [first,last). i.e., the range includes all the elements between first and last, including the element pointed by first but not the one pointed by last.</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>first</span> <span class='type'>(<tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt>)</span> — <div class='inline'> <p>first iterator.</p> </div> </li> <li> <span class='name'>last</span> <span class='type'>(<tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt>)</span> — <div class='inline'> <p>last iterator.</p> </div> </li> </ul> <p class="tag_title">Raises:</p> <ul class="raise"> <li> <span class='type'></span> <div class='inline'> <p>ArgumentError raised when an argument is not a compatible iterator.</p> </div> </li> <li> <span class='type'></span> <div class='inline'> <p>ArgumentError raised when first and last iterators are not from the same container.</p> </div> </li> <li> <span class='type'></span> <div class='inline'> <p>RangeError raised when erasing end iterator</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 46 47</pre> </td> <td> <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 46</span> <span class='kw'>def</span> <span class='id identifier rubyid_erase'>erase</span> <span class='id identifier rubyid_first'>first</span><span class='comma'>,</span> <span class='id identifier rubyid_last'>last</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="insert-instance_method"> <span class="overload">#<strong>insert</strong>(position, obj) ⇒ <tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt> </span> <span class="overload">#<strong>insert</strong>(obj) ⇒ <tt>Array</tt> </span> </h3><div class="docstring"> <div class="discussion"> </div> </div> <div class="tags"> <p class="tag_title">Overloads:</p> <ul class="overload"> <li class="overload_item"> <span class="signature">#<strong>insert</strong>(position, obj) ⇒ <tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt> </span> <div class="docstring"> <div class="discussion"> <p>Insert element with an object using a hint</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>position</span> <span class='type'>(<tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt>)</span> — <div class='inline'> <p>Hint for the position where the element can be inserted.</p> </div> </li> <li> <span class='name'>obj</span> <span class='type'>(<tt>Object</tt>)</span> — <div class='inline'> <p>Object to be pointed by the inserted elements.</p> </div> </li> </ul> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt>)</span> — <div class='inline'> <p>An iterator pointing to either the newly inserted element or to the element that already had its equivalent in the container.</p> </div> </li> </ul> </div> </li> <li class="overload_item"> <span class="signature">#<strong>insert</strong>(obj) ⇒ <tt>Array</tt> </span> <div class="docstring"> <div class="discussion"> <p>Insert element with an object</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>obj</span> <span class='type'>(<tt>Object</tt>)</span> — <div class='inline'> <p>key object to be pointed by the inserted elements.</p> </div> </li> </ul> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>Array</tt>)</span> — <div class='inline'> <p>An array, with its first member set to an iterator pointing to either the newly inserted element or to the equivalent element already in the set. The second member in the array is set to true if a new element was inserted or false if an equivalent element already existed.</p> </div> </li> </ul> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 37 38</pre> </td> <td> <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 37</span> <span class='kw'>def</span> <span class='id identifier rubyid_insert'>insert</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="lower_bound-instance_method"> #<strong>lower_bound</strong> ⇒ <tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt> </h3><div class="docstring"> <div class="discussion"> <p>Return iterator to lower bound</p> </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt>)</span> — <div class='inline'> <p>Return iterator to lower bound</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 26 27</pre> </td> <td> <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 26</span> <span class='kw'>def</span> <span class='id identifier rubyid_lower_bound'>lower_bound</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="size-instance_method"> #<strong>size</strong> ⇒ <tt>Integer</tt> </h3><div class="docstring"> <div class="discussion"> <p>Return container size</p> </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>Integer</tt>)</span> — <div class='inline'> <p>Return container size</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 17 18</pre> </td> <td> <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 17</span> <span class='kw'>def</span> <span class='id identifier rubyid_size'>size</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="upper_bound-instance_method"> #<strong>upper_bound</strong> ⇒ <tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt> </h3><div class="docstring"> <div class="discussion"> <p>Return iterator to upper bound</p> </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt><span class='object_link'><a href="ESet/Iterator.html" title="Yk::ESet::Iterator (class)">ESet::Iterator</a></span></tt>)</span> — <div class='inline'> <p>Return iterator to upper bound</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 23 24</pre> </td> <td> <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 23</span> <span class='kw'>def</span> <span class='id identifier rubyid_upper_bound'>upper_bound</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> </div> </div> <div id="footer"> Generated on Thu Feb 20 23:01:22 2020 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> 0.9.24 (ruby-2.7.0). </div> </div> </body> </html>