Class: Axiom::Algebra::Product
- Includes:
- Relation::Operation::Combination
- Defined in:
- lib/axiom/algebra/product.rb
Overview
The cartesian product between relations
Defined Under Namespace
Modules: Methods
Instance Attribute Summary
Attributes included from Operation::Binary
Attributes inherited from Relation
Class Method Summary collapse
-
.new(left, right) ⇒ Join
Instantiate a new Product.
Instance Method Summary collapse
-
#delete ⇒ undefined
Raise an exception when deleting from the Product.
-
#each {|tuple| ... } ⇒ self
Iterate over each tuple in the set.
-
#insert ⇒ undefined
Raise an exception when inserting into the Product.
Methods included from Relation::Operation::Combination
Methods included from Relation::Operation::Binary
Methods included from Operation::Binary
Methods inherited from Relation
#==, #[], #directions, #empty?, #include?, #initialize, #materialize, #materialized?, #one, #replace
Methods included from Visitable
Class Method Details
.new(left, right) ⇒ Join
Instantiate a new Product
21 22 23 24 |
# File 'lib/axiom/algebra/product.rb', line 21 def self.new(left, right) assert_disjointed_headers(left, right) super end |
Instance Method Details
#delete ⇒ undefined
Raise an exception when deleting from the Product
94 95 96 |
# File 'lib/axiom/algebra/product.rb', line 94 def delete(*) raise ImmutableRelationError, 'deleting from a product is impossible' end |
#each {|tuple| ... } ⇒ self
Iterate over each tuple in the set
59 60 61 62 63 64 65 66 |
# File 'lib/axiom/algebra/product.rb', line 59 def each(&block) return to_enum unless block_given? util = Relation::Operation::Combination left.each do |left_tuple| util.combine_tuples(header, left_tuple, right, &block) end self end |
#insert ⇒ undefined
Raise an exception when inserting into the Product
79 80 81 |
# File 'lib/axiom/algebra/product.rb', line 79 def insert(*) raise ImmutableRelationError, 'inserting into a product is impossible' end |