class Axiom::Algebra::Intersection

The intersection between relations

Public Instance Methods

delete(other) click to toggle source

Delete a relation from the Intersection

@example

new_relation = intersection.delete(other)

@param [Relation] other

@return [Intersection]

@api public

# File lib/axiom/algebra/intersection.rb, line 54
def delete(other)
  left.delete(other).intersect(right.delete(other))
end
each() { |tuple| ... } click to toggle source

Iterate over each tuple in the set

@example

intersection = Intersection.new(left, right)
intersection.each { |tuple| ... }

@yield [tuple]

@yieldparam [Tuple] tuple

each tuple in the set

@return [self]

@api public

# 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) click to toggle source

Insert a relation into the Intersection

@example

new_relation = intersection.insert(other)

@param [Relation] other

@return [Intersection]

@api public

# File lib/axiom/algebra/intersection.rb, line 40
def insert(other)
  left.insert(other).intersect(right.insert(other))
end