Class: Yk::ESet
- Inherits:
-
Object
- Object
- Yk::ESet
- Defined in:
- for_yard_product.rb
Overview
ESets are containers with external iterators that store unique elements 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| ... } ⇒ ESet::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 ⇒ ESet::Iterator
Return iterator to beginning.
-
#clear ⇒ Object
Clear content.
-
#end ⇒ ESet::Iterator
Return iterator to end.
-
#erase(first, last) ⇒ Object
Removes from the set container a range of elements ([first,last)).
-
#initialize {|obj| ... } ⇒ ESet
constructor
initlialize with a block which returns comparing basis like Enumerable::sort_by, however using <, not <=>.
- #insert(*args) ⇒ Object
-
#lower_bound ⇒ ESet::Iterator
Return iterator to lower bound.
-
#size ⇒ Integer
Return container size.
-
#upper_bound ⇒ ESet::Iterator
Return iterator to upper bound.
Constructor Details
#initialize {|obj| ... } ⇒ ESet
initlialize with a block which returns comparing basis like Enumerable::sort_by, however using <, not <=>.
8 9 |
# File 'for_yard_product.rb', line 8 def initialize end |
Class Method Details
.find(first, last, obj = nil) {|obj| ... } ⇒ ESet::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 .
59 60 |
# File 'for_yard_product.rb', line 59 def ESet.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).
67 68 |
# File 'for_yard_product.rb', line 67 def ESet.for_each first, last end |
Instance Method Details
#begin ⇒ ESet::Iterator
Return iterator to beginning
11 12 |
# File 'for_yard_product.rb', line 11 def begin end |
#clear ⇒ Object
Clear content
20 21 |
# File 'for_yard_product.rb', line 20 def clear end |
#end ⇒ ESet::Iterator
Return iterator to end
14 15 |
# File 'for_yard_product.rb', line 14 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.
46 47 |
# File 'for_yard_product.rb', line 46 def erase first, last end |
#insert(position, obj) ⇒ ESet::Iterator #insert(obj) ⇒ Array
37 38 |
# File 'for_yard_product.rb', line 37 def insert *args end |
#lower_bound ⇒ ESet::Iterator
Return iterator to lower bound
26 27 |
# File 'for_yard_product.rb', line 26 def lower_bound end |
#size ⇒ Integer
Return container size
17 18 |
# File 'for_yard_product.rb', line 17 def size end |
#upper_bound ⇒ ESet::Iterator
Return iterator to upper bound
23 24 |
# File 'for_yard_product.rb', line 23 def upper_bound end |