Class: Locomotive::RelationalAlgebra::EquiJoin
- Inherits:
-
Join
- Object
- RelAlgAstNode
- Operator
- Binary
- Join
- Locomotive::RelationalAlgebra::EquiJoin
- Defined in:
- lib/locomotive/relational_algebra/operators/join/equi_join.rb
Instance Attribute Summary collapse
-
#item1 ⇒ Object
Returns the value of attribute item1.
-
#item2 ⇒ Object
Returns the value of attribute item2.
Attributes inherited from Operator
Attributes included from AstHelpers::AstNode
#kind, #left_child, #owner, #right_child, #value
Instance Method Summary collapse
- #clone ⇒ Object
-
#initialize(op1, op2, it1, it2) ⇒ EquiJoin
constructor
A new instance of EquiJoin.
- #left_and_right(op1, op2) ⇒ Object
- #set(var, plan) ⇒ Object
- #xml_content ⇒ Object
- #xml_kind ⇒ Object
Methods inherited from Operator
#bound, #free, #to_xml, #xml_schema
Methods included from XML
Methods included from AstHelpers::Annotations
Methods included from AstHelpers::AstNode
#has_left_child?, #has_right_child?, #is_leaf?, #traverse, #traverse_strategy=
Constructor Details
#initialize(op1, op2, it1, it2) ⇒ EquiJoin
Returns a new instance of EquiJoin.
12 13 14 15 16 |
# File 'lib/locomotive/relational_algebra/operators/join/equi_join.rb', line 12 def initialize(op1,op2,it1,it2) self.item1, self.item2 = it1, it2 super(op1,op2) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Locomotive::AstHelpers::Annotations
Instance Attribute Details
#item1 ⇒ Object
Returns the value of attribute item1.
6 7 8 |
# File 'lib/locomotive/relational_algebra/operators/join/equi_join.rb', line 6 def item1 @item1 end |
#item2 ⇒ Object
Returns the value of attribute item2.
8 9 10 |
# File 'lib/locomotive/relational_algebra/operators/join/equi_join.rb', line 8 def item2 @item2 end |
Instance Method Details
#clone ⇒ Object
45 46 47 48 |
# File 'lib/locomotive/relational_algebra/operators/join/equi_join.rb', line 45 def clone EquiJoin.new(left.clone,right.clone, item1.clone, item2.clone) end |
#left_and_right(op1, op2) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/locomotive/relational_algebra/operators/join/equi_join.rb', line 18 def left_and_right(op1,op2) unless op1.schema.attributes?([self.item1]) raise CorruptedSchema, "Schema #{op1.schema.attributes} does not " \ "contain all attributes of #{item1}." end unless op2.schema.attributes?([self.item2]) raise CorruptedSchema, "Schema #{op2.schema.attributes} does not " \ "contain all attributes of #{item2}." end self.schema = op1.schema + op2.schema super(op1,op2) end |
#set(var, plan) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/locomotive/relational_algebra/operators/join/equi_join.rb', line 50 def set(var,plan) EquiJoin.new( left.set(var,plan), right.set(var,plan), item1.clone, item2.clone) end |
#xml_content ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/locomotive/relational_algebra/operators/join/equi_join.rb', line 37 def xml_content content do [column(:name => item1.to_xml, :new => false, :position => 1), column(:name => item2.to_xml, :new => false, :position => 2) ].join end end |
#xml_kind ⇒ Object
33 34 35 |
# File 'lib/locomotive/relational_algebra/operators/join/equi_join.rb', line 33 def xml_kind :eqjoin end |