Class: Locomotive::RelationalAlgebra::Variable
- Inherits:
-
Leaf
- Object
- RelAlgAstNode
- Operator
- Leaf
- Locomotive::RelationalAlgebra::Variable
- Defined in:
- lib/locomotive/relational_algebra/operators/abstraction/variable.rb
Class Attribute Summary collapse
-
.id_pool ⇒ Object
Returns the value of attribute id_pool.
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#items ⇒ Object
Returns the value of attribute items.
Attributes inherited from Operator
Attributes included from AstHelpers::AstNode
#kind, #left_child, #owner, #right_child, #value
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #clone ⇒ Object
- #free ⇒ Object
-
#initialize(id, *items) ⇒ Variable
constructor
A new instance of Variable.
- #set(var, plan) ⇒ Object
- #xml_content ⇒ Object
Methods inherited from Operator
#bound, #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(id, *items) ⇒ Variable
Returns a new instance of Variable.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/locomotive/relational_algebra/operators/abstraction/variable.rb', line 24 def initialize(id, *items) self.id, self.items = id, items Variable.id_pool << self.id self.schema = Schema.new({ Iter.new(1) => [RNat.type], Pos.new(1) => [RNat.type] }.merge( Hash[*items.collect do |it| [it, [RNat.instance]] end.flatten_once]) ) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Locomotive::AstHelpers::Annotations
Class Attribute Details
.id_pool ⇒ Object
Returns the value of attribute id_pool.
8 9 10 |
# File 'lib/locomotive/relational_algebra/operators/abstraction/variable.rb', line 8 def id_pool @id_pool end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
18 19 20 |
# File 'lib/locomotive/relational_algebra/operators/abstraction/variable.rb', line 18 def id @id end |
#items ⇒ Object
Returns the value of attribute items.
18 19 20 |
# File 'lib/locomotive/relational_algebra/operators/abstraction/variable.rb', line 18 def items @items end |
Class Method Details
Instance Method Details
#==(other) ⇒ Object
45 46 47 48 |
# File 'lib/locomotive/relational_algebra/operators/abstraction/variable.rb', line 45 def ==(other) other.class == Variable and other.id == self.id end |
#clone ⇒ Object
35 36 37 |
# File 'lib/locomotive/relational_algebra/operators/abstraction/variable.rb', line 35 def clone Variable.new(id, *items.clone) end |
#free ⇒ Object
58 59 60 |
# File 'lib/locomotive/relational_algebra/operators/abstraction/variable.rb', line 58 def free [ self.clone ] end |
#set(var, plan) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/locomotive/relational_algebra/operators/abstraction/variable.rb', line 50 def set(var,plan) if var == self plan.clone else self.clone end end |
#xml_content ⇒ Object
39 40 41 42 43 |
# File 'lib/locomotive/relational_algebra/operators/abstraction/variable.rb', line 39 def xml_content content do variable :name => id end end |