Class: Locomotive::RelationalAlgebra::BinOp
- Inherits:
-
Unary
- Object
- RelAlgAstNode
- Operator
- Unary
- Locomotive::RelationalAlgebra::BinOp
- Defined in:
- lib/locomotive/relational_algebra/operators/boolean/basic_boolean.rb
Instance Attribute Summary collapse
-
#item1 ⇒ Object
Returns the value of attribute item1.
-
#item2 ⇒ Object
Returns the value of attribute item2.
-
#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, res, items) ⇒ BinOp
constructor
A new instance of BinOp.
- #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, res, items) ⇒ BinOp
Returns a new instance of BinOp.
11 12 13 14 15 16 |
# File 'lib/locomotive/relational_algebra/operators/boolean/basic_boolean.rb', line 11 def initialize(op, res, items) self.res, self.item1, self.item2 = res, items[0], items[1] 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
#item1 ⇒ Object
Returns the value of attribute item1.
6 7 8 |
# File 'lib/locomotive/relational_algebra/operators/boolean/basic_boolean.rb', line 6 def item1 @item1 end |
#item2 ⇒ Object
Returns the value of attribute item2.
6 7 8 |
# File 'lib/locomotive/relational_algebra/operators/boolean/basic_boolean.rb', line 6 def item2 @item2 end |
#res ⇒ Object
Returns the value of attribute res.
6 7 8 |
# File 'lib/locomotive/relational_algebra/operators/boolean/basic_boolean.rb', line 6 def res @res end |
Instance Method Details
#child=(op) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/locomotive/relational_algebra/operators/boolean/basic_boolean.rb', line 18 def child=(op) unless op.schema.attributes?([item1]) raise CorruptedSchema, "Schema #{op.schema.attributes} does not " \ "contain all attributes of #{item1}." end unless op.schema.attributes?([item2]) raise CorruptedSchema, "Schema #{op.schema.attributes} does not " \ "contain all attributes of #{item2}." end self.schema = op.schema + Schema.new({ res => [RBool.instance] }) super(op) end |
#clone ⇒ Object
48 49 50 51 52 53 |
# File 'lib/locomotive/relational_algebra/operators/boolean/basic_boolean.rb', line 48 def clone self.class.new(child.clone, res.clone, item1.clone, item2.clone) end |
#set(var, plan) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/locomotive/relational_algebra/operators/boolean/basic_boolean.rb', line 55 def set(var, plan) self.class.new( child.set(var,plan), res.clone, item1.clone, item2.clone) end |
#xml_content ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/locomotive/relational_algebra/operators/boolean/basic_boolean.rb', line 36 def xml_content content do [column(:name => res.to_xml, :new => true), column(:name => item1.to_xml, :new => false, :position => 1), column(:name => item2.to_xml, :new => false, :position => 2)].join end end |
#xml_kind ⇒ Object
44 45 46 |
# File 'lib/locomotive/relational_algebra/operators/boolean/basic_boolean.rb', line 44 def xml_kind self.class.to_s.split('::').last.downcase.to_sym end |