Class: Locomotive::RelationalAlgebra::Function
- Inherits:
-
Unary
- Object
- RelAlgAstNode
- Operator
- Unary
- Locomotive::RelationalAlgebra::Function
- Defined in:
- lib/locomotive/relational_algebra/operators/builtins/function.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
Returns the value of attribute items.
-
#operator ⇒ Object
Returns the value of attribute operator.
-
#res ⇒ Object
Returns the value of attribute res.
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, operator, res, items) ⇒ Function
constructor
A new instance of Function.
- #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(op, operator, res, items) ⇒ Function
Returns a new instance of Function.
16 17 18 19 20 21 |
# File 'lib/locomotive/relational_algebra/operators/builtins/function.rb', line 16 def initialize(op, operator, res, items) self.operator, self.res, self.items = operator, res, items super(op) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Locomotive::AstHelpers::Annotations
Instance Attribute Details
#items ⇒ Object
Returns the value of attribute items.
8 9 10 |
# File 'lib/locomotive/relational_algebra/operators/builtins/function.rb', line 8 def items @items end |
#operator ⇒ Object
Returns the value of attribute operator.
8 9 10 |
# File 'lib/locomotive/relational_algebra/operators/builtins/function.rb', line 8 def operator @operator end |
#res ⇒ Object
Returns the value of attribute res.
8 9 10 |
# File 'lib/locomotive/relational_algebra/operators/builtins/function.rb', line 8 def res @res end |
Instance Method Details
#child=(op) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/locomotive/relational_algebra/operators/builtins/function.rb', line 23 def child=(op) unless op.schema.attributes?(self.items) raise CorruptedSchema, "Schema #{op.schema.attributes} does not " \ "contain all attributes of #{items}." end self.schema = op.schema + Schema.new( { res => op.schema[items.first] } ) super(op) end |
#clone ⇒ Object
51 52 53 54 55 56 |
# File 'lib/locomotive/relational_algebra/operators/builtins/function.rb', line 51 def clone Function.new(child.clone, operator.clone, res.clone, items.clone) end |
#set(var, plan) ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/locomotive/relational_algebra/operators/builtins/function.rb', line 58 def set(var, plan) Function.new( child.set(var,plan), operator.clone, res.clone, items.clone) end |
#xml_content ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/locomotive/relational_algebra/operators/builtins/function.rb', line 39 def xml_content content do [ kind(:name => operator.to_xml), column(:name => res.to_xml, :new => true), items.collect do |it| column :name => it.to_xml, :new => false end.join ].join end end |
#xml_kind ⇒ Object
35 36 37 |
# File 'lib/locomotive/relational_algebra/operators/builtins/function.rb', line 35 def xml_kind :fun end |