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 <=>.
111 112 |
# File 'for_yard_product.rb', line 111 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 .
162 163 |
# File 'for_yard_product.rb', line 162 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).
170 171 |
# File 'for_yard_product.rb', line 170 def EMSet.for_each first, last end |
Instance Method Details
#begin ⇒ EMSet::Iterator
Return iterator to beginning
114 115 |
# File 'for_yard_product.rb', line 114 def begin end |
#clear ⇒ Object
Clear content
123 124 |
# File 'for_yard_product.rb', line 123 def clear end |
#end ⇒ EMSet::Iterator
Return iterator to end
117 118 |
# File 'for_yard_product.rb', line 117 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.
149 150 |
# File 'for_yard_product.rb', line 149 def erase first, last end |
#insert(position, obj) ⇒ EMSet::Iterator #insert(obj) ⇒ EMSet::Iterator
140 141 |
# File 'for_yard_product.rb', line 140 def insert *args end |
#lower_bound ⇒ EMSet::Iterator
Return iterator to lower bound
129 130 |
# File 'for_yard_product.rb', line 129 def lower_bound end |
#size ⇒ Integer
Return container size
120 121 |
# File 'for_yard_product.rb', line 120 def size end |
#upper_bound ⇒ EMSet::Iterator
Return iterator to upper bound
126 127 |
# File 'for_yard_product.rb', line 126 def upper_bound end |