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 <=>.
206 207 |
# File 'for_yard_product.rb', line 206 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 .
272 273 |
# File 'for_yard_product.rb', line 272 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).
280 281 |
# File 'for_yard_product.rb', line 280 def EMap.for_each first, last end |
Instance Method Details
#begin ⇒ EMap::Iterator
Return iterator to beginning
209 210 |
# File 'for_yard_product.rb', line 209 def begin end |
#clear ⇒ Object
Clear content
218 219 |
# File 'for_yard_product.rb', line 218 def clear end |
#end ⇒ EMap::Iterator
Return iterator to end
212 213 |
# File 'for_yard_product.rb', line 212 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.
259 260 |
# File 'for_yard_product.rb', line 259 def erase first, last end |
#insert(position, key, value) ⇒ EMap::Iterator #insert(key, value) ⇒ Array
237 238 |
# File 'for_yard_product.rb', line 237 def insert *args end |
#insert_or_assign(k, v) ⇒ Array #insert_or_assign(position, k, v) ⇒ EMap::Iterator
250 251 |
# File 'for_yard_product.rb', line 250 def insert_or_assign *args end |
#lower_bound ⇒ EMap::Iterator
Return iterator to lower bound
224 225 |
# File 'for_yard_product.rb', line 224 def lower_bound end |
#size ⇒ Integer
Return container size
215 216 |
# File 'for_yard_product.rb', line 215 def size end |
#upper_bound ⇒ EMap::Iterator
Return iterator to upper bound
221 222 |
# File 'for_yard_product.rb', line 221 def upper_bound end |