Class: Alf::Algebra::Intersect

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

Instance Attribute Summary

Attributes included from Operator

#operands

Instance Method Summary collapse

Methods included from Binary

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

Methods included from Relational

included

Methods included from Support::Registry

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

Methods included from Operator

#==, #dup, #hash, included, #initialize, #signature, #to_cog, #to_lispy, #to_relvar, #to_s, #type_check, #with_operands

Methods included from TypeCheck

#joinable_headings!, #no_name_clash!, #same_heading!, #type_check_error!, #valid_ordering!

Methods included from Operand

#attr_list, coerce, #resulting_type, #to_ascii_tree, #to_cog, #to_relation, #type_check

Instance Method Details

#headingObject



11
12
13
# File 'lib/alf/algebra/operator/intersect.rb', line 11

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

#keysObject



15
16
17
18
19
20
21
22
# File 'lib/alf/algebra/operator/intersect.rb', line 15

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