Class: Yk::EMSet
- Inherits:
-
Object
- Object
- Yk::EMSet
- Defined in:
- for_yard_product.rb
Overview
EMSets are containers with external iterators that store elements following a specific order, and where multiple elements can have equivalent values. For use, require 'Yk/ESet';include Yk;
Defined Under Namespace
Classes: Iterator
Class Method Summary collapse
-
.find(first, last, obj = nil) {|obj| ... } ⇒ EMSet::Iterator
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 .
-
.for_each(first, last) {|obj| ... } ⇒ Object
Applies given block to each of the elements in the range [first,last).
Instance Method Summary collapse
-
#begin ⇒ EMSet::Iterator
Return iterator to beginning.
-
#clear ⇒ Object
Clear content.
-
#end ⇒ EMSet::Iterator
Return iterator to end.
-
#erase(first, last) ⇒ Object
Removes from the set container a range of elements ([first,last)).
-
#initialize {|obj| ... } ⇒ EMSet
constructor
initlialize with a block which returns comparing basis like Enumerable::sort_by, however using <, not <=>.
- #insert(*args) ⇒ Object
-
#lower_bound ⇒ EMSet::Iterator
Return iterator to lower bound.
-
#size ⇒ Integer
Return container size.
-
#upper_bound ⇒ EMSet::Iterator
Return iterator to upper bound.
Constructor Details
#initialize {|obj| ... } ⇒ EMSet
initlialize with a block which returns comparing basis like Enumerable::sort_by, however using <, not <=>.
107 108 |
# File 'for_yard_product.rb', line 107 def initialize end |
Class Method Details
.find(first, last, obj = nil) {|obj| ... } ⇒ EMSet::Iterator
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 .
158 159 |
# File 'for_yard_product.rb', line 158 def EMSet.find first, last, obj = nil end |
.for_each(first, last) {|obj| ... } ⇒ Object
Applies given block to each of the elements in the range [first,last).
166 167 |
# File 'for_yard_product.rb', line 166 def EMSet.for_each first, last end |
Instance Method Details
#begin ⇒ EMSet::Iterator
Return iterator to beginning
110 111 |
# File 'for_yard_product.rb', line 110 def begin end |
#clear ⇒ Object
Clear content
119 120 |
# File 'for_yard_product.rb', line 119 def clear end |
#end ⇒ EMSet::Iterator
Return iterator to end
113 114 |
# File 'for_yard_product.rb', line 113 def end end |
#erase(first, last) ⇒ Object
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.
145 146 |
# File 'for_yard_product.rb', line 145 def erase first, last end |
#insert(position, obj) ⇒ EMSet::Iterator #insert(obj) ⇒ EMSet::Iterator
136 137 |
# File 'for_yard_product.rb', line 136 def insert *args end |
#lower_bound ⇒ EMSet::Iterator
Return iterator to lower bound
125 126 |
# File 'for_yard_product.rb', line 125 def lower_bound end |
#size ⇒ Integer
Return container size
116 117 |
# File 'for_yard_product.rb', line 116 def size end |
#upper_bound ⇒ EMSet::Iterator
Return iterator to upper bound
122 123 |
# File 'for_yard_product.rb', line 122 def upper_bound end |