Class: Alf::Algebra::Intersect

Inherits:
Object
  • Object
show all
Includes:
Binary, Operator, Relational
Defined in:
lib/alf-algebra/alf/algebra/operator/intersect.rb

Instance Attribute Summary

Attributes included from Operator

#operands

Attributes included from Support::Bindable

#connection

Instance Method Summary collapse

Methods included from Operator

#==, #bind, #dup, included, #initialize, #signature, #to_lispy, #to_relvar, #with_operands

Methods included from Support::Registry

decode_registered, #each, #listen, #listeners, #register, #registered

Methods included from Operand

#attr_list, coerce, #to_cog, #to_dot, #to_relation

Methods included from Support::Bindable

#bind, #bound?, #connection!

Methods included from Relational

included

Methods included from Binary

#common_attributes, #common_heading, included, #left, #right, #with_left, #with_right

Instance Method Details

#headingObject



9
10
11
# File 'lib/alf-algebra/alf/algebra/operator/intersect.rb', line 9

def heading
  @heading ||= left.heading + right.heading
end

#keysObject



13
14
15
16
17
18
19
20
# File 'lib/alf-algebra/alf/algebra/operator/intersect.rb', line 13

def keys
  @keys ||= begin
    k1s, k2s = left.keys, right.keys
    k2s = k2s.reject{|k| k1s.any?{|l| k.superset?(l) } }
    k1s = k1s.reject{|k| k2s.any?{|l| k.superset?(l) } }
    k1s + k2s
  end
end