Class: Locomotive::RelationalAlgebra::Project
- Inherits:
-
Unary
- Object
- RelAlgAstNode
- Operator
- Unary
- Locomotive::RelationalAlgebra::Project
- Defined in:
- lib/locomotive/relational_algebra/operators/projections/projection.rb
Instance Attribute Summary
Attributes inherited from Operator
Attributes included from AstHelpers::AstNode
#kind, #left_child, #owner, #right_child, #value
Instance Method Summary collapse
- #child=(op) ⇒ Object
- #clone ⇒ Object
-
#initialize(op, proj_list) ⇒ Project
constructor
A new instance of Project.
- #set(var, plan) ⇒ Object
- #xml_content ⇒ Object
Methods inherited from Operator
#bound, #free, #to_xml, #xml_kind, #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(op, proj_list) ⇒ Project
Returns a new instance of Project.
68 69 70 71 |
# File 'lib/locomotive/relational_algebra/operators/projections/projection.rb', line 68 def initialize(op, proj_list) @proj_list = to_project_list proj_list super(op) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Locomotive::AstHelpers::Annotations
Instance Method Details
#child=(op) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/locomotive/relational_algebra/operators/projections/projection.rb', line 73 def child=(op) unless op.schema.attributes?(proj_list.old_items) raise CorruptedSchema, "Schema #{op.schema.attributes} does not " \ "contain all attributes of #{proj_list.old_items}." end proj_list.old_items.each do |old| proj_list[old].each do |new| schema[new] = op.schema[old] end end super(op) end |
#clone ⇒ Object
93 94 95 |
# File 'lib/locomotive/relational_algebra/operators/projections/projection.rb', line 93 def clone Project.new(child.clone, proj_list.clone) end |
#set(var, plan) ⇒ Object
97 98 99 100 101 |
# File 'lib/locomotive/relational_algebra/operators/projections/projection.rb', line 97 def set(var,plan) Project.new( child.set(var,plan), proj_list.clone) end |
#xml_content ⇒ Object
87 88 89 90 91 |
# File 'lib/locomotive/relational_algebra/operators/projections/projection.rb', line 87 def xml_content content do proj_list.to_xml end end |