Class: Axiom::Algebra::Difference
- Includes:
- Relation::Operation::Set
- Defined in:
- lib/axiom/algebra/difference.rb
Overview
The difference 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) ⇒ Difference
Delete a relation from the Difference.
-
#each {|tuple| ... } ⇒ self
Iterate over each tuple in the set.
-
#insert(other) ⇒ Difference
Insert a relation into the Difference.
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) ⇒ Difference
Delete a relation from the Difference
Remove the relation from the left operand, and add it to the right operand so that it is removed by the difference operation.
60 61 62 |
# File 'lib/axiom/algebra/difference.rb', line 60 def delete(other) left.delete(coerce(other).difference(right)).difference(right) end |
#each {|tuple| ... } ⇒ self
Iterate over each tuple in the set
24 25 26 27 28 |
# File 'lib/axiom/algebra/difference.rb', line 24 def each return to_enum unless block_given? left.each { |tuple| yield tuple unless right.include?(tuple) } self end |
#insert(other) ⇒ Difference
Insert a relation into the Difference
Add the relation to the left operand, and remove from the right operand so that it not removed by the difference operation.
43 44 45 |
# File 'lib/axiom/algebra/difference.rb', line 43 def insert(other) left.insert(coerce(other).difference(right)).difference(right) end |