Class: Alf::Algebra::Group

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

Instance Attribute Summary

Attributes included from Operator

#operands

Instance Method Summary collapse

Methods included from Unary

included, #operand, #with_operand

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


14
15
16
17
18
19
# File 'lib/alf/algebra/operator/group.rb', line 14

def heading
  @heading ||= begin
    keep, sub = operand.heading.split(attributes, !allbut)
    keep.merge(as => Relation[sub])
  end
end

#keysObject


21
22
23
24
25
26
# File 'lib/alf/algebra/operator/group.rb', line 21

def keys
  @keys ||= operand.keys.map{|k|
    proj = k.project(attributes, !allbut)
    proj.empty? ? AttrList[as] : proj
  }.freeze
end