Class: Axiom::Algebra::Intersection
- Includes:
- Relation::Operation::Set
- Defined in:
- lib/axiom/algebra/intersection.rb
Overview
The intersection between relations
Defined Under Namespace
Modules: Methods
Instance Attribute Summary
Attributes included from Operation::Binary
Attributes inherited from Relation
Instance Method Summary collapse
-
#delete(other) ⇒ Intersection
Delete a relation from the Intersection.
-
#each {|tuple| ... } ⇒ self
Iterate over each tuple in the set.
-
#insert(other) ⇒ Intersection
Insert a relation into the Intersection.
Methods included from Relation::Operation::Set
Methods included from Relation::Operation::Binary
Methods included from Operation::Binary
Methods inherited from Relation
#==, #[], #directions, #empty?, #include?, #initialize, #materialize, #materialized?, new, #replace
Methods included from Visitable
Instance Method Details
#delete(other) ⇒ Intersection
Delete a relation from the Intersection
54 55 56 |
# File 'lib/axiom/algebra/intersection.rb', line 54 def delete(other) left.delete(other).intersect(right.delete(other)) end |
#each {|tuple| ... } ⇒ self
Iterate over each tuple in the set
24 25 26 27 28 |
# File 'lib/axiom/algebra/intersection.rb', line 24 def each return to_enum unless block_given? left.each { |tuple| yield tuple if right.include?(tuple) } self end |
#insert(other) ⇒ Intersection
Insert a relation into the Intersection
40 41 42 |
# File 'lib/axiom/algebra/intersection.rb', line 40 def insert(other) left.insert(other).intersect(right.insert(other)) end |