Class: Yk::EMap
- Inherits:
-
Object
- Object
- Yk::EMap
- Defined in:
- for_yard_product.rb
Overview
EMaps are associative containers with external iterators that store elements formed by a combination of a key and a value, following a specific order. For use, require 'Yk/ESet';include Yk;
Defined Under Namespace
Classes: Iterator
Class Method Summary collapse
-
.find(first, last, obj = nil) {|obj| ... } ⇒ EMap::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 ⇒ EMap::Iterator
Return iterator to beginning.
-
#clear ⇒ Object
Clear content.
-
#end ⇒ EMap::Iterator
Return iterator to end.
-
#erase(first, last) ⇒ Object
Removes from the set container a range of elements ([first,last)).
-
#initialize {|key| ... } ⇒ EMap
constructor
initlialize with a block which returns comparing basis like Enumerable::sort_by, however using <, not <=>.
- #insert(*args) ⇒ Object
- #insert_or_assign(*args) ⇒ Object
-
#lower_bound ⇒ EMap::Iterator
Return iterator to lower bound.
-
#size ⇒ Integer
Return container size.
-
#upper_bound ⇒ EMap::Iterator
Return iterator to upper bound.
Constructor Details
#initialize {|key| ... } ⇒ EMap
initlialize with a block which returns comparing basis like Enumerable::sort_by, however using <, not <=>.
196 197 |
# File 'for_yard_product.rb', line 196 def initialize end |
Class Method Details
.find(first, last, obj = nil) {|obj| ... } ⇒ EMap::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 .
262 263 |
# File 'for_yard_product.rb', line 262 def EMap.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).
270 271 |
# File 'for_yard_product.rb', line 270 def EMap.for_each first, last end |
Instance Method Details
#begin ⇒ EMap::Iterator
Return iterator to beginning
199 200 |
# File 'for_yard_product.rb', line 199 def begin end |
#clear ⇒ Object
Clear content
208 209 |
# File 'for_yard_product.rb', line 208 def clear end |
#end ⇒ EMap::Iterator
Return iterator to end
202 203 |
# File 'for_yard_product.rb', line 202 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.
249 250 |
# File 'for_yard_product.rb', line 249 def erase first, last end |
#insert(position, key, value) ⇒ EMap::Iterator #insert(key, value) ⇒ Array
227 228 |
# File 'for_yard_product.rb', line 227 def insert *args end |
#insert_or_assign(k, v) ⇒ Array #insert_or_assign(position, k, v) ⇒ EMap::Iterator
240 241 |
# File 'for_yard_product.rb', line 240 def insert_or_assign *args end |
#lower_bound ⇒ EMap::Iterator
Return iterator to lower bound
214 215 |
# File 'for_yard_product.rb', line 214 def lower_bound end |
#size ⇒ Integer
Return container size
205 206 |
# File 'for_yard_product.rb', line 205 def size end |
#upper_bound ⇒ EMap::Iterator
Return iterator to upper bound
211 212 |
# File 'for_yard_product.rb', line 211 def upper_bound end |