Class: Locomotive::RelationalAlgebra::Operator
- Inherits:
-
RelAlgAstNode
- Object
- RelAlgAstNode
- Locomotive::RelationalAlgebra::Operator
- Includes:
- XML
- Defined in:
- lib/locomotive/relational_algebra/operators/basic_operators.rb
Overview
represents a variant operator of the relational algebra
Instance Attribute Summary collapse
-
#schema ⇒ Object
Returns the value of attribute schema.
Attributes included from AstHelpers::AstNode
#kind, #left_child, #owner, #right_child, #value
Instance Method Summary collapse
-
#bound ⇒ Object
returns all bound variables in this plan.
-
#free ⇒ Object
returns all free variables in this plan.
-
#initialize ⇒ Operator
constructor
A new instance of Operator.
- #to_xml ⇒ Object
- #xml_content ⇒ Object
- #xml_kind ⇒ Object
- #xml_schema ⇒ Object
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 ⇒ Operator
Returns a new instance of Operator.
14 15 16 17 18 |
# File 'lib/locomotive/relational_algebra/operators/basic_operators.rb', line 14 def initialize raise AbstractClassError, "#{self.class} is an abstract class" if self.class == Operator self.schema = Schema.new({}) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Locomotive::AstHelpers::Annotations
Instance Attribute Details
#schema ⇒ Object
Returns the value of attribute schema.
11 12 13 |
# File 'lib/locomotive/relational_algebra/operators/basic_operators.rb', line 11 def schema @schema end |
Instance Method Details
#bound ⇒ Object
returns all bound variables in this plan
56 57 58 59 60 61 62 63 |
# File 'lib/locomotive/relational_algebra/operators/basic_operators.rb', line 56 def bound # attention: for convenience we use # the underlying ast framework bv = [] bv += left_child.bound if has_left_child? bv += right_child.bound if has_right_child? bv end |
#free ⇒ Object
returns all free variables in this plan
46 47 48 49 50 51 52 53 |
# File 'lib/locomotive/relational_algebra/operators/basic_operators.rb', line 46 def free # attention: for convenience we use # the underlying ast framework fv = [] fv += left_child.free if has_left_child? fv += right_child.free if has_right_child? fv end |
#to_xml ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/locomotive/relational_algebra/operators/basic_operators.rb', line 32 def to_xml cont_list = [ xml_schema, xml_content ] cont_list << edge(:to => left_child.ann_xml_id) if has_left_child? and left_child.respond_to? :ann_xml_id cont_list << edge(:to => right_child.ann_xml_id) if has_right_child? and right_child.respond_to? :ann_xml_id node :id => ann_xml_id, :kind => xml_kind do cont_list.join end end |
#xml_content ⇒ Object
24 25 26 |
# File 'lib/locomotive/relational_algebra/operators/basic_operators.rb', line 24 def xml_content content() end |
#xml_kind ⇒ Object
28 29 30 |
# File 'lib/locomotive/relational_algebra/operators/basic_operators.rb', line 28 def xml_kind self.class.to_s.split("::").last.downcase.to_sym end |
#xml_schema ⇒ Object
20 21 22 |
# File 'lib/locomotive/relational_algebra/operators/basic_operators.rb', line 20 def xml_schema self.schema.to_xml end |